FRDM-K64F crashes trying to set SPI ports

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

FRDM-K64F crashes trying to set SPI ports

568 次查看
roel0
Contributor II
int main()  {      volatile uint32_t i;       // Init clocks      hardware_init();      dbg_uart_init();      OSA_Init();      GPIO_DRV_Init(switchPins, ledPins);                LED1_EN;       LED1_TOGGLE;      configure_spi_pins(SPI1_IDX);

 

The code above crashes on line 14

 

GDB output:

configure_spi_pins (instance=1) at /home/roel/Downloads/KSDK_1.3.0/examples/frdmk64f/pin_mux.c:251

PORT_HAL_SetMuxMode (base=0x4004c000, pin=4, mux=kPortMuxAlt7)

    at /home/roel/Downloads/KSDK_1.3.0/examples/frdmk64f/demo_apps/test/armgcc/../../../../../platform/hal/inc/fsl_port_hal.h:255

WDOG_EWM_IRQHandler () at /home/roel/Downloads/KSDK_1.3.0/platform/devices/MK64F12/startup/gcc/startup_MK64F12.S:349

(gdb)

 

 

 

This is my first project on this board an I've absolute no idea what the cause is of this error. Has anyone had familiar errors?
Thanks in advance!

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

426 次查看
roel0
Contributor II

The problem was I was using an old example which was missing the following line in hardware_init.c

CLOCK_SYS_EnablePortClock(PORTD_IDX);

0 项奖励

426 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Thank you for your solution sharing.

If you still have question, please let us know.

Best Regards,

Jingjing

0 项奖励