Electronic – arduino – UART between STM32F4 and an Arduino Uno

arduinomicrocontrollerstm32stm32f4-discoveryuart

I am able to successfully send strings and numbers between two STM32F407VG Discovery boards and between two Arduino Uno boards but I am unable to do it between an STM32F4 and an Arduino Uno.

Here is what I did:

  • Arduino Uno RX –> PA2
  • Arduino Uno TX –> PA3
  • A pin from the STM32F4 ground to the arduino ground.

I use the default configuration 9600 baudrate, 8 bit data size, 1 stop bit and no parity. Output type of the gpios on the stm32f4 is push pull and they are pulled up.

Is there something I am missing?

Best Answer

Probably the logic levels of the UARTs of the two MCUs are not compatible, since they are powered with different voltage levels.

As the the STM32F405 datasheet says, that MCU has a supply voltage range of 1.8V...3.6V, whereas the Arduino UNO board powers its MCU (ATmega 328P) at 5V.

As Bence Kaulics confirms in its comment, your F4 discovery board powers its MCU at 3V, so a logic high on its TX line cannot be higher than 3V, which is the exact minimum input voltage required for a logic high for an ATmega328P powered at 5V (VIH=0.6Vcc=0.6*5V=3V – see datasheetat p.313):

enter image description here

So you need a level shifter between the two boards on the TX line of your discovery board and, possibly, also on its RX line (but this latter could be not necessary, because the STM32 MCU has 5V-tolerant inputs).

Something like this level shifter may work for you:

enter image description here