EmonBase with RPi B1+ - no serial data

Hey there,

I bought an Emon Base with an Arduino TX Shield and an GLCD a few weeks back and got it to work so far.
The TX Shield sends data (yellow led blinking). I flashed the Shield_CT1234_Voltage FW (https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTxShield/Shield_CT1234_Voltage). I am using the RFM69CW module (which came with the kit), all jumpers on the shield are set correctly (left one on the very left for jeelib digit 10, right one on the very right for UNO).
The tx shield also gives valid readings in W and V over the direct serial connection, so an error on the tx shield side is very unlikely.

The emon base on a RPi B1+ also receives the data (red led flashing simultaneously to the yellow light of the shield), but no matter what I do, I can not connect to the serial communications on ttyAMA0 (but the path is there). Of course I stopped emonhub (sudo service emonhub stop) before trying to access ttyAMA0.

I am using the newest Version of the EmonPi Image, have looked through all config files I could find and checked if node and network id are ok (the TX Shield is on node 6, the emonpi on node5, all in network group 210… Just as is in the arduino sketches). The decoder in emonhub.conf also looks fine.

I also tried disabling the RPi internal Serial communication (again), but it was all disabled by default already.

Where did I forget to look or what could be the cause of the problem?

(To my person: I’m almost 30 and have 4 RPis running in my home ATM. I’m quite good with linux bash and expert in FFF 3D Printing. Hence flashing and modifying arduino FW should not be an issue)

-Julian

Can you post some emonhub.log, preferably following a restart of emonhub so we can see any failed attempts to create the RFM2Pi interfacer.

Can you confirm how you might of done this? there is/was a bug in raspi-config that would render the uart completely disabled when only trying to disable the serial console to free up the serial port for another use.

If you have disabled the serial console via raspi-config you may now have an additional “enable_uart = 0” entry in /boot/config.txt, if you do try deleting that line and rebooting.

Sorry for the late reply. I haven’t had any oppertunity to fire it back up.

Here are some cat/logs:
/boot/cmdline.txt

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

cat /boot/config.txt | grep uart gives no results. So I guess there is no “disable uart” in the config.txt… but I will write a enable_uart = 1 in there and restart once the “apt-get update” is over.

Here is the logfile, after that it just broadcasts time every 30 minutes (This is the interval I set in /home/pi/data/emonhub.conf under “interval to transmit time to emonGLCD”):

2017-01-23 19:17:24,041 INFO     MainThread EmonHub emonHub 'emon-pi' variant v1.2
2017-01-23 19:17:24,044 INFO     MainThread Opening hub...
2017-01-23 19:17:24,047 INFO     MainThread Logging level set to DEBUG
2017-01-23 19:17:24,070 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi' 
2017-01-23 19:17:24,100 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2017-01-23 19:17:26,106 WARNING  MainThread Device communication error - check settings
2017-01-23 19:17:26,108 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2017-01-23 19:17:27,119 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2017-01-23 19:17:28,127 INFO     MainThread Setting RFM2Pi quiet: 0 (0q)
2017-01-23 19:17:29,131 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2017-01-23 19:17:30,135 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2017-01-23 19:17:31,140 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2017-01-23 19:17:31,143 DEBUG    MainThread Interfacer: Subscribed to channel' : ToRFM12
2017-01-23 19:17:31,152 DEBUG    MainThread Setting RFM2Pi interval: 1800
2017-01-23 19:17:31,155 DEBUG    MainThread Interfacer: Subscribed to channel' : ToRFM12
2017-01-23 19:17:31,157 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2017-01-23 19:17:31,220 DEBUG    MainThread Interfacer: Subscribed to channel' : ToRFM12
2017-01-23 19:17:31,241 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT' 
2017-01-23 19:17:31,245 INFO     MainThread MQTT Init mqtt_host=127.0.0.1 mqtt_port=1883 mqtt_user=emonpi
2017-01-23 19:17:31,303 DEBUG    MainThread MQTT Subscribed to channel' : ToEmonCMS
2017-01-23 19:17:31,350 DEBUG    RFM2Pi     RFM2Pi broadcasting time: 19:17
2017-01-23 19:17:31,380 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg' 
2017-01-23 19:17:31,386 DEBUG    MainThread emoncmsorg Subscribed to channel' : ToEmonCMS
2017-01-23 19:17:31,483 INFO     MQTT       Connecting to MQTT Server
2017-01-23 19:17:31,588 INFO     MQTT       Could not connect...
2017-01-23 19:17:32,777 INFO     MQTT       Connecting to MQTT Server
2017-01-23 19:17:32,871 INFO     MQTT       Could not connect...
2017-01-23 19:17:33,989 INFO     MQTT       Connecting to MQTT Server
2017-01-23 19:17:34,007 INFO     MQTT       Could not connect...
2017-01-23 19:17:35,186 INFO     MQTT       Connecting to MQTT Server
2017-01-23 19:17:35,250 INFO     MQTT       Could not connect...
2017-01-24 19:28:17,504 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:17,561 INFO     MQTT       Could not connect...
2017-01-24 19:28:18,703 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:18,767 INFO     MQTT       Could not connect...
2017-01-24 19:28:19,891 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:19,910 INFO     MQTT       Could not connect...
2017-01-24 19:28:21,044 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:21,051 INFO     MQTT       Could not connect...
2017-01-24 19:28:22,162 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:22,251 INFO     MQTT       Could not connect...
2017-01-24 19:28:23,360 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:23,411 INFO     MQTT       Could not connect...
2017-01-24 19:28:24,549 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:24,556 INFO     MQTT       Could not connect...
2017-01-24 19:28:25,689 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:25,701 INFO     MQTT       Could not connect...
2017-01-24 19:28:26,845 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:26,934 INFO     MQTT       Could not connect...
2017-01-24 19:28:28,061 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:28,137 INFO     MQTT       Could not connect...
2017-01-24 19:28:29,287 INFO     MQTT       Connecting to MQTT Server
2017-01-24 19:28:29,316 INFO     MQTT       connection status: Connection successful
2017-01-24 19:28:29,320 DEBUG    MQTT       CONACK => Return code: 0
2017-01-24 19:28:29,617 INFO     MQTT       on_subscribe

