Skip to main content
John Griswold
Senior
September 5, 2017
Question

four uarts on stm32L433?

  • September 5, 2017
  • 10 replies
  • 1771 views
Posted on September 05, 2017 at 22:05

Is it possible to get four USART/UART devices at once on the STM32L433 in a 64-pin package? I need one UART for input, one for output, one for external logging, and USART1 for debugging.

Is this doable? I've used CubeMX to try various configurations, and I end up short of the goal. I'll also need an ADC and a PWM or DAC, and DMA on at least the input device would be nice.

Suggestions?

    This topic has been closed for replies.

    10 replies

    Tesla DeLorean
    Guru
    September 5, 2017
    Posted on September 05, 2017 at 22:26

    Do they have different baud rates?

    Could you use the other half of the 'Input USART' for the debugger/telemetry output?

    Suggest you pull the Data Sheet 

    and a highlighter pen

    , print out the pin list and go over the 64-pin column down, and the across the USART lines.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    John Griswold
    Senior
    September 5, 2017
    Posted on September 05, 2017 at 22:51

    Not that simple. The 'input' side also sends commands. All ports run at the same baud rate (921600 - yeah, I know!)

    CubeMX shows that all of the pins are not conflicting, but I can only get one to work, apparently, in the mode where I have four UARTs going. Test case is pretty simple - I print a test string to each port at main() after initialization, then target one UART for input/output, and send characters to the L433 using TeraTerm. I can see the printed string, but not the keyed-in data, leading me to think that the input channels aren't working properly on all UARTs.

    Kind of baffling.
    Tesla DeLorean
    Guru
    September 6, 2017
    Posted on September 06, 2017 at 03:30

    If the pins map then it should work, whether CubeMX/HAL screws up from there who knows.

    Make a simple loop, polling the RXNE from each (LP)U(S)ART and echoing back the data.

    while(1)

    {

      uint16_t data;

      if (USARTX->ISR & USART_ISR_RXNE) // Data Pending

      {

       data = USARTX->RDR & 0xFF;

       if (USARTX->ISR & USART_ISR_TXE) // should be empty (balanced?)

         USARTX->TDR = data; // Echo back

      }

      // repeat for all UART/USART/LPUART

      // ....

    }
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..