Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libfx2-migration: serial examples #50

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

jedrzejboczar
Copy link

This is a part of splitting #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.

@todo
Copy link

todo bot commented Jan 8, 2020

now PB0 and PA0 are still hard-coded in parts of implementation

// TODO: now PB0 and PA0 are still hard-coded in parts of implementation
// this is the most problematic with RX as we need external interrupt
# if !defined(UART_TX_PIN)
# error "UART_TX_PIN must be defined (e.g. as PB0)"
# endif
# if !defined(UART_RX_PIN)


This comment was generated by todo based on a TODO comment in 7548a73 in #50. cc @antmicro.

@todo
Copy link

todo bot commented Jan 8, 2020

is it that when =0, RI will fire even with invalid stop bit?

SM2_0 = 0; // TODO: is it that when =0, RI will fire even with invalid stop bit?
REN_0 = 1; // enable reception
// do not set baud rate doubler: // PCON |= _SMOD0;
// clear interrupt flags


This comment was generated by todo based on a TODO comment in 7548a73 in #50. cc @antmicro.

@todo
Copy link

todo bot commented Jan 8, 2020

make clock two times slower when not in full-duplex mode

// TODO: make clock two times slower when not in full-duplex mode
if (uart.clk_phase == CLK_TX) {
uart.clk_phase = CLK_RX;
if (uart.mode != UART_MODE_RX) {
// transmit state machine


This comment was generated by todo based on a TODO comment in 7548a73 in #50. cc @antmicro.

@todo
Copy link

todo bot commented Jan 8, 2020

is it that when =0, RI will fire even with invalid stop bit?

SM2_0 = 0; // TODO: is it that when =0, RI will fire even with invalid stop bit?
REN_0 = 1; // enable reception
// do not set baud rate doubler: // PCON |= _SMOD0;
// clear interrupt flags


This comment was generated by todo based on a TODO comment in faea5c5 in #50. cc @antmicro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant