-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added DMA control for UART messages #83
base: master
Are you sure you want to change the base?
Conversation
Sorry it has taken me so long to get to looking at this, today has been the first day I could do sat stuff for the past week. Tried out the test and it works. I think the task now is to replace the current serial sends with the DMA enabled versions. |
Looking at the technical reference manual (pg. 545)
I am guessing that waiting for the transfer complete interrupt to fire would cover this, but that should be confirmed. |
Very nice! As for considering replacing all SCI calls with the DMA version though, it may be the case that small transfers might still be quicker than having them done via DMA. Something to be tested and verified. |
I also think that the serialDMASend should wait for the DMA transfer interrupt to fire before returning which should stop this scenario:
Assuming my understanding of the whole thing is correct, this case should be rare/almost impossible since DMA transfer should be pretty fast. But I still think we should protect against it happening. It'll be a short wait compared to sending the bytes out individually, so still gets us the efficiency gain from using DMA. A couple of other things:
|
Ok so I tried this out and my wait for interrupt to fire point is something we need to watch for. If you do this: /* Setup null terminated string to transmit */
number_string((char *) buffer, 500);
scidmaSend(buffer);
buffer[300] = 'A';
scidmaSend(buffer); You end up with an "A" coming out the first UART transfer, meaning the buffer was updated before the DMA got around to piping byte 300 to the UART. This is a bit contrived since the buffer change should be atomic, but it shows the problem. |
Nice! This will be useful!
Also what was the message rewrite note that's in there? I don't recall what we discussed about that yesterday. |
It looks like it takes almost the same time to transmit a message using DMA and using regular SCI function so we could just replace the SCI Send function with a DMA one. |
9263758
to
152e9ba
Compare
Pull request addressing issue #36
Attached sample test program.
obc_sci_dma_test.txt