USART Flow Control with Atmel Start ATSAMD51N20A

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone,

 

Does anyone know what the trick is to get UART data with flow control going?  When I configure Atmel Start to NOT use flow control (i.e. MODE = UART) I can see data being sent out on TX pin with the code below.  But as soon as I configure Atmel Start configuration of USART_0 to use flow control (i.e. MODE = UART with flow control) I no longer get any data being transferred and no interrupts fire.

 

The UART (with flow control) is connected directly to a Microchip RN41 bluetooth module.  I believe the wires are connected correctly (I've looked at it a million times to make sure, but something has to be wrong):

 

QFP100 package of MCU.

 

ATSAMD51N20A pin RN41 Pin
CTS - PA25 - pin 75 input RTS - pin 15 output
RTS - PA24 - pin 74 output CTS - pin 16 input
RX - PB21 - pin 69 input TX - pin 14 output
TX - PB20 - pin 68 output RX - pin 13 input

 

I paused the debugger during execution and read the TXPO and RXPO config bits in the CTRLA register.  And that looked good when I decoded it.  Is there anything I else I need to call when using the Atmel Start Framework to get flow control to work?

 

James.

 

------------------

 

#include "main.h"

volatile bool UartTxFlag = 0;
volatile bool UartRxFlag = 0;

static void tx_cb_USART_0(const struct usart_async_descriptor *const io_descr)
{
    /* Transfer completed */
    UartTxFlag = 1;
    asm("nop");
}

static void rx_cb_USART_0(const struct usart_async_descriptor *const io_descr)
{
    /* string received */
    UartRxFlag = 1;
    asm("nop");
}

static     uint8_t example_USART_0[12] = "Hello World!";

int main(void)
{
    /* Initializes MCU, drivers and middleware */
    atmel_start_init();

    // enable tick timer
    tick_init();

    // register callback functions which also enables the interrupt
    usart_async_register_callback( &USART_0, USART_ASYNC_TXC_CB, tx_cb_USART_0 );
    usart_async_register_callback( &USART_0, USART_ASYNC_RXC_CB, rx_cb_USART_0 );
    // usart_async_register_callback(&USART_0, USART_ASYNC_ERROR_CB, err_cb);

    // now enable uart
    struct io_descriptor *io;
    usart_async_get_io_descriptor( &USART_0, &io );
    usart_async_enable( &USART_0 );


    io_write(io, example_USART_0, 12);

    /* Super-Loop */
    while (1)
    {
        
        uint32_t ii;
        tick_t ticks_now = tick_get();

        if( tick_get_diff( ticks_start, ticks_now) >= TICKS_500MS )
        {

            io_write(io, example_USART_0, 12);

            gpio_toggle_pin_level( nLED1 );
            gpio_toggle_pin_level( nLED2 );
            ticks_start = ticks_now;
        }
    } // super-loop()

} // main()