Reading data from serial

Using a Pi 3B+ with a RF module fitted to receive energy data, which has worked (and still works) for a number of years, but I'm in the process of rebuilding a new server from scratch using Bullseye, instead of Stretch.
I'm using a second SD card, so I can switch between both whilst the new server is being slowly developed!

However, I'm not receiving any data in /dev/ttyAMA0 despite making the same changes I've made to the old system;

Which was adding;

[all]
dtoverlay=pi3-disable-bt
enable_uart=1

to /boot/firmware/config.txt

and disabled bluetooth from using the UART - sudo systemctl disable hciuart
Rebooted, and no data appears

serial

At this stage I retried the old system, by swopping the SD card, and data flowed as usual, so the Pi & RF module are working OK.

Back to the new system... I've tried;

Run raspi-config > Interface Options > Serial Port enable disable, and have;

Also tried;

pi@newserver:~ $ ls /dev/tty*
/dev/tty    /dev/tty17  /dev/tty26  /dev/tty35  /dev/tty44  /dev/tty53  /dev/tty62
/dev/tty0   /dev/tty18  /dev/tty27  /dev/tty36  /dev/tty45  /dev/tty54  /dev/tty63
/dev/tty1   /dev/tty19  /dev/tty28  /dev/tty37  /dev/tty46  /dev/tty55  /dev/tty7
/dev/tty10  /dev/tty2   /dev/tty29  /dev/tty38  /dev/tty47  /dev/tty56  /dev/tty8
/dev/tty11  /dev/tty20  /dev/tty3   /dev/tty39  /dev/tty48  /dev/tty57  /dev/tty9
/dev/tty12  /dev/tty21  /dev/tty30  /dev/tty4   /dev/tty49  /dev/tty58  /dev/ttyAMA0
/dev/tty13  /dev/tty22  /dev/tty31  /dev/tty40  /dev/tty5   /dev/tty59  /dev/ttyprintk
/dev/tty14  /dev/tty23  /dev/tty32  /dev/tty41  /dev/tty50  /dev/tty6   /dev/ttyS0
/dev/tty15  /dev/tty24  /dev/tty33  /dev/tty42  /dev/tty51  /dev/tty60
/dev/tty16  /dev/tty25  /dev/tty34  /dev/tty43  /dev/tty52  /dev/tty61
pi@newserver:~ $

and /dev/ttyAMA0 exists.

I've installed Minicom and checked - sudo minicom -D /dev/ttyAMA0 -b38400 but again no data appears. (and yes data is being transmitted)

It's important that I get this working, so would appreciate any advice.

So going from Stretch to Bullseye the comms have stopped.

With what you have described it would seem it is an O/S problem.

I'd check the RasPi forums and see if you can get help there.

Sorry, a bit lame, but that's how I see the problem.

Hi Paul,

anything being printed via cat /dev/ttyAMA0
I can do this to watch my Zwave RF module do magic.

I'm not a pro here by any means, but I would check to see if data is actually being received, I think cat will reveal that?

No, nothing at all :unamused:

What does this command give?
ls /dev/serial/by-id/

A bit daring - but could you create an echo loop on the GPIO's - to see if rx,tx is working?

(Disclaimer: again im no pro :sweat_smile:)

paul@myserver:~ $ ls /dev/serial/by-id/
ls: cannot access '/dev/serial/by-id/': No such file or directory

Ah, that will be because you are using the built in uart, not a plugin one. Sorry, I don't know how to use that in Bullseye. They must have changed something in Bullseye.

Any magic with adding this in your config?

core_freq=250

Im seeing a lot of threads doing that, to get UART working - strange that there is no issue under stretch however

I'm going to back up the SD card first (just in case it breaks things!!)

feel free to take me off your xmas card list if it goes bang! :grimacing:

See: https://forums.raspberrypi.com/viewtopic.php?t=213499

I'm afraid not, just the same.

Whilst awaiting for the SD card to create an image on my laptop, I put my original 'Stretch' SD card in the same pi, and tried cat /dev/ttyAMA0 and which returned the expected result, spitting data out of the Serial In node.

So no further forward...

Mmmm...

Sorry, not sure what else to try - I'm not educated enough in a lot of this. :slightly_frowning_face:

1 Like

Some forums talk about dtoverlay=disable-bt instead of dtoverlay=pi3-disable-bt

The other thing is that you have in raspi-config The serial login shell is enabled , my experience is that this keeps the serial occupied (sometimes).This was not with Buster, but you can give it a try.

Just my 2 cents

No change

I've disabled it now and no change, but thanks for trying.

Looks like a lot of good info here Configuring The GPIO Serial Port On Raspbian Jessie and Stretch Including Pi 3 and 4 - Spell Foundry
Including trying ttyS0

1 Like

@dceejay I tried what was suggested in the write up but didn't make much progress, however... in the comments below the article, someone mentioned that a script had been written to auto configure the UART so I gave it a try, and I'm now back working :smiley:

I had also previously added these lines to the /boot/firmware/config.txt

[all]
dtoverlay=pi3-disable-bt
enable_uart=1

and they also have to remain in place.

Thanks for the help.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.