#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
Additional in CODESYSControl.cfg /etc/
you need to add:
[SysCom]Linux.Devicefile=/dev/ttySS
RTC and Input and Outputs are working with attached example.
(Which is the standard GPIO Example project)
Com1 is in that case RS232 Port
Com2 is the RS485 port
This was not a test with a real slave device (missing a real slave to do that) but the green signs on the device tree
indicate that it will work with both ports.
Additional there is a bug that baudrates below 4800 are not possible at the moment, this should be fixed in one of the next versions.
I tested modbus RTU communication on RS-485 (port2) with real slave.
Unfortunately, it don't work ok.
I am reading 1 holding register (MB function 3) on address 0.
Modbus_Slave_COM_Port is going to the fault all the time. And I don't receive the value on raspberry back from the slave.
I connected RS485 bus to another PC with bus monitor programm. I have established, that master sends the request right and slave answers ok. But obviously master don't receive this answer right.
Here is the print screen from the monitor program on RS485 bus. Red line is the master request and blue is slave answer:
Any idea?
Best regards,
Zdenko.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Zdenko,
need more details, what if you add the slave instance to the watch window?
Need this variables states (expand the slave instance and give me a screenshot)
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made an auto-reset on Slave error, just like you suggest me in the other post.
This two screens are switching in 0,5Hz frequency (error comes and reset is activated just after error).
I hope you can see some details which can be helpful. If you need some more details please let me know.
Thank you.
Zdenko.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
as I stated already:
this missing library "pain" will be solved to 3.5SP5 on July (load missing libraries on demand)
for now please update to 3.5.4.30 CODESYS IDE and use my attached Projekt (install the new Version into the same Directory as always recommended - no need to
uninstall your 3.5.4.20 version)
I have tested Raspocomm Modbus RS-485 communication with the new version of Raspicomm driver and Codesys 3.5.SP5. But the problem still exists. Writing to slave module is working, but reading don't. Is there any solution for this problem already known?
Best regards,
Zdenko.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
if someone want to use raspicomm:
Which feature are available with raspicomm
â—¾Joystick
â—¾RS-485
â—¾RS-232
â—¾Output (LEDs)
â—¾HWClock
http://amescon.com/products/getting-started.aspx
additional some modifications are needed:
in /etc/rc.local add
sudo ln -s /dev/ttyAMA0 /dev/ttySS0
sudo ln -s /dev/ttyRPC0 /dev/ttySS1
sudo nano /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
sudo ln -s /dev/ttyAMA0 /dev/ttySS0sudo ln -s /dev/ttyRPC0 /dev/ttySS1
exit 0
Additional in CODESYSControl.cfg /etc/
you need to add:
[SysCom]Linux.Devicefile=/dev/ttySS
RTC and Input and Outputs are working with attached example.
(Which is the standard GPIO Example project)
Com1 is in that case RS232 Port
Com2 is the RS485 port
This was not a test with a real slave device (missing a real slave to do that) but the green signs on the device tree
indicate that it will work with both ports.
Additional there is a bug that baudrates below 4800 are not possible at the moment, this should be fixed in one of the next versions.
BR
Edwin
RASPICOMM.project [289.95 KiB]
Thank you Edwin.
This is great!
Should we execute Raspicomm setup-script on the Raspberry first?
Best regards,
Zdenko.
Hi,
I made a Raspicomm installation on Raspberry.
I tested modbus RTU communication on RS-485 (port2) with real slave.
Unfortunately, it don't work ok.
I am reading 1 holding register (MB function 3) on address 0.
Modbus_Slave_COM_Port is going to the fault all the time. And I don't receive the value on raspberry back from the slave.
I connected RS485 bus to another PC with bus monitor programm. I have established, that master sends the request right and slave answers ok. But obviously master don't receive this answer right.
Here is the print screen from the monitor program on RS485 bus. Red line is the master request and blue is slave answer:
Any idea?
Best regards,
Zdenko.
Hi Zdenko,
need more details, what if you add the slave instance to the watch window?
Need this variables states (expand the slave instance and give me a screenshot)
BR
Edwin
Hi,
Here are the requested Print screens:
I made an auto-reset on Slave error, just like you suggest me in the other post.
This two screens are switching in 0,5Hz frequency (error comes and reset is activated just after error).
I hope you can see some details which can be helpful. If you need some more details please let me know.
Thank you.
Zdenko.
Hi,
could you remove the "auto reset" from your application,
I need the error (screenshots) which occure... when communication fails.
BR
Edwin
Hi,
Done. Here is the requested Prtsc:
BR
Zdenko.
Hi,
I am also trying to use RTC on Raspicomm.
It don't work with this library:
How can I use it?
BR
Zdenko.
Hi Zdenko,
hm... please use the example from store ( http://store.codesys.com/date-and-tme.html ), and update the plc to Raspberry Pi.
Then you get the follwoing result:
BR
Edwin
Hi,
thank you.
I noticed that firstly, OSCAT libs have to be installed.
I am receiving 2 errors with the date and time example:
When I compile original sample, no errors are present. After I change Device to Raspberry, this errors scours.
BR
Zdenko.
Hi Zdenko,
as I stated already:
this missing library "pain" will be solved to 3.5SP5 on July (load missing libraries on demand)
for now please update to 3.5.4.30 CODESYS IDE and use my attached Projekt (install the new Version into the same Directory as always recommended - no need to
uninstall your 3.5.4.20 version)
ftp://Raspi:qPAQhcRt@ftp.3s-software.com
BR
Edwin
Hi,
Yes, it works .
Thank you very much.
Is there any solution available for RS-485 Modbus?
BR
Zdenko.
Hi Zdenko,
guess we need to investigate online with your devices...!
Could you setup everything - we meet online (http://www.codesys.com/support-training ... nance.html ) please send the ID to e support@codesys.com e if you are ready.
BR
Edwin
Hi,
there is another problem with RTC.
At Raspberry boot, system clock is not updated with RTC, but opposite - RTC is updated with system clock. Any idea?
BTW: RS-485 modbus is under investigation.
Best regards.
Zdenko.
Hi,
guess this hass nothing to do with CODESYS,
could we ask this the raspicomm forum?
BR
Edwin
Hi,
there was a problem with Raspicomm and is already solved.
Please look at the Raspicomm forum for a solution.
BR
Zdenko.
Hi,
I have tested Raspocomm Modbus RS-485 communication with the new version of Raspicomm driver and Codesys 3.5.SP5. But the problem still exists. Writing to slave module is working, but reading don't. Is there any solution for this problem already known?
Best regards,
Zdenko.