ESP8266/NodeMcu Uploading Problem Part 1 (Overrun)
petermeigs wrote: ↑
Sat Oct 06, 2018 10:45 pm
tlfong01 wrote: ↑
Sat Oct 06, 2018 5:16 am
1. I forgot what exactly is 'overrun'.
1. a simple uart chip, you will get an interrupt telling you that a character is available to process. You have until the next character arrives to read that character and clear the interrupt. If you don't read a character in time, you lose it.
2. modern uarts have a buffer so that several characters can be processed in a single interrupt. However, if the character arrival rate is faster than the processing rate for a sustained period of time, the queuing resources available to stack up characters to be processed later will be exhausted because there is no "later"
3. In order words, in the average input rate is greater than the average processing rate, you are in trouble. In fact, in a system with highly random arrival rates for characters, you would be happy if you can process a 50% rate. This is a little surprising but consider if you are close to 100%. If you get behind, you never have time to catch up.
4. So for our esp8266, it has to receive the characters, buffer them and then do something with them. If you have echo turned on, theres that much more to do for every character.'
Many thanks for your UART chip explanation. Now I am not so confused. Let me summarize.
1. Old days UART chip only process one character at a time.
2. Nowadays UART chip has a buffer (I guess 1 to 64 characters long FIFO queue/stack). UART chip input characters as they come from Rx wire and queue them into the buffer. At the same time UART output characters from the buffer to the Tx wire. If characters come quicker than ESP can handle, then we have buffer/stack/queue overflow, or overrun
3. I know we can control the character flow by the RTS (Request to Send), CTS (Clear To Send) control signals. But for ESP8266/NodeMcu boards, the RTS and CTS (actually RTS and DTR) signals are not used to control the character flow, but to control the ESP8266 hardware (chip reset and flash mode).
4. In other words, we cannot used RTS and CTS to control the flow.
5. But if we can lower the baud rate from say 115,200 to 9,600, or even 4,800, then ESP can have enough time to process the characters (moving them from UART chip to flash perhaps), then the upload software will be solved?
6. I noticed that the ESP8266 uploader, NodeMcu uploader, ESPlorer has a lowest rate of 9k6 or 115k2, so we cannot lower the data rate to solve the problem.
7. Of course we can write Arduino C++, NodeMcu LUA/C/C++ programs to do software or hardware RTS/CTS sort of control. But that would be very messy, and I am not capable or interested to learn how to do that.
I might need to think harder, or google further, ...
/ to continue, ...