have a problem: I made a RS485 communication between two Arduino UNOs. It is working perfect. I want to do the same for Arduino MEGA but it doesn't wanna work and this is not working only as a reciver. So I can send data with my Arduino MEGA and receive it by UNO but as soon as I will install MEGA as a receiver than I can not pick up the data...
What can be wrong? The pins are the same for UNO and MEGA (wanted to avoid faults).
I have check right now that if I will send from MEGA TX0 and RX0 to UNO than it is working. But if I will send from TX1 and TX2 than not. Signal is going out because I see it on osciloscope...
Don't know if this is the problem, but if you are using the SoftwareSerial library, you must follow this:
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
this is very helpful, I have found it too and test it... but it is also not working. For example I use pin 1 as TX (it doesn't matter because I wanna receive only) and have try to use pin 10 or 50 but still my MEGA is not receiving... Should I use pullup resistor for RX? 10k Ohm to +5V ???
I think I know it - this is hardware problem, there should be pull up resistor on RX and RX must be one of the pins from : 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
This is why it is working on UNO because on UNO RX is supported and there is 1k resistor to 5V but on MEGA we need to use another pin for RX which is not pulled to 5V.
Can anyone confirm this before I will damage my ARDUINO? Should I use 1k or more?
You shouldn't need a pullup resistor, but it won't hurt anything if you use a 1K resistor as a test. The TX line on the remote device should source and sink current.
I have it, and I see that my signal is comming on RX so receiver get it. Signal is nice, 5V amplitude and sharp. Everything looks good. Just my receiver doesn't wanna receive it...
would be nice because I am getting crazy here... don't get it also why when I send from Mego to UNO from other port than RX0 and TX0 than is also not receiving. On o-scope I se that signal is going out and receiver side (UNO) is the same so why it is not receiving...
23 because this is my pin 10 and 3 because this is my pin 1
You have four hardware serial ports on a Mega; why are you using software serial?
And why do you use a hardware serial pin (1) in combination with another pin for software serial. I have the suspicion that you don't know what you're doing (no offense intended).
And question two, why such a combination? Because:
"Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69)."
for hardware serial my MEGA can send data to UNO - it doesn't matter if this is TX0, TX1, TX2 or TX3 but the speed is much more lower and I have change delay (in us) from 660 to 3660: