plieningerweb / esp8266-software-uart

Software UART / Software Serial / SoftUart for ESP8266 to connect more than one UART
MIT License
123 stars 42 forks source link

I want to share a wrapper I wrote to be able to use this software with Esp8266 Arduino #16

Open juancgalvez opened 5 years ago

juancgalvez commented 5 years ago

This is not a issue. I just want to share the wrapper I wrote to be able to use this software with Esp8266 Arduino. It can be found here.

I did some modifications to this software to allow higher speeds and better timing. Basically, changed the use of system_get_time() for the use of CCOUNT in a new function get_ccount(). This allow a higher granularity and better accuracy when timing. I did tests transmitting at 230400 bps without issues. Didn't test reception. Tests with 80Mhz and 160Mhz clock frequencies were done.

Additionally I calculate overhead time (The time consumed by instructions before starting the timing of bits) in receive interrupt function to position better at the middle of a each bit. I didn't consider the delays mentioned in the following paragraph.

I used a logic analyzer and noticed that most of the time the interrupt code starts execution after 1 or 2 microseconds after the pin state changed. This is the best. But, some times there is a delay of 12 or more microseconds. This high delay can cause problems at speeds like 115300 bps or even lower where bits are lost causing invalid data.