Enable UART console in LPCXpresso55s69 EVB flexcomm0 question #65498
-
Hi,
Below is my init.c content, it do some clock attach/setup and these setting just refer to zephyr/soc/arm/nxp_lpc/lpc55xxx/soc.c
I also add CONFIG in my defconfig file, as below
But my putty always show USAGE FAULT Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Hi @MarsMSWu , The files that you mentioned, are these for a custom board? I suggest you use this board in the repo Let us know what you find. Best regards |
Beta Was this translation helpful? Give feedback.
-
Hi @MarsMSWu , Sorry, I am not sure what is causing the fault on your board. I have a suggestion you can try, although I am not optimistic it will help. I noticed in clock_init(), the clock to Flexcomm0 is not initialized. Testing on my LPCXpresso55S69 board, I see using the debugger that the clock tree is initialized already when the application starts executing. The clock mux register If that change does not help, then I think the best option is to use a debugger with the startup code, and confirm what is causing the fault. It seems you already tried building an image for your custom board, and then executed it on the LPCXpresso55S69 board, and that worked. So it seems there is some hardware difference with your custom board related to this fault. The fault capture you shared printed the PC was at 0x1000_F408 when the fault occurred, so that can help narrow down where in the code the fault occurs. But it also seems this fault occurs every time for you, so it should be simple to step through the startup code and find where it occurs. Since you also have code working on the eval board, you can use the debugger on that board to compare how it executes successfully, and what is different. That should expose the root cause. If a fault occurs the first time accessing a register of a peripheral, that is usually a bus fault caused by a disabled clock. When the registers accessed are not clocked, this will lead to a bus fault. If you find that is the case, you can view the registers in the debugger to confirm the clock configuration, and also compare it with the working eval board. For example, If you are not already using a debugger, one option is NXP's MCUXpresso extension for VS Code. We have Zephyr Lab Guides posted there to help get started, including using the debugger to view peripheral registers. If you have any questions or issues using this VS Code extension, please share them at the GitHub Issues for MCUXpresso extension for VS Code. Please let us know what you find. Best regards |
Beta Was this translation helpful? Give feedback.
-
Thanks, @MarsMSWu Can you explain more about the clock settings you are doing in your init.c? Typically, the clock_init() from soc.c will execute early in the initialization code, at the Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @MarsMSWu , When you create a custom board, I recommend starting your board files from the closest existing board available using that SOC or SOC family. In this case, I would use the devicetree files from the LPCXpresso55S69 board as your starting point, and then modify to match your hardware. I am sorry I caused the confusion about the Flexcomm0 clock. That was a theory I had, but it now seems unrelated to your issue. Because the Boot ROM enables the clock to Flexcomm0, the application is not required to configure it, unless the app wants to use different clock settings. But it would not cause issues for the app to reconfigure the clock. Just be sure the clock is configured before the Flexcomm driver is initialized. And yes, other Flexcomms will need the clock enabled before initializing, like FC6. When I tested the config after boot, I saw the Flexcomm0 and Flexcomm1 clocks were already enabled by the Boot ROM. But most of the Flexcomm clocks are not enabled at boot, and the app needs to enable before using them. Best regards |
Beta Was this translation helpful? Give feedback.
Hi @MarsMSWu ,
When you create a custom board, I recommend starting your board files from the closest existing board available using that SOC or SOC family. In this case, I would use the devicetree files from the LPCXpresso55S69 board as your starting point, and then modify to match your hardware.
I am sorry I caused the confusion about the Flexcomm0 clock. That was a theory I had, but it now seems unrelated to your issue. Because the Boot ROM enables the clock to Flexcomm0, the application is not required to configure it, unless the app wants to use different clock settings. But it would not cause issues for the app to reconfigure the clock. Just be sure the clock is configured before th…