Menu

#74 FreeRTOS_lpc17xx_uart.c - incorrect ioctlSET_SPEED behavior

v1.0 (example)
closed-out-of-date
nobody
None
5
2020-02-22
2013-10-17
michaelu
No

On LPC17xx:
ioctlSET_SPEED call resets "FIFO settings" and "Enable Tx flag", which are tuned by FreeRTOS_open().

"""
//code sample:
// ...
xPS_OpenedPort = FreeRTOS_open( (const I8*) SENSOR_UART, NULL );
if( xPS_OpenedPort != NULL )
{
FreeRTOS_ioctl( xPS_OpenedPort, ioctlSET_SPEED, ( void * ) UARTBaudRate );
// ...
"""

As workaround i've modified ioctlSET_SPEED in FreeRTOS_lpc17xx_uart.c (added code marked by "///+++", "///---"):
"""
case ioctlSET_SPEED :

            /* Set up the default UART configuration. */
            xUARTConfig.Baud_rate = ulValue;
            xUARTConfig.Databits = UART_DATABIT_8;
            xUARTConfig.Parity = UART_PARITY_NONE;
            xUARTConfig.Stopbits = UART_STOPBIT_1;
            UART_Init( pxUART, &xUARTConfig );
            ///+++
            /* Enable the FIFO. */
            xUARTFIFOConfig.FIFO_ResetRxBuf = ENABLE;
            xUARTFIFOConfig.FIFO_ResetTxBuf = ENABLE;
            xUARTFIFOConfig.FIFO_DMAMode = DISABLE;
            xUARTFIFOConfig.FIFO_Level = UART_FIFO_TRGLEV2;
            UART_FIFOConfig( pxUART, &xUARTFIFOConfig );

            /* Enable Tx. */
            UART_TxCmd( pxUART, ENABLE );
            ///---
            break;

"""

Discussion

  • michaelu

    michaelu - 2013-10-17

    "Featured FreeRTOS+IO and FreeRTOS+CLI Demo" - LPC1769_FreeRTOS_Plus_Featured_Demo_002.zip

     
  • Richard Barry

    Richard Barry - 2020-02-22
    • status: open --> closed-out-of-date
     
  • Richard Barry

    Richard Barry - 2020-02-22

    Being replaced by the Common IO interface.

     

Log in to post a comment.