Skip to content

Library doesn't work properly when used in Arduino Mega 2560 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nemerdaud opened this issue Jan 22, 2020 · 2 comments
Closed

Library doesn't work properly when used in Arduino Mega 2560 #2

nemerdaud opened this issue Jan 22, 2020 · 2 comments
Assignees
Labels
conclusion: declined Will not be worked on topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@nemerdaud
Copy link

No description provided.

@nemerdaud nemerdaud changed the title Library doesn't work properly when used in Arduino Mega (Atm Library doesn't work properly when used in Arduino Mega 2560 Jan 22, 2020
@nemerdaud
Copy link
Author

nemerdaud commented Jan 22, 2020

I was trying to use ArduinoModbus library that is very tied with ArduinoRS485. Using in Arduino Mega 2560, it was unable to work properly. The examples using MobBusRTUServerLed (Arduino Mega) and ModBusRTUClientToggle doesn't work correctly, presenting "Connection Timeout" in the client-side.
If I change the Arduino Mega to another Arduino Uno, the exemple works like a charm... but doesn't with Mega.

Debugging a little bit the code, I could perceive that the problem was in the ArduinoRS485 library that doesn't setup correctly the board pins for the Arduino Mega board.

To fix the problem, in the end of the RS485.cpp file, I changed the instantiation of de RS485 object to:

#if defined(__AVR_ATmega2560__)
  RS485Class RS485(Serial1, 18, RS845_DEFAULT_DE_PIN, RS845_DEFAULT_RE_PIN);
#else
  RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS845_DEFAULT_DE_PIN, RS845_DEFAULT_RE_PIN);
#endif

And all the communication started work great.
I know I hard-coded some values, but I'm putting here just to help you guys to fix the code, if you intend to do in this way.

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Mar 14, 2020
@per1234
Copy link
Contributor

per1234 commented Jan 13, 2023

The developers of the library have decided the AVR architecture of the Arduino Mega 2560 will not be supported: #35

@per1234 per1234 closed this as completed Jan 13, 2023
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 13, 2023
@per1234 per1234 self-assigned this Jan 13, 2023
@per1234 per1234 added the conclusion: declined Will not be worked on label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: declined Will not be worked on topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants