Chat freely about anything...

User avatar
By zain.mir
#27055 I need an additional uart link on my esp8266 to communicate with an arduino at baud rate 115200 using the additional GPIOs. A quick google search only revealed a softuart library on git [https://github.com/plieningerweb/esp8266-software-uart], which I tested and it works but not for a 115200 baud rate. If it is possible, a point in the right direction would be much appreciated. Thanks.
User avatar
By eriksl
#28607 The esp8266 has two UARTS, but none of them can be multiplexed to GPIO4 and GPIO5.

There is a document that states which pin can be multiplexed to what function, I'd suggest you read that first ;)
User avatar
By dkinzer
#28624
zain.mir wrote: softuart library [...] works but not for a 115200 baud rate.
At 115.2K baud the bit time is 8.68uS. That's only 694 CPU cycles at 80MHz. I've operated my SW UART code at 115.2K transmiting but reception is dicey at best at that speed. Lower baud rates are more likely to work because there is more "room" to allow for system NMI servicing, system call overhead, etc.

You might be able to get the code you referred to to work if you change the CPU speed to 160MHz. You might also be able to modify the referenced code so that it is more efficient. Some possibilities:
    o Strip it down to support a single SW UART.
    o Change pin I/O to support only the two pins you want thus eliminating the table lookup.
    o Read the RTC Timer2 register directly rather than calling system_get_time(). I haven't looked at system_get_time() to see how much overhead it adds.
    o Eliminate RS485 support and everthing else you don't need.
If none of that works and you still insist on using 115.2K baud you'll probably have to add an external UART chip.