<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: LPC55S28 some USART works and some no!</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945758#M56768</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The SDK has the example of uart in interrupt mode, pls try to run it and check if there is issue.&lt;/P&gt;
&lt;P&gt;I suggest you have the uart to transfer char repeatedly, then check if you can receive the char or check the waveform of the uart TX pin.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1725328786459.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/296704i3204DC3A26C60914/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1725328786459.png" alt="xiangjun_rong_0-1725328786459.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Sep 2024 02:00:42 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2024-09-03T02:00:42Z</dc:date>
    <item>
      <title>LPC55S28 some USART works and some no!</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1944576#M56756</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;I am working with a custom board with LPC55S28. In this board I am using 4 flexcomm&amp;nbsp; as USART and some works and some no and I don't understand why! The configuration is the same for all. The code is the following:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define UART_LTE_PERIPHERAL                      ((USART_Type *)FLEXCOMM0)
//#define UART_LTE_CLOCK                           kPLL0_DIV_to_FLEXCOMM0
#define UART_LTE_CLOCK                           kFRO_HF_DIV_to_FLEXCOMM0
#define UART_LTE_PERIPHERAL_RESET                kFC0_RST_SHIFT_RSTn
#define UART_LTE_CLOCK_FREQUENCY                 CLOCK_GetFlexCommClkFreq(0U)
#define UART_LTE_BAUDRATE                        (115200ul)

#define UART_LTE_IRQ                             FLEXCOMM0_IRQn
#define UART_LTE_IRQ_HANDLER                     FLEXCOMM0_IRQHandler

#define UART_LTE_TX_GPIO                         GPIO
#define UART_LTE_TX_PORT                         0U
#define UART_LTE_TX_PIN                          30U
#define UART_LTE_TX_ALT_FUNC                     0x01u

#define UART_LTE_RX_GPIO                         GPIO
#define UART_LTE_RX_PORT                         0U
#define UART_LTE_RX_PIN                          29U
#define UART_LTE_RX_ALT_FUNC                     0x01u

#define UART_BLUETOOTH_PERIPHERAL                ((USART_Type *)FLEXCOMM7)
#define UART_BLUETOOTH_CLOCK                     kFRO_HF_DIV_to_FLEXCOMM7
#define UART_BLUETOOTH_PERIPHERAL_RESET          kFC7_RST_SHIFT_RSTn
#define UART_BLUETOOTH_CLOCK_FREQUENCY           CLOCK_GetFlexCommClkFreq(7U)
#define UART_BLUETOOTH_BAUDRATE                  (115200ul)

#define UART_BLUETOOTH_IRQ                       FLEXCOMM7_IRQn
#define UART_BLUETOOTH_IRQ_HANDLER               FLEXCOMM7_IRQHandler

#define UART_BLUETOOTH_TX_GPIO                   GPIO
#define UART_BLUETOOTH_TX_PORT                   0U
#define UART_BLUETOOTH_TX_PIN                    19U
#define UART_BLUETOOTH_TX_ALT_FUNC               0x07u

#define UART_BLUETOOTH_RX_GPIO                   GPIO
#define UART_BLUETOOTH_RX_PORT                   1U
#define UART_BLUETOOTH_RX_PIN                    29U
#define UART_BLUETOOTH_RX_ALT_FUNC               0x01u

// Modbus #1
#define RS485_1_PERIPHERAL                       ((USART_Type *)FLEXCOMM1)
#define RS485_1_CLOCK                            kFRO_HF_DIV_to_FLEXCOMM1
#define RS485_1_PERIPHERAL_RESET                 kFC1_RST_SHIFT_RSTn
#define RS485_1_CLOCK_FREQUENCY                  CLOCK_GetFlexCommClkFreq(1U)
#define RS485_1_BAUDRATE                         (115200ul)

#define RS485_1_IRQ                              FLEXCOMM1_IRQn
#define RS485_1_IRQ_HANDLER                      FLEXCOMM1_IRQHandler

#define RS485_1_TX_GPIO                          GPIO
#define RS485_1_TX_PORT                          0U
#define RS485_1_TX_PIN                           14U
#define RS485_1_TX_ALT_FUNC                      0x06u

#define RS485_1_RX_GPIO                          GPIO
#define RS485_1_RX_PORT                          0U
#define RS485_1_RX_PIN                           13U
#define RS485_1_RX_ALT_FUNC                      0x05u

