I would like to know what would happen if a Serial Terminal were to send a large amount of data to a PIC/AVR, for example over USART interrupt, which was then interrupted by a higher priority interrupt like a timer, which would postpone the data transfer. Would the data be lost? Or does the Serial Terminal have a buffer before sending, and hold on to the data until we go back to the receive interrupt?
For exmaple I am using an atxmega128a1, and am using this interrupt to receive bytes:
//interrupt to receive a byte
ISR(USARTC0_RXC_vect){ //ISR for when receive flag is set
if(FIFO_Put(&RxFIFO, USARTC0_DATA)){ //put data into receive FIFO
USARTC0_STATUS |= USART_RXCIF_bm; //write 1 to clear bit
}
}
If I send a large amount of bytes over a serial terminal at one time, this interrupt will trigger many times to receive every byte.
I also have a timer interrupt of a higher priority which may take a long time to complete:
ISR(TCC0_OVF_vect){
AXISid n = X;
static BOOL cycle;
TimerAxisInterrupt(n, &cycle);
}
To re-iterate, my question is, if the higher priority interrupt occurs during a large data receive transfer, will any data be lost?
If relevant: I am sending the USART data over rs232 using a max3232 logic converter. I have the handshaking lines and RTS CTS lines looped such that i am only using the Rx and Tx lines.