Mega2560 Tx/Rx problem (as Modbus Master) - Solved
Moderator: Benj
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Mega2560 Tx/Rx problem (as Modbus Master) - Solved
Setup:
Mega2560 as Modbus Master
Uno as Node13
The problem:
Mega2560 does Tx to Node13, but Tx led does not blink.
I can see on ssd1306 on Node13 that Rx changes from 0 to 1 and Node13 responds and sends the data back, but Mega2560 does show on display only the message 255 - No reply.
What is done:
FC8 is updated.
Mega2560 board is changed to another one. The same result. The direction pin is changed and some other small changers.
But Modbus Master shows no data from Node13.
I have changed the Mega2560 board to Uno board.
Uno is programmed as the Mobus Master (the code is the same, just some small changes to pins, etc).
Uno prints the data OK from Node13.
Got a new Mega2560 board and hooked it up.
The board is re-programmed, but I see no data-in from the Node13.
Is it Rx, Tx on Mega2560 problems?
I can see on the Mega2560 board the Rx led blinks, but no Tx blinking.
What is strange as the Node13 on Uno shows the incoming Rx from Mega2560. It means that Master did send the message to Node13.
Testing: I have removed from the Mega2560 the Rx wire. Rx led on Mega2560 keep blinking, showing that data is coming (or sending?).
What is strange. Looks like the Rx does the job of Tx.
Any help please?
Mega2560 as Modbus Master
Uno as Node13
The problem:
Mega2560 does Tx to Node13, but Tx led does not blink.
I can see on ssd1306 on Node13 that Rx changes from 0 to 1 and Node13 responds and sends the data back, but Mega2560 does show on display only the message 255 - No reply.
What is done:
FC8 is updated.
Mega2560 board is changed to another one. The same result. The direction pin is changed and some other small changers.
But Modbus Master shows no data from Node13.
I have changed the Mega2560 board to Uno board.
Uno is programmed as the Mobus Master (the code is the same, just some small changes to pins, etc).
Uno prints the data OK from Node13.
Got a new Mega2560 board and hooked it up.
The board is re-programmed, but I see no data-in from the Node13.
Is it Rx, Tx on Mega2560 problems?
I can see on the Mega2560 board the Rx led blinks, but no Tx blinking.
What is strange as the Node13 on Uno shows the incoming Rx from Mega2560. It means that Master did send the message to Node13.
Testing: I have removed from the Mega2560 the Rx wire. Rx led on Mega2560 keep blinking, showing that data is coming (or sending?).
What is strange. Looks like the Rx does the job of Tx.
Any help please?
Last edited by viktor_au on Thu Feb 14, 2019 2:00 am, edited 1 time in total.
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Could you attach your flowcharts that allow team to reproduce the problem?
Is problem only on modbus master component, or are even normal serial communications affected?
Is problem only on modbus master component, or are even normal serial communications affected?
Ill just keep the good work up!
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hi EtsDriver
I have attached three files.
Mega2560 as Modbus master does not read Node13.
Uno as Modbus master reads Node13.
Node13 (based on Uno).
Thank you.
I have attached three files.
Mega2560 as Modbus master does not read Node13.
Uno as Modbus master reads Node13.
Node13 (based on Uno).
Thank you.
- Attachments
-
- Node13_ssd1306(7a).fcfx
- (33.48 KiB) Downloaded 223 times
-
- Uno(ModbusMaster).fcfx
- (31.75 KiB) Downloaded 224 times
-
- Mega2560(ModbusMaster).fcfx
- (38.6 KiB) Downloaded 228 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hello,
This seems strange. Can you confirm that the Mega is running correctly e.g. the display is working. Also can you confirm that the UART TX and RS485 Data Direction pin are outputting values?
I'll have a dig and see if we have a Mega board available in the office still.
This seems strange. Can you confirm that the Mega is running correctly e.g. the display is working. Also can you confirm that the UART TX and RS485 Data Direction pin are outputting values?
I'll have a dig and see if we have a Mega board available in the office still.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hello Benj
On photos Uno works as a Modbus Master. The message from Node 13 is just two (samples) numbers:1297.
Master communicates with Node13 with no problems.
On photos Uno works as a Modbus Master. The message from Node 13 is just two (samples) numbers:1297.
Master communicates with Node13 with no problems.
- Attachments
-
- UnoMastSignA,B.jpg (63.69 KiB) Viewed 23393 times
-
- UnoReadsNode13-1.jpg (134.92 KiB) Viewed 23393 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Mega 2560 as Modbus Master
Modbus Master is Mega2560. Mega is connected to Max485 module(s).
Slave 13 is shown as ProMini (on image) but in real life it is based on Uno.
Modbus Master is Mega2560. Mega is connected to Max485 module(s).
Slave 13 is shown as ProMini (on image) but in real life it is based on Uno.
- Attachments
-
- Mega_setup_1.jpg (79.39 KiB) Viewed 23393 times
-
- 1_MegaAB_sign.jpg (61.04 KiB) Viewed 23393 times
-
- 2_Tx_Rx_Dir.jpg (78.78 KiB) Viewed 23393 times
Last edited by viktor_au on Tue Nov 27, 2018 1:20 am, edited 1 time in total.
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Node13 (slave) shows the incoming Rx
- Attachments
-
- 3_Node13ShowsRx.jpg (74.46 KiB) Viewed 23393 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
I have changed the Max485 module.
The A,B signals have changed, Node13 receives the Rx from Master, but Master does not 'see' the data from Node13.
The A,B signals have changed, Node13 receives the Rx from Master, but Master does not 'see' the data from Node13.
- Attachments
-
- 2_MegaAB_sign.jpg (59.93 KiB) Viewed 23390 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Mega2560 Rx0 board pin testing
Note: Max485 is disconnected from Mega2560.
Looks like the Tx and Dir work OK.
However the Rx has constant +5v.
Note: Max485 is disconnected from Mega2560.
Looks like the Tx and Dir work OK.
However the Rx has constant +5v.
- Attachments
-
- NoWiresConnected.jpg (76.21 KiB) Viewed 23360 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Master Rx should have +5v level until Slave will send this level "down" (?).
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Question to Matrix team.
Properties->UART->TX and RX are readable only.
Is it possible to change the properties to writeable so I can check other Mega2560 channels?
Properties->UART->TX and RX are readable only.
Is it possible to change the properties to writeable so I can check other Mega2560 channels?
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hi viktor!viktor_au wrote:Question to Matrix team.
Properties->UART->TX and RX are readable only.
Is it possible to change the properties to writeable so I can check other Mega2560 channels?
Make a copy of your program, just before doing following steps:
You should be able to select the AtMega processor (if you own the atmel pack?) that is on board directly (ATMega2560), then you generate compatible .hex (compile) on flowcode and push the file to the bootloader using something like this.
Remember to double check all clockspeeds and other things after change, as now youre controlling the processor directly, without arduino familiar stuff (for example, D13 pin will now be PortB7).
After that, you should be able to select Tx/Rx in the way you want to do!
Ill just keep the good work up!
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Thanks EtsDriver.
But I have only Ard licence, not the AVR.
I think Steve_SS uses the Atmel Atmega2560 as the Modbus master without any problems as well.
The question is - why Arduino Mega2560 refuses to Tx, Rx Modbus Master signals properly.
I hope Benj will find the answer (as he said...)
It could be a problem with my hardware setup... maybe I have missed something.
But Arduino Uno works as the Modbus Master OK with the same setup.
But I have only Ard licence, not the AVR.
I think Steve_SS uses the Atmel Atmega2560 as the Modbus master without any problems as well.
The question is - why Arduino Mega2560 refuses to Tx, Rx Modbus Master signals properly.
I hope Benj will find the answer (as he said...)
It could be a problem with my hardware setup... maybe I have missed something.
But Arduino Uno works as the Modbus Master OK with the same setup.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hello,
Can you test the UART comms using the UART (RS232) component.
You can try transmitting from a Uno and receiving from the Mega and visa versa. Ideally we need to nail down what is and isn't working on the Mega and this will help to track down the cause of the problem.
I don't have a Mega 2560 R3 in the office so I've ordered one that should arrive next week.
Can you test the UART comms using the UART (RS232) component.
You can try transmitting from a Uno and receiving from the Mega and visa versa. Ideally we need to nail down what is and isn't working on the Mega and this will help to track down the cause of the problem.
I don't have a Mega 2560 R3 in the office so I've ordered one that should arrive next week.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Uno to Uno by using Rs232
Works OK.
Tx LED and Rx LED blink OK.
Works OK.
Tx LED and Rx LED blink OK.
- Attachments
-
- diagram_1.png
- (63.08 KiB) Downloaded 3691 times
-
- UnoMasterRs232_1.fcfx
- (23.52 KiB) Downloaded 131 times
-
- Uno13_ssd1306(78)_Rs232.fcfx
- (22.93 KiB) Downloaded 135 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Mega to Uno
by using Rx232
Mega: Tx0, Rx0 (board pins).
Works OK.
Tx LED and Rx LED blink OK.
by using Rx232
Mega: Tx0, Rx0 (board pins).
Works OK.
Tx LED and Rx LED blink OK.
- Attachments
-
- MegaMasterRs232_1.fcfx
- (23.52 KiB) Downloaded 146 times
-
- mega_uno-1.jpg (107.54 KiB) Viewed 23075 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Question to Matrix team.
Is it possible to update the situation with Mega2560 as Modubs master problems?
Please?
Is it possible to update the situation with Mega2560 as Modubs master problems?
Please?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hello,
I am still awaiting my Arduino Mega to arrive, actually it's probably about time to start chasing it. I ordered it around the time you opened the topic.
I don't see any reason as to why the Mega isn't working, the UART code works and the Modbus code works so put them together and it should ideally work like it does on the Uno. Without hardware I'm pretty stuck.
Do you have access to any comms analyser tools that you could use to monitor the serial comms as this would give us a good insight into what is going wrong. e.g. monitoring a working system and then comparing with the Mega.
I am still awaiting my Arduino Mega to arrive, actually it's probably about time to start chasing it. I ordered it around the time you opened the topic.
I don't see any reason as to why the Mega isn't working, the UART code works and the Modbus code works so put them together and it should ideally work like it does on the Uno. Without hardware I'm pretty stuck.
Do you have access to any comms analyser tools that you could use to monitor the serial comms as this would give us a good insight into what is going wrong. e.g. monitoring a working system and then comparing with the Mega.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master)
Hello.
Thank you for answering Ben.
As this is my first project with Modbus I have to learn a lot.
I am not sure what comms analyser tools to use.
Any suggestions?
One question Ben.
Is it possible to change the Modbus Master Tx and Rx properties to writable?
Thanks.
Thank you for answering Ben.
As this is my first project with Modbus I have to learn a lot.
I am not sure what comms analyser tools to use.
Any suggestions?
One question Ben.
Is it possible to change the Modbus Master Tx and Rx properties to writable?
Thanks.
- Attachments
-
- ModbusMasterComponentRx-1.jpg (60.04 KiB) Viewed 22682 times
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master): Solved
This is hardware issue related to Chinese made Mega 2560.
Matrix component works OK and is not a problem.
--------------------------------------------------------------
Mega 2560 as Modbus Master Rx input
After I used the Schmitt trigger between the R0 (Max485 TTL to RS485 converter output) and Mega Rx input the Modbus started to work.
Matrix component works OK and is not a problem.
--------------------------------------------------------------
Mega 2560 as Modbus Master Rx input
After I used the Schmitt trigger between the R0 (Max485 TTL to RS485 converter output) and Mega Rx input the Modbus started to work.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master) - Solved
Hello,
Excellent that's brilliant news. Glad you got it working and thanks for letting us know.
Excellent that's brilliant news. Glad you got it working and thanks for letting us know.
No I'm afraid the hardware UART pins are fixed on the Arduino devices unless you use a software channel.Is it possible to change the Modbus Master Tx and Rx properties to writable?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1
- Joined: Sat Jul 06, 2019 5:20 pm
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master): Solved
viktor_au wrote:This is hardware issue related to Chinese made Mega 2560.
Matrix component works OK and is not a problem.
--------------------------------------------------------------
Mega 2560 as Modbus Master Rx input
After I used the Schmitt trigger between the R0 (Max485 TTL to RS485 converter output) and Mega Rx input the Modbus started to work.
Good day, I have the same problem, please kindly tell me how and which Schmitt trigger you need to install. I ask if not difficult picture.
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 43 times
- Been thanked: 60 times
- Contact:
Re: Mega2560 Tx/Rx problem (as Modbus Master) - Solved
Hello Eugene
I used 74HC14.
I used 74HC14.
- Attachments
-
- 74HC14-1.jpg (68.43 KiB) Viewed 21718 times