I have a project which need to communicate with 5+ serial device, some of them are connected using softwareserial in signal wire mode with esp8266.
I'd like to upgrade the project to use esp32 as it can provide more GPIOs, but unfortunately, those softwareserial for esp32 using Arudino framework in GitHub can only used for sending data, and it will cause error if there has data received. (e.g. https://github.com/jdollar/espsoftwareserial/).
Is there any softwareserial library for ESP32 which can be used to receive data?
Any software serial library for ESP32 can be used to receive data?
Re: Any software serial library for ESP32 can be used to receive data?
Try this one https://github.com/paulvha/ESP32
it is based on the Jdollar library but it needed a large number of fixes before it worked. Make sure to read the readme!
it is based on the Jdollar library but it needed a large number of fixes before it worked. Make sure to read the readme!
Re: Any software serial library for ESP32 can be used to receive data?
Thanks a lot.
However, according to the README.md, "It now works OK-is, most of the time. But do not expect it to work above 56K (stretch already !!)", it seems the library is still not stable, and only work for 56K. But I need to connect the device in 115200.
I will study how it fix the issue in jdollar's version, and try to modify it for half-duplex mode.
However, according to the README.md, "It now works OK-is, most of the time. But do not expect it to work above 56K (stretch already !!)", it seems the library is still not stable, and only work for 56K. But I need to connect the device in 115200.
I will study how it fix the issue in jdollar's version, and try to modify it for half-duplex mode.
Re: Any software serial library for ESP32 can be used to receive data?
I just test your library, and it seems that your change on rxRead cause the issue in 115200bps.paulvha wrote: ↑Sun Feb 24, 2019 9:43 amTry this one https://github.com/paulvha/ESP32
it is based on the Jdollar library but it needed a large number of fixes before it worked. Make sure to read the readme!
According to your comment, you have changed the wait time as the delay measured is neglectable; however, when I tested in 115200, even it cannot receive the result correctly, but it has consistent return for same data, it seems that the received bit is shifted.
So I try to restore the original formula for wait time ( i.e. unsigned long wait = m_bitTime + m_bitTime/3 - 500; ), it works fine in 115200 now. This 3.5us is important for fast baud rate.
I will have more test for the stableness, and try to add support on single wire half duplex mode, as my device is running in this mode.
Thank you very much for fixing the receive issue.
Re: Any software serial library for ESP32 can be used to receive data?
By modifying the wait time, there has no more receiving issue in your library, I have tested with continue data received for over 1 hour (receiving 50 bytes/sec). But it has problem in sending data, the data is corrupted.
However, if I fallback to jdollar's version, it cannot receive data, but there has no error sending data.
It seems that as you only call portENTER_CRITICAL for slow connection; however, there always have some background task in ESP32, this is important for high speed also. And also the calculation of start point for bit waiting time is different.
I have fallback some change in your library to jdollar's version, and it works fine with bidirectional communication in 115200 bps now.
I will keep testing for longer time to ensure the connection in 115200 bps is stable.
Thanks a lot.
However, if I fallback to jdollar's version, it cannot receive data, but there has no error sending data.
It seems that as you only call portENTER_CRITICAL for slow connection; however, there always have some background task in ESP32, this is important for high speed also. And also the calculation of start point for bit waiting time is different.
I have fallback some change in your library to jdollar's version, and it works fine with bidirectional communication in 115200 bps now.
I will keep testing for longer time to ensure the connection in 115200 bps is stable.
Thanks a lot.
Re: Any software serial library for ESP32 can be used to receive data?
Thanks.
Timing is very critical indeed for softserial. I have not seen any software serial work correct on 115K on any platform.(Uno, ESP8266, mega2560, ESP32 etc). Maybe only for sending. All is depending on how fast the code is working, the system is handling interrupts and the system load. Personally I would not use above 56K. Maybe you device can not be switched to lower baudrate, but otherwise I would try that. I would welcome your changes/code back on the github and make it one.
regards,
Paul
Timing is very critical indeed for softserial. I have not seen any software serial work correct on 115K on any platform.(Uno, ESP8266, mega2560, ESP32 etc). Maybe only for sending. All is depending on how fast the code is working, the system is handling interrupts and the system load. Personally I would not use above 56K. Maybe you device can not be switched to lower baudrate, but otherwise I would try that. I would welcome your changes/code back on the github and make it one.
regards,
Paul
Re: Any software serial library for ESP32 can be used to receive data?
plerup's library already works in 115200 with ESP8266, I have modified the library for one wire half duplex connection, and used in my RobotControl project for a year, it's very stable in 115200.paulvha wrote: ↑Mon Feb 25, 2019 9:23 amThanks.
Timing is very critical indeed for softserial. I have not seen any software serial work correct on 115K on any platform.(Uno, ESP8266, mega2560, ESP32 etc). Maybe only for sending. All is depending on how fast the code is working, the system is handling interrupts and the system load. Personally I would not use above 56K. Maybe you device can not be switched to lower baudrate, but otherwise I would try that. I would welcome your changes/code back on the github and make it one.
regards,
Paul
Who is online
Users browsing this forum: No registered users and 75 guests