Skip to content
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

HW serials (MEGA, DUE) fail to receive subscriptions from mqtt broker using PubSubClient lib #195

Open
plop510 opened this issue May 22, 2020 · 2 comments

Comments

@plop510
Copy link

plop510 commented May 22, 2020

I try to use the library with an Arduino DUE (with the changes to avoid the conflict with Ringbuffer class) and I found that hw serials don´t work for subscription receiving using PubSubClient library. I found that also in MEGA, if you use HW serials the same issue happens.
I make it work like a charm with any board that admit SoftwareSerial lib (Leonardo, Mega, etc) but DUE has a different architecture than avr and doesn´t admit that library. By the way, I was testing with hw serials on MEGA and the behaviour is the same as in DUE but in that case, the workaround is using SoftSerial in MEGA.
To detail a bit more the problem:

  • Library works OK using softserial on any avr platform (not DUE = SAM32).
  • Using MQTT lib PubSub, you are able to publish any topic but it is not received any suscribed topic (my testing sketch publish a topic and suscribes to the same topic) if you use a HW serial to interface with ESP.
  • As ESP8266 I´m using an ESP12F with 1.5 AT firmware at 38400 baud and I´ve tested all baud rates (reloading firmwares) and I found the same behaviour: only works with SoftwareSerial, no with Hardware ports on MEGA or on DUE.
    Please help.
@JAndrassy
Copy link

JAndrassy commented May 22, 2020

use 9600 baud. the library is optimized for it.
or use my WiFiEspAT library with 500000 baud if you want

@plop510
Copy link
Author

plop510 commented May 22, 2020

Thanks for your fast answer.
I´ve tested with 9600 baud, over a MEGA Serial1 (hardware port) and the result is the same: can publish OK but NOT receive any suscription packet at all.
I swap to softserial pins, recompile and ALL suscription packets are received back by the callback function.
It seems that most of people use softserial but for DUE is not possible.
Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants