Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openplc_v3 #3

Open
LionF-95 opened this issue Dec 6, 2022 · 8 comments
Open

openplc_v3 #3

LionF-95 opened this issue Dec 6, 2022 · 8 comments

Comments

@LionF-95
Copy link

LionF-95 commented Dec 6, 2022

openplc web ide show nothing

@r2k-in-the-vortex
Copy link
Owner

r2k-in-the-vortex commented Dec 6, 2022

open_plc writes install logs, from there find what it sayd about ethercat and paste here
specifically search for "Installing OpenPLC on Linux", right after that it should say "including EtherCAT"

if it doesn't say anything about ethercat, did you install with command ./install.sh linux ethercat and are you running latest master from https://github.com/thiagoralves/OpenPLC_v3.git ? The ethercat changes were merged just today, so there is no need to use my fork anymore.

@LionF-95
Copy link
Author

LionF-95 commented Dec 7, 2022

5
4
3
2
1

@LionF-95
Copy link
Author

LionF-95 commented Dec 7, 2022

I follow you steps,but it seems something wrong

@r2k-in-the-vortex
Copy link
Owner

Alright, everything seems to install correctly, except of course that it doesn't work. First let me quickly explain the mechanism.
First, if selected background_installer.sh will write ethercat to file webserver/scripts/ethercat check that it did so, I think it did.

Then webserver/scripts/compile_program.sh will read that file and if it contains word ethercat, it will compile main.cpp with flag -D _ethercat_src

with that flag defined https://github.com/thiagoralves/OpenPLC_v3/blob/master/webserver/core/main.cpp#L224 will call ethercat configuration and is supposed to log a message to be read on webui.

That doesn't happen, so we need to figure out where that chain of evens breaks. Couple of notes. You have UTF shell, my shell certainly can't show Chinese characters. So maybe there is a problem there? I don't think so, but who knows, it's a point to check.

_ethercat_src define doesn't seem to reach main.cpp, maybe there is something weird in your build environment, lets check.

in main.cpp, modify like so, rebuild and try to start again:

    //======================================================
    //              HARDWARE INITIALIZATION
    //======================================================
#ifdef _ethercat_src
    sprintf((char *)log_msg, "Configuring Ethercat\n");
    log(log_msg);
    type_logger_callback logger = logger_callback; 
    ethercat_configure("../utils/ethercat_src/build/ethercat.cfg", logger);
#else
    sprintf((char *)log_msg, "Ethercat not defined\n");
    log(log_msg);
#endif

that way, it will definitely log something about ethercat, telling you if problem is in -D _ethercat_src not working, or somewhere else entirely.

@LionF-95
Copy link
Author

LionF-95 commented Dec 8, 2022

Hello engineer, the good news is that I am adding your code in main.cpp. Two errors have been found. Before that, I did the following steps : 1, sudo ethercat xml; 2. Copy the xml content into the master_config.xml; 3. Then run ./build.sh and ./isntall.sh; 4. rerun ./install.sh linux etherCat. In the end, it reported the following error, please tell me what I should do next. XML files can be used on TwinCat3
master_config.xml.txt

Screenshot from 2022-12-08 14-19-31
Screenshot from 2022-12-08 14-20-34

@r2k-in-the-vortex
Copy link
Owner

r2k-in-the-vortex commented Dec 8, 2022

Okey, so it started configuring ethercat, that's good. I think maybe what functionally helped was rebuilding the project, nothing else.

But the file is quite obviously broken, it's not valid xml. you forgot to copy <?xml version="1.0" ?> and there was some plaintext instead. Try this repaired file(remove .txt of course).
master_config.xml.txt

also check that the file path is correct cat /home/OpenPLC_v3/utils/ethercat_src/build/master_config.xml should show if the file it's looking for is actually there and contains the right stuff

@LionF-95
Copy link
Author

LionF-95 commented Dec 9, 2022

Screenshot from 2022-12-09 14-25-08
Screenshot from 2022-12-09 14-33-17
Screenshot from 2022-12-09 14-38-06
Screenshot from 2022-12-09 14-38-56
Hello engineer, I copied your modified xml file into it today, and then made ./build sh and/ install. sh。 But it seems that there are still some problems. I have all the files in question. What else can I do to troubleshoot the problem. PS: master_ Config.xml is manually copied into the build directory

@r2k-in-the-vortex
Copy link
Owner

No the file isn't where it's supposed to be or there is some other problem with it image

Perhaps the permissions are wrong? Capitalization? master_ Config.xml is not the same thing as master_config.xml

try command
cat /home/lion/OpenPLC_v3/utils/ethercat_src/build/master_config.xml
that should read the contents of the file to console if it's in the right place and readable.

and the same command with sudo to see if root also has read access because you are running openplc under root (have to in order to use ethercat master)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants