Closed rPraml closed 1 week ago
With reducing the build variants (no different builds for CDC and UART) this is a side effect of auto detecting how the MCU is connected to the PC. Since no SOF packets are detected on the HWCDC port the serial console is routed to an UART port. Yes that means only 2 UARTS are useable when the HWCDC port is not connected to a PC. By design. Not a bug.
Which I see as a problem
If I choose a CPU/Board where the USB/CDC is available for debug in order to dedicate every UART for external peripherals, what can I do to insure I will always have every UART available for those peripherals when USB is not plugged ?
I understand the need for a fallback mode in standard builds but how can I prevent that auto mode when I don't want it ?
Disable Tasmota console could be a way.
It would require a different build to debug (one with console) and run (without console) Having a #define which allows to disable the fallback (enforce CDC) and free all UART would be great
Disable Tasmota console could be a way.
How? I searched the docs and found only SerialLog 0
which woud disable the output.
What I need is, that the serial input is not processed here https://github.com/arendst/Tasmota/blob/development/tasmota/tasmota.ino#L812 and this can be done by setting TasmotaGlobal.serial_local = true
which is done only in ClaimSerial.
To summarize:
USE_USB_CDC_CONSOLE
- It seems, that I can use all 3 UARTs, if there is an USB-connection detected on boot.USE_USB_CDC_CONSOLE
. the ClaimSerial()
works as expected (it disables the serial console, when a driver uses the last UART. There was a commit (https://github.com/arendst/Tasmota/commit/d5a4f8441bfc0b98d6b482b684cc542d5ed4969b) that added this functionality to all drivers that were using uarts.I would expect, that the serial console is deactivated automatically, if I explicitly use the third uart by any driver... nevertheless if compiled with CDC console (and fallback) or not. So I'm unsure if this is
By design. Not a bug.
In this case, I would really appreciate a warning being printed here: Not claiming UART0 when CDC console is enabled
This would have saved me a lot of time ;)
Thanks, Roland
This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
Description:
When tasmota is compiled with
USE_USB_CDC_CONSOLE
, the ´ClaimSerial` method will return immediately and will not release UART0This makes sense, as long as USB is used for console, but if we fall back to serial, because no USB is connected, we must release the console, so that all 3 UARTs on the ESP32 can be used. (Possible broken since https://github.com/rPraml/Tasmota/commit/84ced0fcab6f3af26602cd8fc23df5ba7bcc8c1f)
In my case I tried to connect 3 SML meters to a ESP32 and I always had some garbage in the web console, when all 3 UARTs were used, as the serial data was read by the SML driver and the SerialConsole.
Related issue (if applicable): fixes #20324
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass