I am using Modbus master.
MCU : PIC24FJ512GA606
Device : Serial_1 : Modbus RTU via RS-485(7ea)(Master)
Device : Serial_2 : Modbus RTU via RS-485(5ea)(Master)
HMI : Serial_3 : Modbus RTU via RS-232(1ea)(Slave)
There are 7 devices. One address 40001 is loaded in Modbus RTU mode for each device. The device's program also used FC10. This loads well in the Modbus Poll program.
And other serial lines are connected to HMI by RS-232 Modbus.
However, it does not work well with Modbus RTU Master (RS-485).
Although the device's address is retrieved, the MCU speed is so slow that it does not work on the HMI.
I tried adjusting delay, response time, etc., but the results are not good.
If I disable Modbus Master, everything works fine.
What problem do I need to solve?
Please help.
Modbus Master Speed
-
- Posts: 206
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 1:43 pm
- Has thanked: 5 times
- Been thanked: 7 times
-
- Valued Contributor
- Posts: 185
- Joined: Wed Jan 13, 2021 7:15 pm
- Has thanked: 81 times
- Been thanked: 30 times
Re: Modbus Master Speed
Hi Seokgi,
Device : Serial_1 : Modbus RTU via RS-485(7ea)(Master)
Device : Serial_2 : Modbus RTU via RS-485(5ea)(Master)
HMI : Serial_3 : Modbus RTU via RS-232(1ea)(Slave)
you cannot have 2 masters on the network, is this a typo or do you have 2 masters ?
Device : Serial_1 : Modbus RTU via RS-485(7ea)(Master)
Device : Serial_2 : Modbus RTU via RS-485(5ea)(Master)
HMI : Serial_3 : Modbus RTU via RS-232(1ea)(Slave)
you cannot have 2 masters on the network, is this a typo or do you have 2 masters ?
-
- Valued Contributor
- Posts: 185
- Joined: Wed Jan 13, 2021 7:15 pm
- Has thanked: 81 times
- Been thanked: 30 times
Re: Modbus Master Speed
Hi Seokgi,
Can you supply more detailed connection information and your flowchart so we can assist you further.
It is difficult with the information you have provided
Can you supply more detailed connection information and your flowchart so we can assist you further.
It is difficult with the information you have provided
Re: Modbus Master Speed
Here my project.
Thank you.
Thank you.
- Attachments
-
- 230901_Freezer-MCU-Serial.fcfx
- (54.9 KiB) Downloaded 621 times
Re: Modbus Master Speed
Hi
Can I ask you a question seokgi?
What is the reason of using many Masters on one MC?
I would like to use the Modbus but my knowledge is not good enough. That is the reason
to learn as much as possible.
-----------------------------------------------
In 2019 Ben wrote:
I'm assuming this is in a multi master type situation. As the bus gets busy the chance of a master interrupting another master's communications increases. Care should be taken to try and avoid collisions by first checking the bus is not in use and if busy having random wait delays before trying again. You may also need to manually resend messages until you get a correct acknowledge. Again beware as if multiple masters are performing retries then you could get collisions again and again. The random delay would be useful here too. Multi master systems are generally fairly complicated to get right and ideally should be avoided if possible.
Can I ask you a question seokgi?
What is the reason of using many Masters on one MC?
I would like to use the Modbus but my knowledge is not good enough. That is the reason
to learn as much as possible.
-----------------------------------------------
In 2019 Ben wrote:
I'm assuming this is in a multi master type situation. As the bus gets busy the chance of a master interrupting another master's communications increases. Care should be taken to try and avoid collisions by first checking the bus is not in use and if busy having random wait delays before trying again. You may also need to manually resend messages until you get a correct acknowledge. Again beware as if multiple masters are performing retries then you could get collisions again and again. The random delay would be useful here too. Multi master systems are generally fairly complicated to get right and ideally should be avoided if possible.
Re: Modbus Master Speed
Multiple networks must be operated on one MCU.
In fact, even if only one address is accessed from one device in one master, the MCU becomes very slow and data cannot be accessed. I asked other programmers, but they said this never happened.
Thank you for your interest.
In fact, even if only one address is accessed from one device in one master, the MCU becomes very slow and data cannot be accessed. I asked other programmers, but they said this never happened.
Thank you for your interest.
-
- Valued Contributor
- Posts: 185
- Joined: Wed Jan 13, 2021 7:15 pm
- Has thanked: 81 times
- Been thanked: 30 times
Re: Modbus Master Speed
Hi Seokgi,
i Would try the following:
do an update on your flowcode, make sure that you are using the latest component's. (just in case)
Have you tried the 1 second flasher, to check if your clock settings are correct ?
Double check your slave addresses make sure you don't have any duplicated address numbers, as this can cause issues.
Remove all slaves from your system, and then test each one individually
add a device and test again, and keep adding devices
i might even try testing the slaves away from your project to make sure they work.
What RS485 modbus interface are you using ?
i have seen it several times that modbus interfaces cannot drive the loop and fall over at around 5 devices
Are you using a termination resistor at the last device ?
What value is it ? if 120 Ohms try 330 Ohms (the fail safe option)
Steve
i Would try the following:
do an update on your flowcode, make sure that you are using the latest component's. (just in case)
Have you tried the 1 second flasher, to check if your clock settings are correct ?
Double check your slave addresses make sure you don't have any duplicated address numbers, as this can cause issues.
Remove all slaves from your system, and then test each one individually
add a device and test again, and keep adding devices
i might even try testing the slaves away from your project to make sure they work.
What RS485 modbus interface are you using ?
i have seen it several times that modbus interfaces cannot drive the loop and fall over at around 5 devices
Are you using a termination resistor at the last device ?
What value is it ? if 120 Ohms try 330 Ohms (the fail safe option)
Steve
Re: Modbus Master Speed
Thanks for your help.
1 second flash confirmed. Timer interrupts are working normally
Slave addresses do not overlap.
Testing every slave individually results in very slow reads.
Two slaves cannot be read.
If I read it with another computer program (Modbus Poll), a Time Out error occurs at the 7th Device, but the value is read.
Two interface ICs were tested: MAX485 and SN75176.
The termination resistance was 120 ohm. I tried connecting it and disconnecting it.
I haven't tried 330ohm. I have a holiday tomorrow, but I will definitely test it out.
Thank you again for your interest and help.
1 second flash confirmed. Timer interrupts are working normally
Slave addresses do not overlap.
Testing every slave individually results in very slow reads.
Two slaves cannot be read.
If I read it with another computer program (Modbus Poll), a Time Out error occurs at the 7th Device, but the value is read.
Two interface ICs were tested: MAX485 and SN75176.
The termination resistance was 120 ohm. I tried connecting it and disconnecting it.
I haven't tried 330ohm. I have a holiday tomorrow, but I will definitely test it out.
Thank you again for your interest and help.
-
- Valued Contributor
- Posts: 185
- Joined: Wed Jan 13, 2021 7:15 pm
- Has thanked: 81 times
- Been thanked: 30 times
Re: Modbus Master Speed
Hi Seokgi,
was this a different test ?from test 1 & test 2
"If I read it with another computer program (Modbus Poll), a Time Out error occurs at the 7th Device, but the value is read."
another question, how are the slaves connected ?
i.e daisy chain, twisted pairs ?
Steve
Are all these tests carried out with your program or away from this ?
was this a different test ?from test 1 & test 2
"If I read it with another computer program (Modbus Poll), a Time Out error occurs at the 7th Device, but the value is read."
another question, how are the slaves connected ?
i.e daisy chain, twisted pairs ?
Steve