GIAN2025
Hello, I installed the new version 4.1.0
on Arduino Uno, I compile and then go into debug mode.
It returns the error: MD5 verification failed: Failed to get MD5 hash after retries.
I tried reducing the serial speed.
I'm stuck, can someone help me?
thanks.
Reply 0 0
thiagoralves
I get the MD5 verification failed error when I try to use a Arduino Mega 2560. I have tried two different Megas. Both have the same issue.
 
When I tried an Arduino Uno R3 it worked fine.
 
I tried on both a Linux system and a Windows 11 system.
 
Both Megas work fine with the Arduino IDE.
Thanks for reporting! There is an open issue that is possibly related to this: https://github.com/Autonomy-Logic/openplc-editor/issues/440
 
We will bump the priority of this issue to get it fixed ASAP
Reply 0 0
thiagoralves
 
The issue was related to bootloader timing differences between the Uno and Mega (Uno bootloader waits 500ms where Mega bootloader waits 2000ms). The editor was sending the debugger requests too soon after board reset, causing the Mega to enter in bootloader mode. We will generate a new editor build soon that addresses this and other issues. Meanwhile, if you simply press the reset button on your Arduino Mega after starting the debugger it will take the board out of bootloader mode and the debugger will work. Once the new editor build is out this hack won't be necessary anymore.
Reply 2 0
PeBi
Hello,
To add to this:
The procedure for entering debug mode on the Arduino Mega by pressing the reset button works. However, the program is paused and stopped.
The live data is displayed, but it behaves strangely. Sometimes all inputs are displayed as “TRUE” and sometimes everything is displayed as “FALSE.”
Forcing variables does not work either.
After exiting debug mode, the program starts running again.
 
When debug mode is started, the program suddenly starts after about 2 minutes and is displayed correctly in Live.Debug mode. Forcing also works then.
 
When I load the same project on my Arduino Uno, everything works correctly.
 


Reply 0 0
thiagoralves
That’s probably the timing issue with the bootloader. If you press the reset button at the wrong time it may respond the MD5 but then fail later causing issues with the debugger. On the development branch with the fixes applied, the debugger works perfectly so far. I tested some projects on the mega and it worked just like the uno.
Reply 0 0
tommymorris
I got the Mega reset button work around working. I press the reset button right after I see "Requesting MD5 from target..." on the editor console. If I press it sooner it doesn't always work.  
 
Thanks!
Reply 0 0
thiagoralves
Just FYI the latest official build for v4.1.1 with all accumulated bug fixes (including this one about the Mega bootloader on debugger) is out. You can get it from the Autonomy website
Reply 0 0
mrea
Hi @thiagoralves I'm having the same error using an ESP32-S3 using the native USB port

The program uploads fine to the ESP32, I have tried different serial speeds etc

I have also tried the reset button at different times etc

 
[7:58:49 PM]: Writing at 0x00118110 [==============================] 100.0% 658041/658041 bytes...
[7:58:51 PM]: Wrote 1081616 bytes (658041 compressed) at 0x00010000 in 9.7 seconds (890.6 kbit/s).
[7:58:51 PM]: Hash of data verified.
[7:58:51 PM]: Hard resetting via RTS pin...
[7:58:52 PM]: New upload port: /dev/ttyACM0 (serial)
[7:58:52 PM]: -------------------------------------------------------------------------------------------------------------
[7:59:00 PM]: Using Modbus RTU: Port=/dev/ttyACM0, Baud=115200, SlaveID=1
[7:59:00 PM]: Starting debug compilation...
[7:59:00 PM]: Found C/C++ POU: "MODBEE_CONFIG" (function-block)
[7:59:00 PM]: Found C/C++ POU: "MODBEE_INPUTS" (function-block)
[7:59:00 PM]: Found C/C++ POU: "MODBEE_OUTPUTS" (function-block)
[7:59:00 PM]: Processing 3 C/C++ POU(s)...
[7:59:00 PM]: Successfully processed 3 C/C++ POU(s)
[7:59:00 PM]: Starting debug compilation process...
[7:59:00 PM]: Compiling for debugger - project: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test, board: ESP32-S3
[7:59:00 PM]: IEC2C available at version 0.1
[7:59:00 PM]: Directories for compilation source files created.
[7:59:01 PM]: Generated XML from JSON at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src
[7:59:01 PM]: Compiling file /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src/plc.xml
[7:59:01 PM]: Collecting data types
[7:59:01 PM]: Collecting POUs
[7:59:01 PM]: Generate POU MODBEE_CONFIG
[7:59:01 PM]: Generate POU MODBEE_INPUTS
[7:59:01 PM]: Generate POU MODBEE_OUTPUTS
[7:59:01 PM]: Generate POU main
[7:59:01 PM]: [["[('start', ('P::main', 'contact', 2575801, 'reference'))]", "[('run', ('P::main', 'contact', 4916078, 'reference'))]"]]
[7:59:01 PM]: Generate Config(s)
[7:59:01 PM]: Stage 1 compilation finished successfully
[7:59:01 PM]: Saving ST file...
[7:59:01 PM]: Parsing complex variables...
[7:59:01 PM]: ST file generated at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src/ program.st
[7:59:01 PM]: Static files copied successfully.
[7:59:01 PM]: POUS.c
[7:59:01 PM]: POUS.h
[7:59:01 PM]: LOCATED_VARIABLES.h
[7:59:01 PM]: VARIABLES.csv
[7:59:01 PM]: Config0.c
[7:59:01 PM]: Config0.h
[7:59:01 PM]: Res0.c
[7:59:01 PM]: C files generated at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src/
[7:59:01 PM]: Debug files generated at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src
[7:59:02 PM]: Generating glue variables...
[7:59:02 PM]: Glue variables saved to /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src/glueVars.c
[7:59:02 PM]: Glue vars generated at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src
[7:59:02 PM]: C blocks header file populated at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/src/c_blocks.h
[7:59:02 PM]: C blocks code file populated at: /home/matthew/Documents/MR Electrical & Automation/OpenPLC/Projects/Modbee-Test/build/ESP32-S3/examples/Baremetal/c_blocks_code.cpp
[7:59:02 PM]: Debug compilation completed successfully.
[7:59:02 PM]: -------------------------------------------------------------------------------------------------------------
[7:59:02 PM]: Extracting MD5 from compiled program...
[7:59:02 PM]: Program MD5: 759a854f22e5bc21595efbd74947e43b
[7:59:02 PM]: Requesting MD5 from target at /dev/ttyACM0...
[7:59:26 PM]: MD5 verification failed: Failed to get MD5 hash after retries

 
I'm using latest v4.1.1 and Host system is Ubuntu 25.10 using AppImage

