-  Receive 4-byte on usart0 store in bufferA.(ENDRX interrupt routine fired)
-  Based on 4th byte i should change the Receive Next Counter Register
-  THEN enable the RXBUFF interrupt so i get data with specified lenght and put them in the next buffer: bufferB
bufferA ________________________________ bufferB
0x01 0x23 0x11 0x05 ---so i need to get 5 bytes-> ? ? ? ? ?
0x01 0x07 0x42 0x03 ---so i need to get 3 bytes-> ? ? ?
In the ISR i have :
Code: Select all
// we have a end-of-receive interrupt (ENDRX) /// pUsart0->US_RCR = 4; // i commented this line so it don't restore the receive count - so ENDRX flag not cleared pUsart0->US_RNCR = (unsigned int)bufferA ; // set the next counter register based on 4th byte of received data /// disable the end-of-receive interrupt, enable the RXBUFF (both receive buffer full) interrupt pUsart0->US_IER = AT91C_US_RXBUFF; // enable usart0 RXBUFF interrupt pUsart0->US_IDR = ~AT91C_US_RXBUFF; // disable all interrupts except RXBUFF // enable receive DMA transfers pUsart0->US_PTCR = AT91C_PDC_RXTEN | // enable receive transfer, AT91C_PDC_TXTDIS; // disable transmit transfer
Whats my problem? any suggestion?