Hi all!
Here's a neat hack to make a second UART using timer and gpio interrupts and use it as a debugging console for the VS1005 when you need the hardware UART for communicating with external equipment. Simply load this driver instead of UARTIN driver. It creates another UART to pins D2 (TX) and D3 (RX) and sets stdin and stdout to use those pins. stderr still points to the hardware UART so you can use both (it's really easy to change this in the source code).
The UART works at 115200 speed, and at that speed it's not 100% error free in receiving characters when there are other interrupts running - there's the occasional bit error now and then, but it's more than good enough for giving commands on the shell. You can change it to 38400 bps by modifying TIMER_CYCLES from 52 to 160 in the source code.
Below you can see an image of the VS1005 booting. The left terminal is the hardware UART and the right terminal shows the softare UART and a DIR command being run on the software UART.
There's no buffering in the code for the software uart, but that would be easy to add. As is, the code is OK for debugging-as-needed and for further development.
Have fun!
-Panu
Second UART for debugging VS1005 projects
Second UART for debugging VS1005 projects
- Attachments
-
- uartdual.dl3
- Driver for implementing two uarts; the traditional hardware UART and another software UART in pins D2, D3 for debugging. VSOS/VS1005 DL3 driver, load from config.txt instead of UARTIN
- (4.57 KiB) Downloaded 148 times
-
- arch-uartdual-2021-03-05-09-59-RC1.zip
- Source code, VSIDE Solution
- (11.3 KiB) Downloaded 155 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo