Hard fault initialising GPIO port

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

Hard fault initialising GPIO port

跳至解决方案
474 次查看
ArkAndyFraser
Contributor III

Every time I create a new S32K144 project I fall into the same trap and I can never remember how to get out of it

I am using a FS32K144 48-pin device to provide simple digital I/O and a UART. I am using the internal fast 48MHz clock. I have setup all my clocks and all my digital I/O ports and built the project. I am initialising the hardware as follows:

//
// Setup clocks.
//
// CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
// CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
CLOCK_DRV_Init(&clockMan1_InitConfig0);

//
// Setup Digital I/O.
//
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);

//
// LPUART (430600, n, 8, 1)
//
LPUART_DRV_Init(lpUartInstance, lpUartState, lpUartInitConfig);
LPUART_DRV_InstallRxCallback(lpUartInstance, rxCallback, NULL);

 When I debug the code I get the following:

Initializing.
Target has been RESET and is active.
BusFault: A precise (synchronous) data access error has occurred.
Possible BusFault location: 0x40049000.
HardFault: A fault has been escalated to a hard fault.

Again, as before, the fault is thrown on this line in PINS_Init:

uint32_t regValue = config->base->PCR[config->pinPortIdx];

If I hover over PCR, I seem to get the correct port A address

ArkAndyFraser_0-1703426176427.png

 

Any idea what I am doing wrong? - again

Andy

0 项奖励
回复
1 解答
465 次查看
ArkAndyFraser
Contributor III

Nevermind - I still had the external clock input enabled even though I don't have an external clock !

Andy

在原帖中查看解决方案

0 项奖励
回复
1 回复
466 次查看
ArkAndyFraser
Contributor III

Nevermind - I still had the external clock input enabled even though I don't have an external clock !

Andy

0 项奖励
回复