[203128%2F9648987%2Fmceclip0]

[203128%2F9648989%2Fmceclip0]
Reply 0 0
thiagoralves
This could be a bug specific to the runtime on a ESP32-S3. It works fine on my generic ESP32. Since I don’t have this board it is hard to debug and check. Have you tried debugging over WiFi?
Reply 0 0
mrea
@thiagoralves wifi debugging is working fine. I have also tried serial with blank project, none of my C++ arduino function blocks and still fails. I can't use WIFI as my library runs a webserver with AP and webui on the ESP32, so using serial for debugging is needed.

Is there anything else I can debug further? More detailed logs? Could it being an program size issue and times out before getting all data from esp32?
Reply 0 0
thiagoralves
Since the debugger works with other boards, I would not suspect the issue is in the debugger code or on the editor, but on the runtime, specifically on the way the runtime access serial ports. We use the Arduino API as an abstraction layer for everything, so that the code can be the same for all platforms. For the debugger, we use the Arduino serial port abstraction with serial.begin(), serial.write(), etc. It could be possible that the ESP32-S3 requires a different implementation (i.e. Arduino Serial class is broken on ESP32-S3), or that it requires a specific call before using the Serial API, or something along those lines.
Reply 0 0
mrea
@thiagoralves I can confirm the standard Serial.begin and write work just fine, I can use CuteCom serial terminal to do standard serial comms via the standard Arduino API and calls. Would you know the exact modbus frame in HEX to request the MD5? This way I can send it directly across the Serial Port and see what the response is. I know the /dev/ttyACM0 serial port is working fine when I do a basic arduino sketch to test the serial port.
Reply 0 0
thiagoralves
The easiest way would be to use a modbus tool like Modbus Poll to query the device and check if it responds at all. I'm almost certain it is not responding, or not responding correctly. The debugger uses Modbus (including to check MD5), so if Modbus is working, you're 99% done.
Reply 0 0
mrea
@thiagoralves which FC Codes and registers should I poll? I noticed in my serial test in platformIO it has build flags for USB

build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1

Is there ways to set the Arduino build flags?

It looks in the Arduino IDE the default USB Mode: is Hardware CDC and JTAG and in with my flags for USB Mode 1 it sets it to USB-OTG ( TinyUSB )

I feel this may be the issue is the wrong USB Mode being set
Reply 0 0
thiagoralves
which FC Codes and registers should I poll?
 
OpenPLC Runtime supports all main FC codes. Even if you don’t have any variable configured on your PLC project, you will get a response, either with all zeros, an error, or an invalid FC. If you’re not getting anything most likely the interface is not being initialized at all or the code has crashed (PLC is not running on the board).

Your hint about build flags might be it. Check the hals.json file. You can set flags there. Another way to test is to include a C/C++ function block and do a simple Serial.print from it.
Reply 0 0
mrea
@thiagoralves I can't access the hals.json since I'm using the AppImage in Linux... Unless the file is saved somewhere? It's not in any directory in home. I have found it in the Github repo, how do I define the build flag in the JSON?

"ESP32-S3": {
"board_manager_url": "https://espressif.github.io/arduino-esp32/package_esp32_index.json",
"compiler": "arduino-cli",
"core": "esp32:esp32",
"c_flags": ["-MMD", "-c", "-Wno-incompatible-pointer-types"],
"cxx_flags": ["-MMD", "-c"],
"default_ain": "1, 2, 3, 4",
"default_aout": "36, 37",
"default_din": "6, 7, 8, 9",
"default_dout": "34, 35",
"define": "BOARD_ESP32",
"extra_libraries": [],
"platform": "esp32:esp32:esp32s3",
"preview": "esp32.png",
"source": "esp32.cpp",
"specs": {
"CPU": "ESP32-S3",
"RAM": "512 KB",
"Flash": "4 MB",
"Digital Pins": "34",
"Analog Pins": "18",
"PWM Pins": "16",
"WiFi": "Yes",
"Bluetooth": "Yes",
"Ethernet": "No"
}
},
 
I feel it would be great to have a way from the editor in the device configuration and have an advanced otions tab which opens the JSON and allows direct edit of the board and a way to add your own custom board?

I will see if I can try extract the appImage and change directly
Reply 0 0
Reply