PeBi
Hello,
I am experiencing the following issue when downloading to a Raspberry Pi from the OpenPLC editor:
I am able to connect to the Raspberry Pi. (Status is displayed as “Connected” “PLC: Stopped”)

When I initiate a download from OpenPLC, an error message is displayed at the end:
 
[10:41:22]: Upload failed: {“error”:“‘utf-8’ codec can't decode byte 0x87 in position 12: invalid start byte”}
[10:41:22]: Failed to upload to runtime: Upload failed with status 500
 
However, the program can be loaded and started manually via the OpenPLC web server.
When I then start debug mode in the OpenPLC editor, the program can also be monitored online.
 
 
When I change the character set on the Raspberry Pi from “UTF-8” to “ISO-8859-1,” the following happens when I try to download
[203128%2F9597971%2Fmceclip0]
 
[18:17:21]: C files generated at: C:\Users\P\Documents\OPENPLC_4\406_RP\build\Raspberry Pi\src\
[18:17:23]: Debug files generated at: C:\Users\P\Documents\OPENPLC_4\406_RP\build\Raspberry Pi\src
[18:17:23]: Extracted MD5 hash from program.st: c4e01ca36ded4b619178defba14cbf0a
[18:17:24]: Generating glue variables...
[18:17:24]: Glue variables saved to C:\Users\P\Documents\OPENPLC_4\406_RP\build\Raspberry Pi\src\glueVars.c
[18:17:25]: Glue vars generated at: C:\Users\P\Documents\OPENPLC_4\406_RP\build\Raspberry Pi\src
[18:17:25]: No C/C++ blocks found, skipping c_blocks.h generation
[18:17:25]: No C/C++ blocks found, skipping c_blocks_code.cpp generation
[18:17:25]: OpenPLC runtime detected.
[18:17:25]: Source files generated successfully at: C:\Users\P\Documents\OPENPLC_4\406_RP\build\Raspberry Pi\src
[18:17:25]: Compressing source files for OpenPLC Runtime v4...
[18:17:25]: Uploading program to runtime at 192.168.178.68...
[18:17:26]: Program uploaded successfully to runtime.
[18:17:26]: Runtime compilation started: COMPILING
[18:17:27]: Generating C files...
[18:17:27]: ./st_files/webserver_program.st:1-0..1-3: error: unknown syntax error.
[18:17:27]: 1 error(s) found. Bailing out!
[18:17:27]: Error generating C files
[18:17:27]: Compilation finished with errors!
[18:17:27]: Compilation failed (exit code: 1).
[18:17:27]: -------------------------------------------------------------------------------------------------------------
 
 
Is this behavior normal?
 
 
 

I love OpenPLC and I am waiting for Ethercat....
 
Reply 0 0
thiagoralves
Can you please share your project so I can reproduce the issue on our end?
Reply 0 0
PeBi
No problem, here it is....
Reply 0 0
PeBi
I noticed another effect in the project:
In debug mode, I can, for example, force the variable “K10” (DINT) to a different value, and the value is also processed as desired in the program.

However, if I want to force the variable “Zeit” (TIME) to a different value, this forced value is not accepted by the program.
Reply 0 0
thiagoralves
Forcing only works on basic data types for now. We are working to fix TIME, DT, TOD, etc. Also, debugging function block instances also does not work yet.
Reply 0 0
thiagoralves
No problem, here it is....
I saw that your project is set to compile for the Raspberry Pi, but instead you should select "OpenPLC Runtime v3", because that's what's running on the Raspberry Pi. Sorry for the confusion, at first we thought about having every platform on the list, but then it made more sense to include all "v3 runtimes" on the same selection. We should have had that removed before pushing the 4.1.0 version. I'll remove it for the next release. Sorry for the confusion.
Reply 0 0
PeBi
Thanks, now it works perfectly!!!
Reply 1 0
shaker0000
I have had exactely the same issue. Thanks for help.

But I have another question, due to I am new in this community.
 
My main target is to use a RPi4 and using its I/Os to simulate a physical project.
 
I tried it first with openPLC 4 and V4.1.0 editor.
I messed up due to now solution to using the IOs.
 
Then I tried to run openPLC_V3 runtime on it and run in the problem obove.
By using OpenPLC Runtime v3 in the editor as device, I can upload the project with now error.
But is there now a way to use the IOs from the Pi as well?
 
On the V3 webserver on 8080 I configured as Pi.
 
Thanks for helping and giving some feedback.
Reply 0 0
thiagoralves
On runtime v3, if you use the Raspberry Pi hardware layer, then you just need to follow the mapping on https://old.autonomylogic.com/docs/2-4-physical-addressing/
Reply 0 0
shaker0000
Ok thank you.

And is there a solution with runtime v4 as well?
Reply 0 0
thiagoralves
There is no raspberry pi driver on v4 yet (not sure if we’re going to add it as v4 is focused on being a real-time vPLC). However, if you want you can create a Python function block that interfaces the GPIO pins using the Python gpio library and then use this block on your PLC program to control the pins
Reply 0 0
talavishay
so it is easier to use v3 runtime on a pi in order to use the gpio`s? same for using it with modbus tcp? is there a guide for v4 runtime on a pi ?
Reply 0 0
thiagoralves
Yes, if you want to use gpio pins as IO then v3 is easier. For protocols, v4 is definitely the way to go. Documentation is coming soon to the official website, but you can follow up as we write it at this repository: https://github.com/Autonomy-Logic/user-docs/tree/main/docs/openplc-editor/communication
 
On v4 communication is set up from the PLC project itself on the editor, which makes it tied to the project you’re uploading instead of having a global configuration on the runtime. Once you learn how it works you’ll see it is actually much simpler than v3. Also, v4 will support not only Modbus, but OPC-UA (coming really soon), EtherNet/IP (also coming soon) and EtherCAT (not that soon but it’s coming).
 
The idea for v4 is that it will support as many industrial protocols as possible so that IO will be driven by these protocols instead of having specific drivers for specific platforms.
Reply 0 0
talavishay
will the debugger on the editor v4 work with the runtime v3?
Reply 0 0
thiagoralves
will the debugger on the editor v4 work with the runtime v3?
Yes it does
Reply 0 0
Reply