1

Can anyone help me get the Atmel ATSAME70 ARM M7 USART receive timeout to work?

My USART is sending and receiving correctly, at 115200 baud. I'm using the ASF library, and set the Rx Timeout as follows:

#define TBUS_RX_TIMEOUT_MS 200
usart_set_rx_timeout(USART0, UART_BAUDRATE * RX_TIMEOUT_MS / 1000);

I verify that the TO value is set correctly in US_RTOR register.

I then start the timeout using this call:

usart_restart_rx_timeout(USART0);

There is no traffic on the serial bus at this point, so I expected the TIMEOUT flag to be set. It never gets set.

Is there anything else required to get the timeout to trigger?

David
  • 41
  • 6
  • Is the interrupt enable? Try add `usart_enable_interrupt(USART0, US_IER_TIMEOUT);` – LPs May 04 '17 at 06:48
  • Thanks very much. Yes, the interrupt is enabled. I added the IER timeout to the preexisting mask as follows: `usart_enable_interrupt(TBUS_UART, UART_IER_RXRDY | UART_IER_FRAME | UART_IER_OVRE | US_IER_TIMEOUT);` All the other interrupts are triggered, just not the timeout. – David May 04 '17 at 23:02

1 Answers1

0

The timer issue is caused by this serial bus having an inverted idle state.

The datasheet states that the counter is reset when a "Character Received" event occurs. This is not the full picture. My tests show that the counter resets whenever there is a space voltage on the wire.

With this new understanding, the timer is working correctly, and cannot be used to detect timeouts with inverted idle-state (ie. non-standard) serial bus.

David
  • 41
  • 6