usb-uart example sketch and some thoughts about uart
Posted: Fri Dec 20, 2019 6:11 am
hi all,
i've released an 'example' sketch for usb-uart bridging with signals
https://github.com/rogerclarkmelbourne/ ... -w-signals
digging through the (libmaple) codes, i found that it is pretty much possible to handle the various low level usb requests (commands) from the host.
in particular SetControlLineState (DTR, RTS) and SetLineCoding (baud, data bits, stop bits, parity).
the commands/requests are defined in the USB-CDC-ACM device class specifications
https://www.usb.org/document-library/cl ... devices-12
These are integrated into the 'example' sketch and i think pretty much makes is work the same as the common usb-uart dongles.
there are a couple of motivations for writing this though of course usb-uart dongles these days are 'very' cheap
https://www.aliexpress.com/wholesale?ca ... ext=cp2102
one of which is that such a sketch is firmware/software, so that same bp/mm board can be repurposed as needed. kind of making it more 'efficient' as common usb-uart dongles just does that usb-uart dongles. while bp/mm warp between usb-uart to a full blown mini 'oscilloscope' etc and many different use cases. the other thing is that since stm32f103 sits 'between' as the usb-uart bridge, it isn't simply a usb-uart bridge.
my sketch implements a 'command processor' and therefore provides a means to add functionality that may otherwise not be there and isn't addressed by conventional usb-uart interfaces.
i've actually used this sketch among my trials to flash firmware on (other) stm32f103 (mm/bp) as well as esp-01 (esp8266). and that 'command processor' i basically used it as a 'shortcut command' interface while testing out esp-01 esp8266 functionality. the AT commands are rather verbose and making shortcuts for some of them makes it easier to test embryonic protocol steps from the host via a serial monitor.
i've released an 'example' sketch for usb-uart bridging with signals
https://github.com/rogerclarkmelbourne/ ... -w-signals
digging through the (libmaple) codes, i found that it is pretty much possible to handle the various low level usb requests (commands) from the host.
in particular SetControlLineState (DTR, RTS) and SetLineCoding (baud, data bits, stop bits, parity).
the commands/requests are defined in the USB-CDC-ACM device class specifications
https://www.usb.org/document-library/cl ... devices-12
These are integrated into the 'example' sketch and i think pretty much makes is work the same as the common usb-uart dongles.
there are a couple of motivations for writing this though of course usb-uart dongles these days are 'very' cheap
https://www.aliexpress.com/wholesale?ca ... ext=cp2102
one of which is that such a sketch is firmware/software, so that same bp/mm board can be repurposed as needed. kind of making it more 'efficient' as common usb-uart dongles just does that usb-uart dongles. while bp/mm warp between usb-uart to a full blown mini 'oscilloscope' etc and many different use cases. the other thing is that since stm32f103 sits 'between' as the usb-uart bridge, it isn't simply a usb-uart bridge.
my sketch implements a 'command processor' and therefore provides a means to add functionality that may otherwise not be there and isn't addressed by conventional usb-uart interfaces.
i've actually used this sketch among my trials to flash firmware on (other) stm32f103 (mm/bp) as well as esp-01 (esp8266). and that 'command processor' i basically used it as a 'shortcut command' interface while testing out esp-01 esp8266 functionality. the AT commands are rather verbose and making shortcuts for some of them makes it easier to test embryonic protocol steps from the host via a serial monitor.