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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

660 Views
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.

Labels (1)
Tags (2)
0 Kudos
3 Replies

371 Views
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 Kudos

371 Views
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 Kudos

371 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Luciano,

Sorry for the inconvenient to you !

BR

Alice

0 Kudos