Crash when using flexcomm5 as i2c on LPC5526 #52727
-
Describe the bug Please also mention any information which could help others to understand
/* I2C5 SCL */ pinmux_pin_set(port0, 8, port0_pin8_config); To Reproduce
Expected behavior Workaround Logs and console output |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
It appears the application does not crash anymore but i2c is not usable. In fsl_clock.h, CLOCK_GetCTimerClkFreq returns 0. This is why it is crashing. What is the clock frequency for flexcomm5? |
Beta Was this translation helpful? Give feedback.
-
Hi @RomainPelletant , The clock function returns 0 Hz because the clock signal to Flexcomm5 is not enabled. The clocks are initialized in soc.c. These lines in soc.c are where some other Flexcomm clocks are selected and enabled. The same needs to be done for Flexcomm5. One option is to modify this soc.c file. However, clock configuration will depend on the board/application. If I were changing this, I would want to control it in my own board file, not in the shared soc.c. Your board file could add another hardware initialization function similar to clock_init(). And you can add your init function to Zephyr's start-up initialization using the SYS_INIT macro. Just be aware of the initialization order. You will need your init function that enables the Flexcomm5 clock to be called before the Flexcomm driver initialization. The webinar Application Portability Made Easy With Zephyr OS and NXP has more details on the start-up process. Best regards |
Beta Was this translation helpful? Give feedback.
-
Thanks @DerekSnell |
Beta Was this translation helpful? Give feedback.
Hi @RomainPelletant ,
The clock function returns 0 Hz because the clock signal to Flexcomm5 is not enabled. The clocks are initialized in soc.c. These lines in soc.c are where some other Flexcomm clocks are selected and enabled. The same needs to be done for Flexcomm5.
One option is to modify this soc.c file. However, clock configuration will depend on the board/application. If I were changing this, I would want to control it in my own board file, not in the shared soc.c. Your board file could add another hardware initialization function similar to clock_init(). And you can add your init function to Zephyr's start-up initialization using the SYS_INIT macro. Just be aware of the initializa…