Atmel start uart rx callback not firing SAMC21 xplained pro

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using Atmel start with the SAMC21 xplained pro evaluation board and I've added a Asynchronous UART driver with core clock set the internal 48Mhz and the slow clock set to the 32.768Kz High accuracy internal oscillator.   I'm really after using the RX callback feature to service the RX UART buffer by setting a flag which is polled in the main application.  On the evaluation board I'm using SERCOM3 PA23-RX and PA22-TX and currently I have a loopback on those two pins, the baud settings are 8,N,1,115.2K.  I'm trying to run the generated code from Atmel Start in driver examples file.  In main I'm calling  USART_0_example();  I'm still sending static uint8_t example_USART_0[12] = "Hello World!";   I have scope on the Transmit pin and it in fact is sending a byte, I have looked at it in great detail to see exactly what it is.

 

The generated code from Atmel start has a TX callback defined and an RX callback commented out.  I changed that around for my application, I don't care about the TX callback and I really want the RX callback ISR.  I set a breakpoint in the RX callback and it's not getting hit?  I realize it might be a couple of things, maybe the loopback is the issue? but I've done that before on other devices?

 

Any help is greatly appreciated.

static void rx_cb(const struct usart_async_descriptor *const io_descr)


{

uint8_t in_char = 0;

struct io_descriptor *io;

// get received char

usart_async_get_io_descriptor(&USART_0, &io);

io_read(io, (uint8_t *const)in_char, 1);

}

void USART_0_example(void)

{

struct io_descriptor *io;

//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_async_register_callback(&USART_0, USART_ASYNC_ERROR_CB, err_cb); 

usart_async_get_io_descriptor(&USART_0, &io);

usart_async_enable(&USART_0);

io_write(io, example_USART_0, 12);

}

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I solved my own problem, in Atmel start there is an option in the advanced settings to enable start bit detection.  It's working now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI,

 

I am also trying same example it is triggering rx_cb but not returning the rx_cb to main. i need to process the received data into main how can i do?? please help me if u know

Megha