Hello,
We started using MCUXpresso ConfigTools and we have this strange issue. We are using the MIMXRT1060-EVK devboard, with MCUXpresso 5.11.0.
When configuring the clocks through the Clock tool in ConfigTools, the settings aren't taken into account.
For example, when using the MIMXRT1060-EVK board in an empty project and the LPUART driver, the clock configuration is 4MHz in the Clock Tool.
I configure the LPUART to 115200 bauds. If I want to have the baudrate of 115200, when I init the port with the function status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz), if I use the configured speed of 4MHz as above, I get a baudrate that is 20 times faster.
When looking through the MIMXRT1060-EVK example of the LPUART, I can see that the UART_CLK_ROOT is set to 80MHz which is 20 times faster than 4MHz.
So even with the clock diagram configure with 4MHz, I need to initialize the LPUART with a clockspeed of 80MHz to get the right baud rate of 115200.
So my question is this : Why are the clock configs not taken into account with the generated code? And how can I make sure that the clocks configured are used?
Thanks,
Jean-Francois
To recreate the issue:
1) Create a new empty project from the MIMXRT1060-EVK SDK. Choose an empty board profile.
2) In the config tool for the Pins, make sure that the LPUART3 TX and RX pins are configured to J12 and K10 pins. This is the pin 2 and 1 from the Arduino connector J22.
3) In the Clock tool, leave the configuration as it is. The UART_CLK_ROOT by default is 4MHz.
4) In the Peripherals config tool, enable LPUART3 and set as polling. The Clock Source Frequency is set as 4MHz and Baudrate set to 115200.
5) Update the code to generate the appropriate files. The ConfigTools generates a function called BOARD_InitBootPeripherals(). In that fonction, the LPUART3 is initialized with the value of LPUART3_CLOCK_SOURCE which is equal to 4000000UL (4MHz).
6) I add a simple LPUART_WriteBlocking() call In the main loop of 1 char.
With a speed of 115200 bauds, it should take around 69us to transmit 8 bits. However, when looking at the logic analyzer data, we see that it takes 3.5us to transmit 8 bits with the current configuration. 69/3.5 = 19.7 which is around 20 times faster.
When looking at the examples of the sdk, the dev kit is configured to run at high speeds (600Mhz) and the Uart Clock is configured as 80Mhz which is 20 times faster than 4Mhz.
In the current code, if I init the port with 80Mhz instead of the 4MHz that is configured in the Clock tools, I get the right timing.
That means that the clock tool isn't configuring the mcu properly and we still have the clock speed of 600MHz even though the clock tool is configured as 24MHz.
We've had the same issue with the CAN FD bus. How can that be fixed. How can the clock settings be properly applied?
Hi,
Thanks for your reply.
According to the above steps, I also created a new project, however, UART_CLK_ROOT is 80 MHz default, and my MCUXpresso IDE is v11.5.0.
Further, I'd like to suggest you choose the Default board files when creating a new project.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
If the project is created with Default Board, the clock is configured at 600MHz. If the project is created with empty Board, the clock is configured at 24MHz.
However, that doesn't change the fact that whatever configuration is used, the generated code should be accurate to what the ConfigTools is showing and that is causing us issue.
If the UART_CLK_ROOT is 4MHz, I should be able to use 4000000UL to have an accurate baudrate.
Hi,
Sorry for replying late.
After checking, the UART_CLK_ROOT should be 80 MHz instead of 4Mh, when booting from the QSPI, the PFD_480_PFD1 is selected as the FLEXSPI clock, which means it will not reconfigure the USB1_PLL in the BOARD_BootClockRUN() function, in another word, the corresponding code of the below clock path will be ignored.
You can check the value of CCM's register to confirm, as UART_CLK_ROOT is 80 MHz, however you use the 4 MHz to configure the baud rate, so the real baud rate becomes 20 times faster finally.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Why are the clock configs not taken into account with the generated code? And how can I make sure that the clocks configured are used?
-- To be prudent, I was wondering if you can demonstrate the steps of replicating the phenomenon.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------