Disable console to UART0 (to use UART0 for other purposes)
-
How do I go about programmatically disabling console I/O to UART0? In production, I don't want the console to be there at all, and at the same time, I want to use UART0 to communicate with a serial device.
Note: I say "programmatically" because I want to be able to select console or no console during boot-up (initially disabled, but enabled in boot.py if a particular input put is held low, for example).
-
@Eric24
The debug messages at startup, before the micropython interpreter starts, are not stopped, but this is not a problem for me.
No further debug messages are output once the python interpreter is started, unless the system throws an error.The startup debug messages are output at 115kbs.
To stop the debug messages, my understanding is that one can compile a custom image with debug messages disabled, but I have not attempted this as they are not hampering my application.
-
@Shaun Are you able to stop the debug messages, too? Based on my experience (and as @robert-hh mentions), I didn't think they could currently be disabled.
-
@RobTuDelft I assume that would be the case (I haven't had a chance to test it yet), but looking at os.dupterm(None), I would think you could still Telnet into the device.
-
Ah great, didn't actually test this yet.
Would it be possible to have all UARTs available and instead replicate the REPL over a websocket?
-
@RobTuDelft
Yes. I disable the REPL in boot.py and then use all three UARTS in my application. I use UART0 to communicate with a computer and UART1 & 2 to communicate with sensor networks.
-
@robert-hh Does disabling the REPL prompt free up the UART?
-
@Eric24 The are two aspects, REPL prompt and debug messages. The REPL prompt on the console is enabled in _boot.py with os.dupterm() and can be disableb with os.dupterm(None).
The debug messages are told to be disabled some time in one of the next versions.