Flexio baud problem

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

Flexio baud problem

Jump to solution
662 Views
zahomz
Contributor III

I'm trying to use the sdk driver examples about flexio uart(use FRDM-K82F board). I found that everything is ok when I use baud higher than 38400. When I use the baud lower than 38400, the data is error.

 

Any suggestions for how to find/fix the problem?

 

Example Code as below:

    lpuart_state_t lpuartStatePtr;

    flexio_user_config_t userConfig =

    {

        .useInt = true,

        .onDozeEnable = false,

        .onDebugEnable = true,

        .fastAccessEnable = false

    };

 

    // Enable clock for PORTs, setup board clock source, config pin

    hardware_init();

 

    // Call OSA_Init to setup LP Timer for timeout

    OSA_Init();

 

    FLEXIO_DRV_Init(s_flexioInstance,&userConfig);

    FLEXIO_DRV_Start(s_flexioInstance);

 

    /* Fill in FlexIO UART config data */

    flexio_uart_userconfig_t uartConfig;

    uartConfig.bitCounter = kFlexIOUart8BitsPerChar;

    uartConfig.baudRate = 9600;

    uartConfig.uartMode = flexioUART_TxRx;

    uartConfig.txConfig.pinIdx = 0;

    uartConfig.txConfig.shifterIdx = 0;

    uartConfig.txConfig.timerIdx = 0;

    uartConfig.rxConfig.pinIdx = 2;

    uartConfig.rxConfig.shifterIdx = 1;

    uartConfig.rxConfig.timerIdx = 1;

 

    /* init the FlexIO simulated UART module with base address and config structure*/

    FLEXIO_UART_DRV_Init(s_flexioInstance, &uartState, &uartConfig);

 

    while(true)

    {

        FLEXIO_UART_DRV_SendData(&uartState, txBuff, DATA_LENGTH);

        flexio_uart_reset_buffer(rxBuff,DATA_LENGTH);

        FLEXIO_UART_DRV_ReceiveDataBlocking(&uartState, rxBuff, DATA_LENGTH,5000U);

    }

Labels (1)
0 Kudos
1 Solution
443 Views
zahomz
Contributor III

I found that it will configure register FLEXIOx_TIMCMPn(FLEXIO_UART_DRV_Init->FLEXIO_UART_Tx_HAL_Configure).

When flexio uart's baud is 9600, CMP[7:0] is not enough to store the value.

How could I resolve this problem?

pastedImage_0.png

pastedImage_1.png

View solution in original post

0 Kudos
1 Reply
444 Views
zahomz
Contributor III

I found that it will configure register FLEXIOx_TIMCMPn(FLEXIO_UART_DRV_Init->FLEXIO_UART_Tx_HAL_Configure).

When flexio uart's baud is 9600, CMP[7:0] is not enough to store the value.

How could I resolve this problem?

pastedImage_0.png

pastedImage_1.png

0 Kudos