// Modbus #2
#define RS485_2_PERIPHERAL                       ((USART_Type *)FLEXCOMM4)
#define RS485_2_CLOCK                            kFRO_HF_DIV_to_FLEXCOMM4
#define RS485_2_PERIPHERAL_RESET                 kFC4_RST_SHIFT_RSTn
#define RS485_2_CLOCK_FREQUENCY                  CLOCK_GetFlexCommClkFreq(4U)
#define RS485_2_BAUDRATE                         (115200ul)

#define RS485_2_IRQ                              FLEXCOMM4_IRQn
#define RS485_2_IRQ_HANDLER                      FLEXCOMM4_IRQHandler

#define RS485_2_TX_GPIO                          GPIO
#define RS485_2_TX_PORT                          0U
#define RS485_2_TX_PIN                           20U
#define RS485_2_TX_ALT_FUNC                      0x0Bu

#define RS485_2_RX_GPIO                          GPIO
#define RS485_2_RX_PORT                          0U
#define RS485_2_RX_PIN                           5U
#define RS485_2_RX_ALT_FUNC                      0x02u

static void initUART (bool exitLowPower)
{
    (void)exitLowPower;

    // 4G/LTE UART Management
    CLOCK_AttachClk(UART_LTE_CLOCK);
    RESET_ClearPeripheralReset(UART_LTE_PERIPHERAL_RESET);

    uint32_t pinConfig = (
                UART_LTE_TX_ALT_FUNC  |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,UART_LTE_TX_PORT,UART_LTE_TX_PIN,pinConfig);

    pinConfig = (
                UART_LTE_RX_ALT_FUNC |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,UART_LTE_RX_PORT,UART_LTE_RX_PIN,pinConfig);

    usart_config_t uartLTEConfig =
    {
        .baudRate_Bps = UART_LTE_BAUDRATE,
        .syncMode = kUSART_SyncModeDisabled,
        .parityMode = kUSART_ParityDisabled,
        .stopBitCount = kUSART_OneStopBit,
        .bitCountPerChar = kUSART_8BitsPerChar,
        .loopback = false,
        .txWatermark = kUSART_TxFifo0,
        .rxWatermark = kUSART_RxFifo1,
        .enableRx = true,
        .enableTx = true,
        .enableHardwareFlowControl = false,
        .enableMode32k = false,
        .clockPolarity = kUSART_RxSampleOnFallingEdge,
        .enableContinuousSCLK = false
    };
    USART_Init(UART_LTE_PERIPHERAL,&amp;amp;uartLTEConfig,UART_LTE_CLOCK_FREQUENCY);
    USART_EnableInterrupts(UART_LTE_PERIPHERAL, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable);
    EnableIRQ(UART_LTE_IRQ);

    // BLE/DEBUG UART Management
    CLOCK_AttachClk(UART_BLUETOOTH_CLOCK);
    RESET_ClearPeripheralReset(UART_BLUETOOTH_PERIPHERAL_RESET);

    pinConfig = (
                UART_BLUETOOTH_TX_ALT_FUNC  |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,UART_BLUETOOTH_TX_PORT,UART_BLUETOOTH_TX_PIN,pinConfig);

    pinConfig = (
                UART_BLUETOOTH_RX_ALT_FUNC |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,UART_BLUETOOTH_RX_PORT,UART_BLUETOOTH_RX_PIN,pinConfig);

    usart_config_t uartBluetoothConfig =
    {
        .baudRate_Bps = UART_BLUETOOTH_BAUDRATE,
        .syncMode = kUSART_SyncModeDisabled,
        .parityMode = kUSART_ParityDisabled,
        .stopBitCount = kUSART_OneStopBit,
        .bitCountPerChar = kUSART_8BitsPerChar,
        .loopback = false,
        .txWatermark = kUSART_TxFifo0,
        .rxWatermark = kUSART_RxFifo1,
        .enableRx = true,
        .enableTx = true,
        .enableHardwareFlowControl = false,
        .enableMode32k = false,
        .clockPolarity = kUSART_RxSampleOnFallingEdge,
        .enableContinuousSCLK = false
    };

    USART_Init(UART_BLUETOOTH_PERIPHERAL,&amp;amp;uartBluetoothConfig,UART_BLUETOOTH_CLOCK_FREQUENCY);
    //FIXME: USART_EnableInterrupts(UART_BLUETOOTH_PERIPHERAL, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable);
    //FIXME: EnableIRQ(UART_BLUETOOTH_IRQ);

    // Modbus #1 UART Management
    CLOCK_AttachClk(RS485_1_CLOCK);
    RESET_ClearPeripheralReset(RS485_1_PERIPHERAL_RESET);

    pinConfig = (
                RS485_1_TX_ALT_FUNC  |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,RS485_1_TX_PORT,RS485_1_TX_PIN,pinConfig);

    pinConfig = (
                RS485_1_RX_ALT_FUNC |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,RS485_1_RX_PORT,RS485_1_RX_PIN,pinConfig);

    USART_Init(RS485_1_PERIPHERAL,&amp;amp;uartModbus1Config,RS485_1_CLOCK_FREQUENCY);
//    USART_EnableInterrupts(RS485_1_PERIPHERAL, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable);
//    EnableIRQ(RS485_1_IRQ);

    // Modbus #2 UART Management
    CLOCK_AttachClk(RS485_2_CLOCK);
    RESET_ClearPeripheralReset(RS485_2_PERIPHERAL_RESET);

    pinConfig = (
                RS485_2_TX_ALT_FUNC  |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,RS485_2_TX_PORT,RS485_2_TX_PIN,pinConfig);

    pinConfig = (
                RS485_2_RX_ALT_FUNC |
                /* Selects pull-up function */
                IOCON_PIO_MODE(0)     |
                /* Standard mode, output slew rate control is enabled */
                IOCON_PIO_SLEW(0)     |
                /* Input function is not inverted */
                IOCON_PIO_INVERT(0)   |
                /* Enables digital function */
                IOCON_PIO_DIGIMODE(1));
    IOCON_PinMuxSet(IOCON,RS485_2_RX_PORT,RS485_2_RX_PIN,pinConfig);

    USART_Init(RS485_2_PERIPHERAL,&amp;amp;uartModbus2Config,RS485_2_CLOCK_FREQUENCY);
//    USART_EnableInterrupts(RS485_2_PERIPHERAL, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable);
//    EnableIRQ(RS485_2_IRQ);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The RS485_2 (flexcomm4) and LTE (flexcomm0) works and I can transmit data.&amp;nbsp; The other two doens't works and the tx line is always low. I check the pin and the configuration several times... can you help me to find the bug?&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 15:38:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1944576#M56756</guid>
      <dc:creator>MarcoGiammarini</dc:creator>
      <dc:date>2024-08-30T15:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28 some USART works and some no!</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945159#M56763</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;First of all, you have to enable the IOCON module clock before you initialize the IOCON register, pls add the line at the first of the code.&lt;/P&gt;
&lt;P&gt;I have checked the other code, it appears it is okay.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Xiangjun Rong&lt;/P&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Consolas'; font-size: 10pt; white-space: pre;"&gt;
&lt;P style="background-color: #e8f2fe; margin: 0;"&gt;&lt;SPAN&gt;CLOCK_EnableClock(&lt;/SPAN&gt;&lt;SPAN&gt;kCLOCK_Iocon&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background-color: #e8f2fe; margin: 0;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Sep 2024 06:17:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945159#M56763</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2024-09-02T06:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28 some USART works and some no!</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945247#M56765</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thanks for your reply. In the code I put in the previous message I forgot the line to enable the IOCON, but before calling the initUarts() I enable the IOCON clock.&lt;/P&gt;&lt;P&gt;Any other tips?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 07:40:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945247#M56765</guid>
      <dc:creator>MarcoGiammarini</dc:creator>
      <dc:date>2024-09-02T07:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S28 some USART works and some no!</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945758#M56768</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The SDK has the example of uart in interrupt mode, pls try to run it and check if there is issue.&lt;/P&gt;
&lt;P&gt;I suggest you have the uart to transfer char repeatedly, then check if you can receive the char or check the waveform of the uart TX pin.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1725328786459.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/296704i3204DC3A26C60914/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1725328786459.png" alt="xiangjun_rong_0-1725328786459.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 02:00:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S28-some-USART-works-and-some-no/m-p/1945758#M56768</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2024-09-03T02:00:42Z</dc:date>
    </item>
  </channel>
</rss>

