ESP8266 Arduino SoftwareSerial
ESP8266 Arduino SoftwareSerial
At the moment the Roboclaw arduino library wont compile with SoftwareSerial on non __AVR__ processors.
The espSoftwareSerial library is part of esp8266 Arduino and claims compatability with Arduino SoftwareSerial.
I'm inclined to modify the Roboclaw library ifdefs to allow it to compile but thought I'd better ask first if it's been tried before or is likely to be unuseable in real life.
cheers H
The espSoftwareSerial library is part of esp8266 Arduino and claims compatability with Arduino SoftwareSerial.
I'm inclined to modify the Roboclaw library ifdefs to allow it to compile but thought I'd better ask first if it's been tried before or is likely to be unuseable in real life.
cheers H
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: ESP8266 Arduino SoftwareSerial
Yes, that should be fine as long as the ESP8266 software serial is compatible with the regular Arduino software serial.
You should only have to comment out these lines: "#ifdef __AVR__" and the associated "#endif"
Everything else should just work.
You should only have to comment out these lines: "#ifdef __AVR__" and the associated "#endif"
Everything else should just work.
Re: ESP8266 Arduino SoftwareSerial
Took a while but I've made progress.
Got SoftwareSerial to compile by commenting out the #ifdefs as suggested
I had to download the latest espSoftwareSerial from https://github.com/plerup/espsoftwareserial
It compiled but I got nothing from the PacketSerialReadVersion example..... So I switched to HardwareSerial. First on an esp8266 dev board and then an esp32. Got what I suspect may be the same problem.
Turns out the esps have a hardware FIFO Tx buffer and flush() makes it do something funky to its pointer and it sends from the wrong part of the buffer. (I don't know whats it's actually doing but that's what it looks like from here). So I neutered flush (giving back some #ifdef)
and at this point things appear to be working. I've no idea if this is a good way of dealing with it but I'm keen to be working on my project so for now I'm assuming it's fixed.
I'm going to stay on esp32 HardwareSerial so I won't test SoftwareSerial again but I'm guessing it will work now. (edit: on reflection maybe not..... flush() contained if(hserial) )
for what it's worth the following set's up Serial1 on esp32 pins rx 16 tx 17
Happy Daze
Got SoftwareSerial to compile by commenting out the #ifdefs as suggested
I had to download the latest espSoftwareSerial from https://github.com/plerup/espsoftwareserial
It compiled but I got nothing from the PacketSerialReadVersion example..... So I switched to HardwareSerial. First on an esp8266 dev board and then an esp32. Got what I suspect may be the same problem.
Turns out the esps have a hardware FIFO Tx buffer and flush() makes it do something funky to its pointer and it sends from the wrong part of the buffer. (I don't know whats it's actually doing but that's what it looks like from here). So I neutered flush (giving back some #ifdef)
Code: Select all
void RoboClaw::flush()
{
#ifdef __AVR__
if(hserial)
hserial->flush();
#endif
}
I'm going to stay on esp32 HardwareSerial so I won't test SoftwareSerial again but I'm guessing it will work now. (edit: on reflection maybe not..... flush() contained if(hserial) )
for what it's worth the following set's up Serial1 on esp32 pins rx 16 tx 17
Code: Select all
#ifdef ESP32
HardwareSerial Serial1(2);
#endif
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: ESP8266 Arduino SoftwareSerial
The functionality of Flush in the Arduino serial libraries has changed atleast once before so Im not surprised you had to modify that.
If its working I dont see any problem.
If its working I dont see any problem.