PDA

View Full Version : Differences between Serial1 and Serial2 on teensy 3.x



bill.pugh
03-16-2014, 07:05 PM
I've been taking a careful look at the Serial code for the teensy 3.x.

I think I understand some differences, and these changes have associated bugs:


The function set_transmit_pin is only defined for Serial1. It looks like if you call Serial2/3.transmitterEnable, you call the serial_set_transmit_pin function for Serial1, and there is no serial_set_transmit_pin functionality for Serial2/3 (very confusing).

I think there might be a bug in how Serial2/3 handle use9Bits in putchar.

for Serial1, both UART0_C3 and UART0_D are written to when use9Bits is true
for Serial2/3, just UART1_D/UART2_D is written to.



I think most of the other changes are due to the use of FIFO buffers for Serial1, but I don't understand the functional impact of those changes. If this provides additional functionality/performance, could it be added to Serial2/3?


Serial1 has a specialized/optimized serial_write, Serial2 just calls putchar
Serial1 sets UART_C1_ILT
Serial1 sets UART0_PFIFO to UART_PFIFO_TXFE | UART_PFIFO_RXFE
Serial1.clear() sets UART0_CFIFO = UART_CFIFO_RXFLUSH;
Significant differences in uart_status_isr


Thanks for any thoughts/ideas/clarifications.

Bill