fsl_gpio_driver incorrectly outputs to GPIO pin prior to setting the default output logic.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

fsl_gpio_driver incorrectly outputs to GPIO pin prior to setting the default output logic.

916 次查看
lucianomoretti
Contributor IV

In the GPIO_DRV_OutputPinInit() function located in fsl_gpio_driver.c, the function calls the GPIO_HAL_SetPinDir() function that enables the pin prior to setting up the GPIO output features.

 

If an output is set to active low, it will be active as soon as the GPIO_HAL_SetPinDir() function is called, prior to the GPIO_HAL_WritePinOutput() call with the outputPin->config.outputLogic of 1.

 

Calling GPIO_HAL_WritePinOutput() prior to GPIO_HAL_SetPinDir() appears to correct the issue.

标签 (1)
标记 (2)
0 项奖励
回复
3 回复数

627 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Luciano,

Yes , in my personal opinion, you are right .

Strictly speaking, we should first configure the logic level(0 or 1) , then set the gpio to output direction.

You can change the two HAL function position , then build the ksdk_platform_lib again, then use the function :

GPIO_DRV_OutputPinInit()  .

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

627 次查看
lucianomoretti
Contributor IV

I've already reworked the order slightly.  This bug actually causes our board to go into a reset loop, as it turns on components that draw too much power before we can negotiate more power over the USB connection.

0 项奖励
回复

627 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Luciano,

Sorry for the inconvenient to you !

BR

Alice

0 项奖励
回复