MCXA153 Hard Fault on GPIO_PinInit

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MCXA153 Hard Fault on GPIO_PinInit

ソリューションへジャンプ
226件の閲覧回数
aberger
Contributor V

I'm trying to initialize a pin on the FRDM-MXCA153 as GPIO Output, but the GPIO_PinWrite throws a HardFault. 

Here is code execution, paused at the write to the PSOR register for GPIO3. 

GPIO_PinWrite().png

The Hard Fault occurs immediately upon execution of the base->PSOR write.

HardFault_Handler().png

You can also see in the call stack <signal handler called>() at 0xffffffb8. 

There is no custom code here, just a call to the library code from fsl_gpio. I am using SDK_2.16.000 for the MXCA153.

Minimum example project is also attached.

ラベル(1)
0 件の賞賛
返信
1 解決策
118件の閲覧回数
XuZhang
NXP Employee
NXP Employee

hi,aberger

If pin P3_12 is used, kCLOCK_GatePORT3 should be enabled. If pin P3_12 is used as a common GPIO pin, kCLOCK_GateGPIO3 should be enabled.
When the GPIO pin is initialized in the Config Tools tool, the code will be updated to enable kCLOCK_GateGPIO3.

XuZhang_0-1721813608540.png

XuZhang_1-1721813727485.png

I hope this can help you. If you have any other questions, contact me again. 

BR

Xu Zhang

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
107件の閲覧回数
aberger
Contributor V

Thanks. It seems that routing a pin as GPIO (i.e. clicking the checkbox for the pin in the GPIO list in the "Peripheral Signals" tab), but leaving the Direction as "Not Specified" is not sufficient to generate the CLOCK_EnableClock(kCLOCK_GateGPIO3) call in pin_mux.c. The Direction must be specified too.

0 件の賞賛
返信
190件の閲覧回数
XuZhang
NXP Employee
NXP Employee

hi,aberger

Thank you for your interest in NXP products and opportunity to serve you,I will gladly help you with this.

The clock has not been enabled in your code. After adding CLOCK_EnableClock(kCLOCK_GateGPIO3) to your demo, the error was successfully resolved.

XuZhang_0-1721358750667.png

 

I hope this can help you. If you have any other questions, contact me again. The fixed code is also attached.

BR

Xu Zhang

 

0 件の賞賛
返信
154件の閲覧回数
aberger
Contributor V

Hi @XuZhang ,

Thank you for the response. Can you explain the difference between kCLOCK_GatePORT3 and kCLOCK_GateGPIO3?

You can see the the clock for PORT3 is enabled in my project inside BOARD_InitBootPins() (and this is auto-generated by Config Tools in the pin_mux.c file when I selected GPIO3, pin 12 to be routed). Why did Config Tools not enable the clock for GPIO3? 

0 件の賞賛
返信
119件の閲覧回数
XuZhang
NXP Employee
NXP Employee

hi,aberger

If pin P3_12 is used, kCLOCK_GatePORT3 should be enabled. If pin P3_12 is used as a common GPIO pin, kCLOCK_GateGPIO3 should be enabled.
When the GPIO pin is initialized in the Config Tools tool, the code will be updated to enable kCLOCK_GateGPIO3.

XuZhang_0-1721813608540.png

XuZhang_1-1721813727485.png

I hope this can help you. If you have any other questions, contact me again. 

BR

Xu Zhang

0 件の賞賛
返信