This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GPIO_SetupPinOptions后需要再GPIO_WritePin吗?

如果通过GPIO_SetupPinOptions将GPIO设置成输出后,还需要通过GPIO_WritePin写0或写1吗?

设置成输出后,有没有默认电平,是不是只需要通过GPIO_WritePin修改与默认电平不一致的GPIO?

  • 这取决于您使用的芯片,您可以查看数据手册来确认以下对应引脚的默认输出电平,如28069

    GPIO端口上电是默认输入高阻态,但是内部上拉是使能的,所以在系统上电后,没有程序初始化的情况下,GPIO是高电平

  • 我用的是28377d,在哪可以确认默认输出电平
  • 您可以参考数据手册

    www.ti.com/.../tms320f28377d.pdf

    7.2 Signal Descriptions

    All GPIO pins are I/O/Z and have an internal pullup, which can be selectively enabled or disabled on a per-pin basis. This feature only applies to the GPIO pins. The pullups are not enabled at reset.

    在F2837x器件上,所有引脚在复位时均禁用其内部上拉电阻,用户可以通过软件启用。在初始状态GPIO默认是Hi-Z,在您使用GPIO_SetupPinOptions配置时可以选择GPIO_PULLUP,这样就是高电平了。

    更多信息可以参考用户指南的第8章 GPIO

    www.ti.com/.../spruhm8i.pdf