Jump to content

Rs485 - arduino Mega doesn't communicate....


Recommended Posts

Posted

Hi all.

I've read several similar posts,but no solution worked to my issue.

I self-made 2 type of rs485 interfaces (using MAX487): one such an embedded system for nano, one just the rs485 for Mega.

The Nano embedded interface works very fine,all the Nanos connected work fine.

But now I'm trying to connect a Mega (for the PVI800 keyboard).

Well,it simply doesn't work.....

I made some crossed test:

- connect the Nano interface to Mega: it doesn't work

- connect the Mega interface to Nano: it works

- connected Mega as IRQ Serial : it works

- connected Tx/Rx pin over all the Mega connection (tx/rx 0 to tx/rx 3) but no working

When Mega is connected to its dedicated rs485 interface, the RX led stays off and the board doesn't work.....

I tried with 2 different Mega Boards,but same result: if connected as IRQ Serial, both the boards do their job, but if connected via RS485 no way to make them work.

Honestly i don't understand..... Both kind of interfaces are correctly working,so the problem is Mega, but why?

 

Jocman

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

https://forums.eagle.ru/showthread.php?t=50071

Posted

What does "connect the Nano interface to Mega" mean?

If you use an RS485 network, you can only use a Mega as a master because it has more than one hardware UART.
Nanos have only one UART, so the TX0 and RX0 pins are used for USB OR RS485.  You can't do both on the same Nano at the same time.

Posted (edited)

I made 2 interfaces.

The one for the Nano hosts a Max487 chip (and the needed components), the connectors for the nano board and the pins for wiring the panels switches/leds/others. As the Nano board is very small, it is directly mounted on the interface PCB

The one for the Mega board is smaller, as it hosts only the Max487 chip and the needed components. This interface is connected to Mega board via wires: the enabled pin for RS485 is the #2, while TX and RX are wired to TX1/RX1 pins.

(attached the image of both the interfaces)

With some dupont wires it's "easy" to connect "on the fly" the Mega board to the interface made fo the Nano and viceversa. This way I made the cross test, so I'm sure the interface for the Mega board works, thus the problem is the Mega board (i'm referring to a Mega board as slave). When I use a Nano with both type of interfaces, by pressing the physical button the virtual button is regurarly pressed.

My plans are (or were??) to connect most of the panels to Nano boards, but for some panels (as the PVI800 keyboard) I'd like to use a Mega board via RS485

The RS485 master is obviously a Mega board direct via USB.

 

 

IMG_20230308_183643[1].jpg

Edited by Jocman

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

https://forums.eagle.ru/showthread.php?t=50071

Posted (edited)

We recently had a discussion on that topic.

Maybe you find the solution by using TX0 / RX0 of the Mega?

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Thankyou very much for your suggestion.

I'll read the post and meke some test.

I'll post in the next days about the news.

 

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

https://forums.eagle.ru/showthread.php?t=50071

Posted (edited)

As there are cheap Mega clones on the market, additionally you may swap TX0 with RX0.

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

  • 2 weeks later...
Posted

Well, after several days of testing (and swearing) suddenly something's changed. I don't know what....I just re-loaded the sketch on the board.

For the sake of honesty, I tested an RS485 chain with 2 Nanos and 1 Mega.

The 2 Nanos are correctly working (they communicate), but initially the mega kept not communicating. I tried (desperation?) by unplugging the dupont wires fromt TX0/RX0 and plugging into TX1/RX1 (with all the system still powered and connected to the master.)

The mega started to communicate..... Then unpowered the system and powered again: the mega didn't work. Unplugged the wires again and plugged back to TX0/RX0: it started to work again.... Unpowered then powered: the mega didn't work again.....unplugged and plugged the wires again (this time on the same TX0/RX0): the mega works.....

I don't understand, what's wrong???

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

https://forums.eagle.ru/showthread.php?t=50071

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...