Go Down

Topic: Nodemcu/esp8266 serial hdw requires sacrificing the console capability (Read 2627 times) previous topic - next topic

Juraj

Thanks, Juraj, is this the new library?

https://github.com/plerup/espsoftwareserial

If I get a chance i'll give it a try.

Frank
the new SoftwareSerial library is bundled with the core 2.5.0+ and replaced the old one

PerryBebbington


Quote
Thanks, Juraj, is this the new library?

https://github.com/plerup/espsoftwareserial

If I get a chance i'll give it a try.
Please report back about whether it is any good, I tried software serial on the ESP8266 and gave up. Maybe this version is much better (or maybe I was doing something wrong!).

frank2644

the new SoftwareSerial library is bundled with the core 2.5.0+ and replaced the old one
Juraj,

I'm not wanting to appear too stupid, but I have to ask: What do you mean by "core 2.5.0"? Can you give me a little more detail?

I'm running the Arduino IDE V1.8.5...If that means anything.

Frank

Juraj

Juraj,

I'm not wanting to appear too stupid, but I have to ask: What do you mean by "core 2.5.0"? Can you give me a little more detail?

I'm running the Arduino IDE V1.8.5...If that means anything.

Frank
esp8266 boards package version. in Boards Manager in IDE

frank2644

Juraj,

Okay, I think that board package contains the same Softwareserial library that I mentioned.

I'll give it a try and report back.

Thanks,
Frank

PerryBebbington

@frank2644,

You will be delighted to know I have just discovered another problem with the ESP8266 :( .
I have a Nextion connected to GPIO15 (Tx after using Serial.swap), this worked perfectly until I pressed the reset button, at which point it would not boot. I discovered that for the ESP8266 to boot GPIO15 has to be low. A serial port is high for idle, so being connected to the Nextion was holding GPIO15 high. A 10k resistor between GPIO15 and ground seems to be enough to hold it low and cures the problem.
For a full explanation of the problem read this.

frank2644

Hi PerryBebbington,

Yes, I hit the same problem a few days back. Very annoying. Your 10k resistor solution is good to know.

I'm testing the new serialsoftware library, but at the same time I decided to upgrade to the latest IDE and libraries. So all this has slowed me down a bit, hopefully I'll have some positive comments soon.

As usual the information on any library seems confusing, incomplete, or unintelligible. Although maybe it's all due to my shortcomings.

I'm tempted to write my own bit-banging software to implement serial asynchronous communication, something I did 35 years ago in assembler on a single thread CPU.

Frank

PaulRB

Quote
I'm tempted to write my own bit-banging software to implement serial asynchronous communication,
I don't want to discourage you from reviving your old skills. Far from it. But no clever coding is going to fix this. The esp chip interrupts whatever is going on in order to maintain the WiFi connection to the router, and that is going to make the precise timing needed for a software serial implementation very difficult.

frank2644

PaulRB,  Agreed, the timing for a bit-banging routine could be upset by the existing ISR's.

Although it might be workable by limiting the BB function to the bare minimum and employing one slow slow speed (maybe 9600bps, no parity, etc.), and maybe only Rx since the eap8266 seems to have a workable Tx.

I'm thinking I could write an ISR that would basically only record the timestamp of every bit transition and another conventional routine would try and construct the 8 bit bytes from those timestamps.

Actually, instead of a timestamp a lower overhead method like ESP.getCycleCount() might be better.

Hopefully, the other ISR's would not lock out my ISR for more than a dozen, or so, microseconds, and not very often.

Anyway, it's kinds fun thinking about it, doing it is likely a lot tougher.

Frank

PaulRB

Does the Nextion allow different tx & rx rates? You wouldn't want to have to slow down the tx rate to match some slow Rx rate, that might make screen updates very slow.

Here's an idea. An SPI to serial converter. Or this one.

Juraj

Does the Nextion allow different tx & rx rates? You wouldn't want to have to slow down the tx rate to match some slow Rx rate, that might make screen updates very slow.

Here's an idea. An SPI to serial converter. Or this one.
the Arduino library for SC16IS750 is very slow. I wrote a better version but specialized for the old Uno WiFi. there the SC16IS750 was used to connect esp8266 to 328p

PerryBebbington


Quote
Does the Nextion allow different tx & rx rates?
If you mean does it allow the Tx rate and Rx rate to be different from each other; no. If you mean can it use different rates; yes.


PaulRB

does it allow the Tx rate and Rx rate to be different from each other; no
That's what I meant, and what I suspected. Frank was considering writing his own software serial with a slow baud rate that would not be too badly affected by WiFi-related interrupts on the ESP. But the consequence would be a slow tx baud to match the rx, which would make the Nextion slow to update.

PerryBebbington

Since the days of 75/1200 baud Prestel modems I can't ever remember seeing a serial port with asymmetric baud rates.

frank2644

PaulRB,

I think running the Nextion at 9600 bps is plenty fast for my purposes since I am just sending and receiving text characters. I suppose if I had to send graphics it would not be fast enough. Although I think the Nextion can store graphic images on it's SD card, so in that case 9600 is still probably fast enough. 9600 would have other drawbacks, like updating the Nextion software serially via the esp8266, but I don't plan on using that capability.

Your SP1/I2c Uart suggestion is a good one, and that inspired my idea to use another esp8266 for that purpose. Assuming the ESP can act as an SP1 or I2c slave as I think it can.

I'm still hoping the new serial software library will solve my problem, but I'm still having some problems with my IDE upgrade which is side tracking the testing of that library.

Frank

Go Up