cancel
Showing results for 
Search instead for 
Did you mean: 

UART Transmission and Reception between STM32 Nucleo-64 and Raspberry Pi 4

MTaj-.1
Associate II

Hello,

I am new to the ST developers community.

I have an large file (4 MB) that I need to divide it and transfer data chunks serially from Raspberry Pi to STM32 Nucleo-64 board including the STM32L073RZ MCU with a certain delay to allow the STM32 Nucleo-64 board, that interfaces with Semtech 2.4 GHz Radio board, to transmit data wirelessly utilising 2.4 GHz LoRa radio protocol which allows high data rate (up to roughly 2 Mbps).

First, I see that I can use either: 1) the USB to USB port on the STM32 Nucleo-64 board or, 2) the GPIO UART (i.e., USART TX and USART RX pins) to connect and interface the Raspberry Pi with STM32 Nucleo-64 board for data transmission and reception. Which one do you recommend for ease of configuration? I think I will need to apply an appropriate UART Clock Configuration in STM32 Nucleo-64 board including clock rate, etc.

Second, I am learning about using the STM32CubeMX software tool using the course in YouTube (https://www.youtube.com/watch?v=sQCqVBuq-gA&list=PLnMKNibPkDnGtuIl5v0CvC81Am7SKpj02&index=2) to setup the pinouts, clock configuration, UART setting. It seems in module 10, the course explains how to set up the UART.

Third. after I set the UART pins using STM32CubeMX and other pins, I can Generate Code and use the ST32Cube IDE (I am learning how to use it following the YouTube course: https://www.youtube.com/playlist?list=PLnMKNibPkDnFCosVVv98U5dCulE6T3Iy8) to set up the UART configuration settings and 2.4 GHz LoRa radio settings. Do you know any example on ST32Cube IDE that I can build upon utilising the ST32 Nucleo board to transmit and receive data through UART protocol?

To set up the radio settings, I will be utilising the code implementation

provided by Semtech: https://github.com/lorabasics/lorabasicsmodem

Lastly, I hope the workflow looks correct so that I can continue the work. 

Thank you,

Mohammed

3 REPLIES 3

The RPi header can take 3.3V UART signals directly, you'd need to connect the TX, RX, and GND

The RPi4 is perhaps a pain as the TTY is mapped to the Bluetooth by default and the pin header implements a soft-serial unless the thing is remapped, and the daemons killed.

The LoRa-DISCO board might be less cumbersome than the Nucleo. If the ST-LINK VCP/CDC is viable on the RPi that would provide another avenue for connectivity.

Perhaps use a serial protocol that provides for flow control and recovery, ie X-MODEM-1K and/or variants.

SLIP might be another.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Paul1
Lead

UART/USART:

  • Ensure both sides have crystals or oscillators. The internal oscillator may not prove stable enough over time/temperature, though its probably fine for bench tests.
  • Consider SPI for higher speed transfers (Mbps), or if one board doesn't have an accurate oscillator. SPI is synchronous with a clock signal allowing much faster speeds.
  • Distance: how far between the Pi and Nucleo? Inches = raw UART OK, but anything further (feet) then consider some drivers (RS-232, RS-422...)

Paul

If I will use UART/USART:

  • I will check if they have oscillators or crystals. I believe they have but will double check. I do not have much temperature variation.
  • Good suggestion but I need to have it working now even with low speed transfer. Because I need to receive chunks of data from file in the Necluo board and send them over 2.4 GHz LoRa radio board/protocol that is attached to the Necluo . It says the radio module an FSK modes that allow up to 2Mbits/s but I will try lower speeds for now.
  • Distance: is a few inches. So, UART wires will be fine.

Thanks Paul