1

I've been beating my head on the table for days trying to figure this out. For the life of me I cannot seem to get my Raspberry Pi 3 serial port to communicate with the Xbee Series 2.

I checked my /boot/cmdline.txt and there are no references to AMA0 in the file. Here is what is current in there:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblkOp2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

EDIT: PI 3 does not AMA0. It uses S0. I've removed entry console=serial0,115200

Since this is the Jessie update, there is no inittab. In which I've read that I need to do the following (which I've done):

sudo systemctl stop serial-getty@AMA0.service
sudo systemctl disable serial-getty@AMA0.service
sudo systemctl mask serial-getty@AMA0.service

After doing all of this, I open up cutecom, set it to 9600 baud rate, read/write, 8 bit data, 1 bit stop, and set the device to /dev/ttyAMA0.

When I hit connect and type:

+++

to enter the configuration mode I get:

write returned 0 errno: 11
write : Resource temporarily unavailable

I'm not sure what I'm doing wrong here... I know that the Xbee is functional because I'm able to configure it using XCTU software via a serial-to-USB breakout board. But on the Pi connected via the GPIO serial pins I get no response.

Any ideas?

The Xbee is hooked up to a Spark Fun Xbee Regulated Explorer


I'm also having issues doing this with my Raspberry Pi 2 (Which is where the Pi 3 will be communicating to). On the Pi 2, I've edited the cmdline.txt file and removed references to AMA0:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblkOp2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

And I've ran through the earlier mentioned systemctl commands on the Pi2.

Currently when I open a session using cutecom (S0 for Rpi3 AMA0 for Rpi2) I get no output. I type +++ in to the input line, I see the TX light blink on my Regulated Explorer but I get no output inside cutecom, nor any message in the terminal window.

techraf
  • 4,254
  • 10
  • 29
  • 41
Myg0t
  • 111
  • 10
  • Try removing that `console=serial0,115200` parameter from `cmdline.txt`. Although it isn't a reference to `AMA0`, it is pretty obviously a reference to a serial console, which could only be the one on the GPIOs. Make sure you leave that file as all one line! – goldilocks Apr 08 '16 at 19:46
  • Word. I'll try that and get back to you. – Myg0t Apr 08 '16 at 19:52
  • Your suggestion didn't quite fix the problem, but I believe it may be a step in the right direction. Seeing as how in Milliways comment: he noted that the Pi3 no longer uses AMA0, but uses S0 which apparently is what the console=serial0,115200 is referring to. – Myg0t Apr 09 '16 at 19:04
  • Right, so you want to use `ttyS0` w/ the Xbee instead as well then. – goldilocks Apr 09 '16 at 19:46
  • It still isn't working for me... When I use `sudo minicom -b 9600 -D /dev/ttyS0` I don't get anything. It shows the minicom welcome message showing the Options and such, but no status at the bottom of the terminal and I can't type anything. When I use cutecom with the same settings I don't get any output either (nothing in console saying its unavailable or anything). – Myg0t Apr 09 '16 at 19:49
  • When I type `+++` into the cutecom input line and hit `enter` I can see the TX light on my Xbee blink. So I know it's receiving something... – Myg0t Apr 09 '16 at 19:55
  • Serial is all about getting the baud rate and parameters right; I think Xbees are 8N1 but you are presumably onto that. I've noticed playing with different things that minicom will sometimes say "Offline" at the bottom no matter what even when communication is fine. Then there's a C API, lol... – goldilocks Apr 09 '16 at 20:02
  • Yes you are correct. The xbees are 8N1 with Baud rate of 9600. Both minicom and cutecom were configured to operate in that way. I don't understand why this is so difficult. I feel like it really should be easier. I may just have to resort to using a serial-to-USB breakout for the Bees, but I was hoping to get around that because of power draw off the USB... – Myg0t Apr 09 '16 at 20:05

1 Answers1

1

The Pi3 has swapped serial ports. /dev/ttyAMA0 is now used for Bluetooth. serial0 refers to the non-Bluetooth serial port which is on /dev/ttyS0 by default.

My experience if trying to use serial0 is not good. It works, but unreliably, although I have only tried using a serial to USB converter to a PC, and haven't tested extensively. From further reading the miniUART uses the "core clock" which can change with processor speed changes which may explain the problems. I have seen suggestions to fix the clock with:-

core_freq=250

EDIT I have since tried this and it seems to fix the problems. So far I can't see any downsides.

The miniUART is also limited - it only supports 8 data bits and has no parity as well as a smaller buffer.

If you don't use Bluetooth it is possible to swap the ports back in Device Tree. There is a pi3-miniuart-bt and pi3-disable-bt module.

EDIT I have now managed to get serial working to my satisfaction on Pi 3 and have documented this in How-do-i-make-serial-work-on-the-raspberry-pi3

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • Oh, I see... That is good to know. I imagine that is the reason I was never getting any response out of AMA0. Should I just disable serial0 then? – Myg0t Apr 09 '16 at 17:54
  • And would just do that by deleting the reference in cmdline.txt or would I also need to run similar systemctl commands? – Myg0t Apr 09 '16 at 18:03
  • @Myg0t on the Pi3 apparently you SHOULD use serial0 which is the non-BT UART. I have not tried this myself. – Milliways Apr 09 '16 at 22:52