Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
Hello to all,
I have the Raspian PI4 and I have the problem of modbus communication with CH341 via USB.
The port between Putty and the Hercules software you need to test modbus communication works because I can send a string so the problem is some CODESYS setting.
Reading on the forums I found to add on
CODESYSControl_User.cfg [SysCom]
Linux.Devicefile = / dev / ttyUSB
But as in the attached picture it doesn't start,
Can anyone answer me?
Edwin, do you have any information for me?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello and thanks for the reply,
I tried without spaces but still nothing, I tried to modify sudo nano /etc/CODESYSControl_User.cfg as in the attached file putting ttyUSB instead of ttyS and adding
portname: = COM.SysCom.SYS_COMPORT1
but still nothing, I have to maybe sudo nano /etc/CODESYSControl.cfg?
I also set the speed to 115200 by default.
I have to put ttyUSB in sudo nano /CODESYSControl_User.cfg
so without etc?
If someone kindly helps me or maybe Edwin can help me?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
setting is ok,
and from first screenshot I would say comports works.
I would suggest to add the name of the serial modbus device to a watch window to have more information what happens...
(add Modbus_Slave_Com_port to the watch window and undfold it to see more infommation/diag there)
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Edwin, I thank you for your kindness in answering me,
I have attached to you what happens in the WATCH table, but I ask you, these lines:
[SysCom]
Linux.Devicefile = / dev / ttyUSB
portnum: = COM.SysCom.SYS_COMPORT1;
I have to add them up
sudo nano /etc/CODESYSControl.cfg
or
sudo nano /etc/CODESYSControl_User.cfg
I have to put it
portnum: = COM.SysCom.SYS_COMPORT1;
on CODESYSControl_User.cfg and not on CODESYSControl.cfg
and the speed that I find on etc / CODESYSControl_User.cfg I have to leave to 115200 even if in the forum they speak of 9600?
I ask you all these questions because I have now moved them but the communication does not start.
I state that sending a string from Hercules with Putty the string is received so it must be a problem in the settings.
Thanks for your kindness.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
you just need:
in /etc/CODESYSControl_User.cfg
[SysCom]
Linux.Devicefile=/dev/ttyUSB
nothing else... if this section is in /etc/CODESYSControl.cfg this will be lost on every runtime update... so the correct place to have is /etc/CODESYSControl_User.cfg.
According the watch window.
"Undefined" means there is no real or proper response from the slave..!
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Edwin and thanks for the help,
in the attached file I see that the baudrate is set to 115200, on all the examples the tests are with 9600, do I have to change the speed on the file?
Do you think the screen I have attached to you is correct and do I have to set the slaves to 115200?
I ask because I made a thousand changes on the slave and also on the software to try communication from the PC but does not want to leave and honestly I do not know what else to try.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi and thanks Edwin for the kindness in answering me,
now without the symbol; I managed to do what you see in the attached image, but values that are indecipherable appear, if I change a value, something happens in the registers but the indecipherable values change.
Thank you for your kindness
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello to all,
I have the Raspian PI4 and I have the problem of modbus communication with CH341 via USB.
The port between Putty and the Hercules software you need to test modbus communication works because I can send a string so the problem is some CODESYS setting.
Reading on the forums I found to add on
CODESYSControl_User.cfg
[SysCom]
Linux.Devicefile = / dev / ttyUSB
But as in the attached picture it doesn't start,
Can anyone answer me?
Edwin, do you have any information for me?
Thanks
Hi,
without these spaces it might work ( and it should be 3.5SP15 at least ->version)
[SysCom]Linux.Devicefile=/dev/ttyUSB
BR
Edwin
Hello and thanks for the reply,
I tried without spaces but still nothing, I tried to modify sudo nano /etc/CODESYSControl_User.cfg as in the attached file putting ttyUSB instead of ttyS and adding
portname: = COM.SysCom.SYS_COMPORT1
but still nothing, I have to maybe sudo nano /etc/CODESYSControl.cfg?
I also set the speed to 115200 by default.
I have to put ttyUSB in sudo nano /CODESYSControl_User.cfg
so without etc?
If someone kindly helps me or maybe Edwin can help me?
Thanks
Hi,
setting is ok,
and from first screenshot I would say comports works.
I would suggest to add the name of the serial modbus device to a watch window to have more information what happens...
(add Modbus_Slave_Com_port to the watch window and undfold it to see more infommation/diag there)
BR
Edwin
Hi Edwin, I thank you for your kindness in answering me,
I have attached to you what happens in the WATCH table, but I ask you, these lines:
[SysCom]
Linux.Devicefile = / dev / ttyUSB
portnum: = COM.SysCom.SYS_COMPORT1;
I have to add them up
sudo nano /etc/CODESYSControl.cfg
or
sudo nano /etc/CODESYSControl_User.cfg
I have to put it
portnum: = COM.SysCom.SYS_COMPORT1;
on CODESYSControl_User.cfg and not on CODESYSControl.cfg
and the speed that I find on etc / CODESYSControl_User.cfg I have to leave to 115200 even if in the forum they speak of 9600?
I ask you all these questions because I have now moved them but the communication does not start.
I state that sending a string from Hercules with Putty the string is received so it must be a problem in the settings.
Thanks for your kindness.
Hi,
you just need:
in /etc/CODESYSControl_User.cfg
[SysCom]
Linux.Devicefile=/dev/ttyUSB
nothing else... if this section is in /etc/CODESYSControl.cfg this will be lost on every runtime update... so the correct place to have is /etc/CODESYSControl_User.cfg.
According the watch window.
"Undefined" means there is no real or proper response from the slave..!
BR
Edwin
Hi Edwin and thanks for the help,
in the attached file I see that the baudrate is set to 115200, on all the examples the tests are with 9600, do I have to change the speed on the file?
Do you think the screen I have attached to you is correct and do I have to set the slaves to 115200?
I ask because I made a thousand changes on the slave and also on the software to try communication from the PC but does not want to leave and honestly I do not know what else to try.
Hi,
you need to change the baudrate here:
remove the ';' infront of: Linux.Devicefile=/dev/ttyUSB
BR
Edwin
Hello,
Without ; as you see in the attachment, it remains with the red triangle, it connects only if I put it and it becomes a green triangle
Hi and thanks Edwin for the kindness in answering me,
now without the symbol; I managed to do what you see in the attached image, but values that are indecipherable appear, if I change a value, something happens in the registers but the indecipherable values change.
Thank you for your kindness
Hi, I've changed the simulator and this works
Thanks for the answers.