What response does

ls -la /dev/{tty{AMA,S,USB},serial}*

give you?

Have you tried using a serial console like minicom?

Just to confirm I understand correctly, you have recently purchased a RFM69Pi and have that attached to a Pi3 running the emonSD. You are not connecting to the shield directly via serial, is that right?

yes you understand correctly, however the board is connected to a Pi 1 B+ (the one with the single core processor, but 512MB ram and 4 USB ports). Since the Raspbian Distribution is compatible with all RPi boards at once there shouldn’t be a problem…
The purchase was made in mid/end december 2016.

RF seems to work (red led flashes simultaneously with the arduino tx shield’s yellow led), chip FW seems to be fine… I just don’t get any serial communication.
If I put the shield directly in via Serial I can monitor the values with some alterations to the emonhub.conf (if found here in the forum somewhere, basically just enabling a “serial listener” instead of the wireless thing). But I really need the RF working for my EmonGLCD (and therefore I would also use it directly for the logging as well)

I also tried connecting to it via minicom, as said in my first post… no results, with both baud rates (9600 and 38400)

the ls command gives:
ls: cannot access /dev/ttyS*: No such file or directory
ls: cannot access /dev/ttyUSB*: No such file or directory
ls: cannot access /dev/serial*: No such file or directory
crw-rw---- 1 root dialout 204, 64 Jan 24 20:52 /dev/ttyAMA0

the pi user is also in the dailout group, so should be able to read and write ^^

\edit:
I just hooked the RFM69Pi up to my computer with a FTDI USB-Serial Chip and 3.3V logic. I can interface the chip with this without any problems…
image attached:

\edit2: grabbed a RPi3 I had as server and used this… Works as described… so the culprit seems the RPi B+ here. I’ll look into the GPIO Pins and try to figure out what the problem is

You could try linking the GPIO uart RX and TX pins together, when using a serial console like minicom, everything written to the serial port should be echoed back into the console.

If you suspect it maybe a uart mapping issue, things have become a little more complex since the Pi3 introduced BT and on board WiFi, you could try a vanilla Raspbian image, with just the /boot/cmdline.txt edited to remove the "console=ttyAMA0,115200 " prior to fitting the RFM69Pi and booting the Pi B+ should be all the setup required. other than installing something to test eg minicom.

I messed almost 10 hours now.
TxD and RxD are connected but I can’t get the serial to talk…

Since this is not a EmonHub Problem I created the corresponding topic on the rpi forums:
https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=172958&p=1106108#p1106108

Once the error is resolved I will perhaps push some fixes back to emonsd over github to make emonsd hardware backwards compatible. On RPi3 it’s running like charme out of the box, but I don’t wanna waste my “high cpu power” Pi3 on this while I got 3 RPi B+'s in the corner catching dust.

Discussion continues on the RPi Forum. Solution will be posted here.

How many have you tried? Is it possible the GPIO UART lines have been damaged? I have a 2B here that has no TX output and there the same was seen on this EmonTx not updating emonPi.thread on a Pi3.

Another test you could do is to load a 100% stock Raspbian image and use your USB programmer, 3 link wires and putty to view the serial console in putty, you should be able to run commands direct from putty over the GPIO UART as intended on a stock Raspbian image. If you can see the boot log and reach a command prompt but cannot run a command, the RX line of the Pi has a physical fault.