Initializing 2 UART channels in FreeRTOS enviroment

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

Initializing 2 UART channels in FreeRTOS enviroment

945 Views
dylan_maisel
Contributor I

Hello,

I am very new to NXP microcontrollers in general and I am trying to determine if an NXP LPC55S69 is appropriate for a multi-channel computing platform that interfaces with BLE radios. I have an EVK and have been trying to modify a demo program "RTOS->USART" from the 55S6x SDK. I cannot seem to get Flexcomm2 to properly initialize a USART channel to the P18 header. I do know that Flexcomm0 seems to be connected to both the Link2 debugger on the EVK and P8 comms header. I have uploaded my modified source code. I started with the pin config tool, and attempted to duplicate the UART initialization code snippets to get the flexcomm2 working in UART mode, but I have not been successful. Any help would be greatly appreciated!

Labels (2)
Tags (2)
0 Kudos
2 Replies

845 Views
dylan_maisel
Contributor I

Thank you very much, I will try that! I did make some progress in understanding how to use the device configuration tool over the weekend. Setting up the project properly and trying to understand the IDE's unique workflow is critical.
Thanks again for your time!

0 Kudos

845 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Dylan,

As you know that the the FC2 pins which are connected to pin13 and 15 of P18 of LPC55S69 board are:

P18_13        FC2_USART_TXD_ARDC           P0_27(PIO0_27)

P18_15        FC2_USART_RXD_ARDC           P1_24(PIO1_24)

I have tried to develop the code based on the SDK example, I attached the example, but I do not have a test on board. The example is under MCUXpresso ver11.1 and SDK2.6.3_LPCXpresso55s69.zip.

Pls have a try yourself.

what I modified is :

#define DEMO_USART USART2
#define DEMO_USART_CLK_SRC kCLOCK_Flexcomm2
#define DEMO_USART_CLK_FREQ CLOCK_GetFlexCommClkFreq(2U)
#define DEMO_USART_IRQHandler FLEXCOMM2_IRQHandler
#define DEMO_USART_IRQn FLEXCOMM2_IRQn
/* Task priorities. */
#define uart_task_PRIORITY (configMAX_PRIORITIES - 1)
#define USART_NVIC_PRIO 5
/*******************************************************************************

void BOARD_InitPins(void)
{
    /* Enables the clock for the I/O controller.: Enable Clock. */
    CLOCK_EnableClock(kCLOCK_Iocon);
#if 0
    const uint32_t port0_pin29_config = (/* Pin is configured as FC0_RXD_SDA_MOSI_DATA */
                                         IOCON_PIO_FUNC1 |
                                         /* No addition pin function */
                                         IOCON_PIO_MODE_INACT |
                                         /* Standard mode, output slew rate control is enabled */
                                         IOCON_PIO_SLEW_STANDARD |
                                         /* Input function is not inverted */
                                         IOCON_PIO_INV_DI |
                                         /* Enables digital function */
                                         IOCON_PIO_DIGITAL_EN |
                                         /* Open drain is disabled */
                                         IOCON_PIO_OPENDRAIN_DI);
    /* PORT0 PIN29 (coords: 92) is configured as FC0_RXD_SDA_MOSI_DATA */
    IOCON_PinMuxSet(IOCON, 0U, 29U, port0_pin29_config);

    const uint32_t port0_pin30_config = (/* Pin is configured as FC0_TXD_SCL_MISO_WS */
                                         IOCON_PIO_FUNC1 |
                                         /* No addition pin function */
                                         IOCON_PIO_MODE_INACT |
                                         /* Standard mode, output slew rate control is enabled */
                                         IOCON_PIO_SLEW_STANDARD |
                                         /* Input function is not inverted */
                                         IOCON_PIO_INV_DI |
                                         /* Enables digital function */
                                         IOCON_PIO_DIGITAL_EN |
                                         /* Open drain is disabled */
                                         IOCON_PIO_OPENDRAIN_DI);
    /* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
    IOCON_PinMuxSet(IOCON, 0U, 30U, port0_pin30_config);
#endif
    const uint32_t port0_pin27_config = (/* Pin is configured as FC0_RXD_SDA_MOSI_DATA */
                                         IOCON_PIO_FUNC1 |
                                         /* No addition pin function */
                                         IOCON_PIO_MODE_INACT |
                                         /* Standard mode, output slew rate control is enabled */
                                         IOCON_PIO_SLEW_STANDARD |
                                         /* Input function is not inverted */
                                         IOCON_PIO_INV_DI |
                                         /* Enables digital function */
                                         IOCON_PIO_DIGITAL_EN |
                                         /* Open drain is disabled */
                                         IOCON_PIO_OPENDRAIN_DI);
    /* PORT0 PIN29 (coords: 92) is configured as FC0_RXD_SDA_MOSI_DATA */
    IOCON_PinMuxSet(IOCON, 0U, 27U, port0_pin27_config);

    const uint32_t port1_pin24_config = (/* Pin is configured as FC0_TXD_SCL_MISO_WS */
                                         IOCON_PIO_FUNC1 |
                                         /* No addition pin function */
                                         IOCON_PIO_MODE_INACT |
                                         /* Standard mode, output slew rate control is enabled */
                                         IOCON_PIO_SLEW_STANDARD |
                                         /* Input function is not inverted */
                                         IOCON_PIO_INV_DI |
                                         /* Enables digital function */
                                         IOCON_PIO_DIGITAL_EN |
                                         /* Open drain is disabled */
                                         IOCON_PIO_OPENDRAIN_DI);
    /* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
    IOCON_PinMuxSet(IOCON, 1U, 24U, port1_pin24_config);
}

BR

XiangJun Rong