Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By hreintke
#36007 Piperpilot,

Although there in indeed "HardwareSerial::HardwareSerial(const int uartPort)" in HardwareSerial, the actual implementation does NOT have the required code to use multiple Uarts.

It will need serious adding/rewriting in interrupt/receive and writing code.

It can be placed on the enhancement list for Sming, but then we would also need someone to implement.

May you and @festlv can work together on this. I know festlv has knowledge of uart code as he fixed an out of bounds error in there recently.

Herman
User avatar
By festlv
#36186 Hehe, I actually bookmarked this post in order to see if there's an easy fix for this- it appears not.

Getting debug output on second UART is actually the next thing in my list, because I can't have debug output cluttering primary UART for my app.
User avatar
By festlv
#36238 I got the second UART running and am able to have debug output there.
There is still some debug output on the UART0 (some of it comes from ROM bootloader), but at least I am able to have the debugf not interfere with UART0.

I actually feel a bit ashamed about the way I got it running- I merged in HardwareSerial plus some other small bits from esp8266/Arduino.

Adding a 2nd fully functional UART to Sming would involve rewriting Sming's HardwareSerial anyway because the current version depends on UartDev in ROM, and I didn't see an easy way to access second UART the same way.

Anyway, my code is here: https://github.com/festlv/Sming/commit/ ... ac93fca201

Beware, there are definitely rough edges and it's not 100% compatible with Sming's HardwareSerial (namely, CommandExecutor and Delegate parts, which I don't care about).

Usage:
Code: Select allvoid init() {
    Serial1.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
    Serial.begin(57600);
    Serial.systemDebugOutput(false);
    Serial1.systemDebugOutput(true);
    debugf("This now goes out to GPIO2");
}
User avatar
By festlv
#36353 Well, I knew it wasn't going to be so easy- the approach above appears to work initially but causes wdt resets if printing lot's of data.