Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

Feather M0 LoRa module TX/RX UART connection to Raspberry Pi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather M0 LoRa module TX/RX UART connection to Raspberry Pi

by CluelessRic on Tue Nov 30, 2021 9:46 pm

I want to display sensor data on A LED matrix connected to a Adafruit RGB Matrix Bonnet & Pi Zero. The Pi is supposed to receive the data from an https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module/pinouts but this not happening, and I would be grateful if someone can tell me how to fix this problem.

My wiring between the Feather & Pi are detailed in the attached image
Feather-Pi wiring.jpg
Feather-Pi wiring
Feather-Pi wiring.jpg (666.46 KiB) Viewed 129 times
.

To test the connection I am running the following code on the Feather:

// https://roboticsbackend.com/raspberry-p ... unication/

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("Hello from Arduino!");
delay(1000);
}


The Feather terminal window shows the following which is encouraging:
12:28:36.080 -> Hello from Arduino!
12:28:37.064 -> Hello from Arduino!
12:28:38.053 -> Hello from Arduino!

I am running the following test code on the Pi Zero:

# https://roboticsbackend.com/raspberry-p ... unication/

#!/usr/bin/env python3
import serial

if __name__ == '__main__':
ser = serial.Serial('/dev/serial0', 9600, timeout=3)
ser.reset_input_buffer()

while True:
if ser.in_waiting > 0:
line = ser.readline().decode('utf-8').rstrip()
print(line)


I am currently get no errors but no results from the Pi, when viewed on Thonny.
If I comment out "if ser.in_waiting > 0:", then the Thonny (Shell) output scrolls down with blank lines.
I have tried changing serial0 to serial1 with no better results.
Typing "ls -l /dev" on the Pi terminal includes the following rows in the output:
lrwxrwxrwx 1 root root 7 Dec 1 12:17 serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Dec 1 12:17 serial1 -> ttyS0

Can you please tell me why the Pi is not receiving the test message from the Feather?

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by CluelessRic on Wed Dec 01, 2021 6:07 pm

It seems the problem is with the Feather M0, because I replaced it with a Sparkfun ESP8266 Thing Dev board, using the same wiring as above. Using the same Arduino sender code as above, the "Hello from Arduino" message is received on the Pi per attached screenshot.
Unfortunately the ESP8266 does not have the required transmission range for my project, so I still need to find out why the Feather won't connect to the Pi.
Any ideas how to get the Feather to send to the Pi?

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by franklin97355 on Wed Dec 01, 2021 6:19 pm


franklin97355
 
Posts: 22411
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by CluelessRic on Wed Dec 01, 2021 6:51 pm

This screen shot shows the Pi receiving a message from an ESP board; but it won't receive from the Feather board using same wiring and code!
Attachments
Thonny for ESP to Pi code.png
Thonny screen for ESP to Pi
Thonny for ESP to Pi code.png (367.73 KiB) Viewed 107 times

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by CluelessRic on Wed Dec 01, 2021 7:05 pm

Franklin, your link to a similar post seems to focus on logic level conversion, but in my case both the Feather and Pi boards use 3.3V logic?

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by adafruit_support_carter on Wed Dec 01, 2021 7:50 pm

The TX/RX pins on the Feather are accessed via Serial1:
https://learn.adafruit.com/adafruit-fea ... -2825153-9

adafruit_support_carter
 
Posts: 22237
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by CluelessRic on Wed Dec 01, 2021 9:04 pm

Hi Carter, as mentioned in my original post, I have already tried using the line "ser = serial.Serial('/dev/serial1', 9600, timeout=3)" in the Pi code, without success.
What else should I be doing to use Serial1?

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by dastels on Wed Dec 01, 2021 9:11 pm

Use Serial1 instead of Serial in the Feather code. Serial is the USB/Serial connection.

Dave

dastels
 
Posts: 8389
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by CluelessRic on Wed Dec 01, 2021 9:32 pm

Thanks for the advise Dave.
When I use "Serial1.begin(9600);" in the Feather code above, the Feather sends messages, but the Pi still receives nothing.
When I then also use "Serial1.println("Hello from Arduino!");" in the Feather code, the Feather does not send messages, and obviously the Pi receives nothing.
Should I do something else?

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by adafruit_support_carter on Wed Dec 01, 2021 10:21 pm

You will not see anything in the Serial Monitor if you only print to Serial1. Try printing to both Serial (for debugging) and Serial1 (for talking to Pi) in your Arduino sketch.

EDIT - you may also need to "enable" serial on the Pi. You can do that via rpi-config or by direct text file editing:
https://learn.adafruit.com/raspberry-pi ... 2827368-10

adafruit_support_carter
 
Posts: 22237
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather M0 LoRa module TX/RX UART connection to Raspberr

by CluelessRic on Wed Dec 01, 2021 11:59 pm

Hi Carter, I changed the Feather code to include both lines : Serial.println("Hello from Arduino!"); and Serial1.println("Hello from Arduino!"); .
Mt boot/config.txt file already included an uncommented line: enable_uart=1
Only when I changed the Pi code from serial1 to serial0 ie the code line: ser = serial.Serial('/dev/serial0', 9600, timeout=3) , did the messages finally start appearing in Thonny!
The messages also appear in the Pi's Terminal screen when I run the file.
Thanks for solving my problem!
I will now move to the next stage of this project; sending temperature data from the Feather to the Pi/display hat for LED matrix display purposes.

CluelessRic
 
Posts: 16
Joined: Thu Feb 11, 2021 4:27 am

Please be positive and constructive with your questions and comments.