Hi All
Sorry I’ve been so quiet for such a long time, health problems,
I’ve been debugging an issue after a fresh upgrade to emonSD Feb2024 on emonpi1.
Symtom: emonhub would stop receiving data from serial / RF seemingly randomly, daily. I would also see random inputs appear and in some cases nodeid 5 data would appear as another nodeid altogether.
Many days of debugging emonhub and atmega firmware, finally culminating in logging every character sent and received on serial and I discovered this in /boot/firmware/cmdline.txt:
cat /boot/firmware/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=567d5380-02 rootfstype=ext4 fsck.repair=yes rootwait
As you can see, serial0 has the kernel using it as a console, causing spurious data to be sent to the RFM module (in this case, randomly changing config including nodeid to spurious values and occasionally datalogging interval to a very low value).
You can imagine the debugging this took to find the problem.
For reference cmdline.txt on older emonsd (2021, debian_version 10.13) looks like this:
console=tty1 root=PARTUUID=41d38177-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
This will be more prevalent on firmware that uses CM/emonlib due to the fact the first serial character is interpreted as a command (as opposed to reverse polish in jeelib based DS format firmwares).
[EDIT]
The easiest way to fix it is to run sudo raspi-config
Choose:
Option 3 Interface Options,
then Option 5 Serial Port
Answer No to ‘Login Shell Available over serial’
Answer Yes to ‘Serial Port Hardware enabled’
Then, as raspi-config suggests, reboot.
Or, edit /boot/firmware/cmdline.txt with your favourite editor and remove the console=serial0,115200
part. Reboot.