1060 hard fault in GPIO_PinInit

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

1060 hard fault in GPIO_PinInit

1,291 次查看
tomdunigan
Contributor II

If i call GPIO_PinInit() with GPIO6 on my 1060 ( SDK SDK_2.5.0_EVK-MIMXRT1060), I get a hard fault.  Works OK for GPIO1, and I can get around it by manually setting GPIO6 registers.  GPIO_PinInit() in fsl_gpio.c calls CLOCK_EnableClock() to configure the clock, but GPIO6 and higher don't have a clock to be configured.  And in fsl_clock.h, GPIO_CLOCKS only has definitions up to GPIO5, so  GPIO_GetInstance() will have an assert failure when referencing GPIO6.

0 项奖励
5 回复数

1,121 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Tom,

Thanks for catching this! This is a bug from the current version of the SDK, I already reported it so it can be fixed in the next version. In the meanwhile, you can fix this problem by adding an if condition inside the function GPIO_PinInit.

If you are using GPIO6, GPIO7, GPIO8, or GPIO9 then you don't have to call the function to enable the clock. Something like the following:

pastedImage_4.png

Hope it helps!

Victor.

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 项奖励

1,121 次查看
nickdolling
Contributor IV

I just came across the same issue... however are you saying that GPIO6+ don't need the clock enabled at all (ie they're permanently enabled), or you have to manually do it as per the original poster and your change above is just to avoid the crash?

Nick

BTW - who tests this stuff?

0 项奖励

1,121 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Nick,

You don't need to activate any clock for >GPIO6. With the change I showed in my first reply you can work with all the GPIOs without any problems, the change is not just to avoid the crash.

Best regards,

Victor.

0 项奖励

1,121 次查看
nickdolling
Contributor IV

Hi Victor,

Thanks for the reply... I eventually found the bit in the Reference manual where it states that GPIO6-9 are clocked from the AHB clock... it was slightly confusing having some of the info in one table called "Table 13-4 System Clocks, Gating, and Override" and the rest (or all?) of it in another (immediately after) called "Table 13-5 System Clocks, Gating, and Override".

Nick

0 项奖励

1,121 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Nick,

Thanks for the feedback regarding the reference manual, I will pass it to the documentation team.

Just to conclude what you mentioned, GPIO6-9 are clocked from the AHB clock because GPIO6-8 are tightly coupled GPIOs, to be accessed with high frequency. In the following document, I make the comparison between normal GPIO and tightly coupled GPIO.

RT1060 Normal GPIO vs Fast GPIO 

Best regards,

Victor.

0 项奖励