Files
Pim van Pelt 4e539695f9
All checks were successful
continuous-integration/drone/push Build is passing
Add Monday, the Modbus-Failure-Day
2024-08-20 16:05:04 +02:00

5.2 KiB

title, date
title date
Week 4, Monday: Modbus Failure 2024-08-19T21:55:00+02:00

{{< image frame="true" width="17em" float="right" src="/img/headline/zascatv.png" alt="Credit: Zasca TV, Youtube" >}}

Geez I had some really bad luck today. So I bought what I thought was a perfectly normal modbus ammeter, and I have the 32 channel variant with external current transformers. The microcontroller boots and seems to blink an LED every 250ms or so as it's doing its measurements. The (chinese) manual says it's a simple modbus device approachable via RS485 and it shows what all the 16 bit registers are - relatively simple stuff.

Yesterday I spent the day designing the physical parts, and today I thought I'd give a go to the microcontroller firmware. I have written one of these before, but I seem to have ... misplaced the source code for it. Not to worry, I remember it was a matter of connecting the ESP32 to the modbus, and reading target address 1, and off to the races. Well, not today!

I have eight of these units, one for each PDU. I connected one, but it was not responding on any target address, and not with its default serial settings of 9600,8N1, nor with any other reasonable settings, nor on any other address. That's unfortunate.

So I spend, what I can best describe as increasingly frustrating hours of debugging. First with another ESP32, then with another RS485 unit, then by hotwiring the UART out of the RS485 converter on the DIN module, and finally, and I say this after it turned 17:00 already, I grabbed the scope and started taking a look at what was going over the modbus -- and I can clearly see the differential (yellow is high while blue is low), but the DIN module is absolutely silent. I also scoped the UART 3.3V, which is pulled to 2.8V by the board, but I can't see it saying anything there, either.

I connect the DIN module, via the hotwired GND, RX, TX, to my [Bus Pirate], which, by the way, is any hardware tinkerer's dream. It allows me to type simple commands in a terminal and talk to chips over 1-Wire, I2C, SPI, UART, and more. This, normally anyway, allows me to figure out how a chip works before writing a as much as one line of code. Neat! However, today, no dice. The DIN unit doesn't say -anything-, even when I send it a perfectly normal probe, described in its manual. 💩

My blood pressure was rising and at around 17:30, after I think 8 hours of messing around and not finding out, I decided to give up for now. I went to Aliexpress and ordered a few alternative RS485 dongles, including one for the PC itself, on USB, so that I can try to talk to the thing via my Linux computer, Summer. Today has been almost completely written off :(

KVM-over-IP

But there was one good thing, also! In the big bag'o'packages from yesterday, there was another device: a NanoKVM from [Sipeed]. This 40x40x40mm cube has a few USB connectors, a HDMI connector, and an RJ45 ethernet connector. It's meant to be a KVM-over-IP device, which can also emulate a USB CDROM, so that I can boot a specific ISO image that I uploaded to the little machine. It runs Linux and has an (open) SSH server. I poke around on it, create a 'pim' account, upload some SSH Keys, and close out password authentication. On IRC, my buddy Habbie mentions some security audit that was not overly optimistic about it - I take a look and conclude that it's probably safe to run in IPng Site Local.

The microcontroller boots up and gets an IPv4 address over DHCP, which it helpfully puts on a little OLED display. The web interface is snappy and immediately shows Summer's HDMI output at 1920x1080, which I find impressive. I think this will be a perfect companion for when I'm on the road and need an ersatz monitor.

Marina makes dinner tonight - it's my sister's recipe called Yolein-soep, which is a tomato soup made from concentrate and a white roux, with bacon bits, sjallots and rice. After the soup, she serves two nice Flammkuchen, also with bacon and onions. It hits the spot after such a frustrating day with RS485 and a non-working modbus. What am I doing wrong!?

I decide to not think about it for the rest of the day, and watch some TV instead. I also go to bed really early, at 22:00 I am already on one ear.

Pictures of the Day

{{< gallery-category >}} {{< gallery-photo fn="2024-08-19/IMG_0713.JPG" caption="The innards of the PDU are nicely placed in 3D printed parts." >}} {{< gallery-photo fn="2024-08-19/IMG_0716.JPG" caption="The Rigol oscilloscope cannot see a problem with the differential RS485 signal." >}} {{< gallery-photo fn="2024-08-19/IMG_0718.JPG" caption="I play around a little bit with the Sipeed NanoKVM" >}} {{< gallery-photo fn="2024-08-19/IMG_0719.JPG" caption="The Sipeed NanoKVM shows a 1920x1080p picture from my Linux PC, Summer" >}} {{< gallery-photo fn="2024-08-19/sipeed-kvm.png" caption="A screenshot of Summer's desktop as seen in a web browser, using Sipeed's NanoKVM over IP" >}} {{< gallery-photo fn="2024-08-19/IMG_0720.JPG" caption="We eat Flammkuchen tonight, courtesy of Marina" >}} {{< gallery-photo fn="2024-08-19/IMG_0721.JPG" caption="Leave your phone unattended, and there will be goofy pictures when you return..." >}} {{< /gallery-category >}}

{{< gallery-modal >}} {{< gallery-script >}}