Flexio baud problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
891件の閲覧回数
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);

    }

ラベル(1)
0 件の賞賛
返信
1 解決策
672件の閲覧回数
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 件の賞賛
返信
1 返信
673件の閲覧回数
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 件の賞賛
返信