Retrofitting 1983 Shizuoka AN-SB CNC milling machine, Bridgeport mill, Colchester Bantam lathe and 1982 Tree UP-1000 CNC lathe with modern controls - and other workshop stuff
Before completely giving up on the Arduino IDE, I got one of the Saleae clone logic analysers. These use an Altera Cyclone FPGA to capture up to 16 channels of digital inputs, then send the data to a Cypress FX2 microcontroller and thence over USB to your PC. From there, there's some rather powerful open source software for processing, displaying and decoding the data. Many different protocols are supported, not least Modbus of course.
Here's what you get on a scope. Very interesting - but you can't tell what is and isn't being sent over the bus. For instance, is it missing any critical bits? Does the CRC check agree. What are we looking at?
You can watch the bus using a tool like qModMaster or Hercules but they won't tell you much if the message is corrupted or missing.
This is where these cheap logic analaysers come in. Mine's from Kingst and https://qdkingst.com/en
Last time I used the ESP32-S3-POE-ETH-8DI-8DO module, it was happy to talk to the Bojke laser sensor. But can I get the ESP32-S3 Mini to talk to it? Can I f*ck.
Claude Code got its knickers in a good old twist trying to figure it out but finally I lost the will to live.
And here's the proof that when I used a USB-RS485 dongle to sniff the traffic, it was working fine:
...using these port settings:
So there's nothing wrong with the Bojke sensor. The Stupid Fat Bloke hasn't been messing about with it behind my back and blown it up.
To get up to speed with Modbus, here's a handy little intro video:
I was starting to get the feeling there was something going on here that nobody told me about. But with some digging, I found this vid discussing why Modbus doesn't work with ESP32:
Bottom line is, Arduino is a sort of Noddy / Newbie IDE for developing code to program the Arduino family and as such it is a fairly high level, cut down version of C++, where many of the functions are actually hidden from the user, to keep life "simple"(!!). Furthermore, although the ESP32 has a lot of support within the Arduino IDE, it's pushing the capabilities of some of the functions that were never intended to be used beyond the actual Arduino family. One of those might be the support for implementing RS485.
So using the Arduino IDE to program an ESP32 to use RS485 may be a bit of an oxymoron - and nobody's going to act surprised or run to help you if you run into problems. The grownups will be using "proper" IDEs such as the dedicated ESP-IDF that Espressif have developed specifically to ..... program the ESP32 family. Oh well, time to "put my big boy pants on" and move on from this time consuming fiasco....