USART ISR help needed

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

Posts: 2
Joined: Mon Feb 02, 2015 9:19 pm

USART ISR help needed

Thu Apr 23, 2015 10:06 pm

:evil: I"m running an interrupt driven usart on a sam4e8e and I'm having issues with data integrity loss.  I've created an empty project and only added USART and systick.  I put a circular buffer in the USART handler for the read.  If i send data packets of 42 or less bytes all the bytes come over fine.  If i send more hten 42 bytes back to back every byte after 42 is garbage data.  My while(1) in main is empty.  Any help would be great since I've messaged Atmel support with a ticket and they are beyond useless.  there response was to either turn off the interrupt or just look at the example.  From my testing their example code does the same thing.

Code: Select all

#define RX_BUFFER_SIZE						384	//size of RX fifo buffer
static unsigned char rx_buff[RX_BUFFER_SIZE];	//rx fifo buffer
static int rx_head_location_in_buff = 0;

void USART_Handler(void)
	uint32_t ul_status;

	/* Read USART Status. */
	ul_status = usart_get_status(USART_SERIAL);

	/* Transfer without PDC. */
	if (ul_status & US_CSR_RXRDY) 
		usart_read(USART_SERIAL, &rx_read_data);
		rx_buff[rx_head_location_in_buff++] = rx_read_data;
		if(rx_head_location_in_buff == RX_BUFFER_SIZE)
			rx_head_location_in_buff = 0;
 I"m running my serial at 38400, 8 , n, 1.

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 2 guests