Question: We re receiving data over a UART without a DMA, so a simple RX shift register is getting individual bits clocked into the receiver at
Were receiving data over a UART without a DMA, so a simple RX shift register is getting individual bits clocked into the receiver at the links baud rate. When a full byte arrives, we get an interrupt and must read the register before the next byte starts getting clocked in or well get an overrun error from the UART. We also cant immediately process the byte; we need to save it for later. Eventually, the firmware application will get around to asking how many bytes have arrived and, if enough are present, will read them out and process them.
Please sketch out the API for the data structure you would use to accumulate these received bytes from the UART for later retrieval. Assume that theres a UART RX interrupt that uses your data structures API to say hey I just got a byte from over there, please hang on to it for me
What does the data structures API look like for storing newlyreceived bytes from the ISR?
What does the data structures API look like, that the application uses to retrieve a buffer of N bytes?
If theres memory involved, who provides it to the data structure?
If you have time, try implementing it
If you have more time, try changing it from receiving one byte at a time shift register to receiving N bytes at a time DMA
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
