i.MX RT1050 EVKB Unable to set LPUART to 460800 baudrate

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX RT1050 EVKB Unable to set LPUART to 460800 baudrate

926 Views
jrnTransAct
Contributor III

(Edit: After changing serial clock source, I can get baud rate set to 460800. I think the issue has to do with my TTL-RS232 converter board not supporting 460800.

So the actual solution for Mbed OS and the RT1050 EVKB eval board was to modify 
\mbed-os\targets\TARGET_NXP\TARGET_MCUXpresso_MCUS\TARGET_MIMXRT1050\TARGET_EVK\mbed_overrides.c serial_setup_clock() as shown below.

)

I'm using an i.MX RT1050 EVKB eval board running Mbed OS 6. I'm trying to set LPUART3 to 460800 baud. However this fails. I can set the baud to anything below that speed. For example, 230400 works great.

Mbed OS 6 calls it's own function serial_baud() which in turn calls an NXP DRIVER function called
LPUART_SetBaudRate() with a serial clock rate of  24000000 that is defined in fsl_lpuart.c.

LPUART_SetBaudRate() returns kStatus_LPUART_BaudrateNotSupport on baud rate 460800.

If I change the serial clock setup so that the serial clock rate is 80000000 by doing the following:

 

void serial_setup_clock(void)
{
    /* Configure UART divider to default */
    //CLOCK_SetMux(kCLOCK_UartMux, 1); /* Set UART source to OSC 24M */
    CLOCK_SetMux(kCLOCK_UartMux, 0);
    CLOCK_SetDiv(kCLOCK_UartDiv, 0); /* Set UART divider to 1 */
}

 

then LPUART_SetBaudRate()succeeds. However, this only allows me to properly receive serial data at 460800 baud, but I can't send data at that rate.

Notice in the above code Mbed OS is calling an NXP fsl_clock_config.c function 
CLOCKSetMux(kCLOCK_UartMux, 0) which gives a uart clock rate of 80000000.

Any help on this would be greatly appreciated.
This is being done for a commercial product. If I need to buy a support contract I will, just let me know how to do so.

I've attached fsl_lpuart.c.

------
Jim Norton
Sr. Firmware Engineer - TransAct Technologies, Inc.
0 Kudos
2 Replies

896 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @jrnTransAct,

Thanks for sharing your solution.

Best Regards,

Alexis Andalon

895 Views
jrnTransAct
Contributor III

It appears that Mbed OS had specifically changed the LPUART clock source from what NXP had used in their driver. 

With an 80MHz clock I can still use 115200 and 460800. It's unclear to me why the Mbed OS folks wouldn't use the default set up by NXP.

 

 

------
Jim Norton
Sr. Firmware Engineer - TransAct Technologies, Inc.
0 Kudos