System: C6748, LCDKC6748. SYS BIOS used.
I have a stream of 4096 bytes incoming from a host into UART port. Currently, my UART Interrupt Service Routine is receiving all the byte stream inside the Hwi-ISR., using a for loop and a counter
What flag should I use to distinguish between two consecutive bytes ?LSR[DR] flag or IIR[INTID]??
The problem is that all interrupts are masked once UART enters the ISR and technical reference manual suggests that above mentioned flags will be set only if their corresponding bits in IER are enabled. This is my code now
int j = 0; for (i = 0; i < loopSize; i++) { //Loopsize = 1024 COEFFS_L[i] = 0; for (j = (wordSize - 1); j >= 0; j--) { //wordsize = 4 for a 32-bit value USTIMER_delay(120); // CPU waits between two consecutive bytes rxByte[0] = UART2Read(); // Read from RBR register COEFFS_L[i] |= ((int32_t) rxByte[0] << (j * 8)); //Received MSB first LSB later, left shift byte per byte } }
If there is no other choice, i could push the routine of receiving byte stream into SWI or Task, using my own set of flags in the program. But if there is a flag that toggles as RBR register is getting filled (even when Interrupts are held), that would be great :)
For example, instead of delay function, could i use?
while(uart2->LSR & 0x00000001 == 0);