libfx2-migration: serial examples
This is a part of splitting https://github.com/timvideos/HDMI2USB-fx2-firmware/pull/47 into smaller PRs.
This PR is a minimal set of changes that adds serial examples:
- cdc-loopback: simple internal loopback almost identical to cdc-acm example in libfx2
- serial-loopback: sends a message over UART TX, receives it on UART RX and sends back to USB host
- serial-cdc-loopback: passes any data received from USB host to UART TX (with some minor data modifications), passes any data received from UART RX to USB host
Examples are located in examples/. Each comes with a Makefile and README.md. Examples that use UART can be compiled either using software bitbanged UART or hardware UART (FX2 serial port 0).
Bitbanged pins will are not yet fully configurable. While configuring TX pin is not a big problem, RX pin uses external interrupt for clock synchronization, so we will be able to choose only between PA0 and PA1.
Common code is located in common/. It includes consists of implementations of CDC-ACM and UART.
Most files from master have been left intact to avoid cluttering the PR diff.
now PB0 and PA0 are still hard-coded in parts of implementation
https://github.com/timvideos/HDMI2USB-fx2-firmware/blob/7548a730016c1751a79838fb47753e36ce55dda1/common/uart.h#L11-L16
This comment was generated by todo based on a TODO comment in 7548a730016c1751a79838fb47753e36ce55dda1 in #50. cc @antmicro.
is it that when =0, RI will fire even with invalid stop bit?
https://github.com/timvideos/HDMI2USB-fx2-firmware/blob/7548a730016c1751a79838fb47753e36ce55dda1/common/uart_hard.c#L23-L28
This comment was generated by todo based on a TODO comment in 7548a730016c1751a79838fb47753e36ce55dda1 in #50. cc @antmicro.
make clock two times slower when not in full-duplex mode
https://github.com/timvideos/HDMI2USB-fx2-firmware/blob/7548a730016c1751a79838fb47753e36ce55dda1/common/uart_soft.c#L105-L110
This comment was generated by todo based on a TODO comment in 7548a730016c1751a79838fb47753e36ce55dda1 in #50. cc @antmicro.
is it that when =0, RI will fire even with invalid stop bit?
https://github.com/timvideos/HDMI2USB-fx2-firmware/blob/faea5c5a5f2e0a642018b90eb9c7ad834ccd0551/common/uart_hard.c#L23-L28