Serial DMA buffer position
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-15 8:43 AM
Hi,
I am developing an application on SPC58EC that uses the serial with DMA for reading.
I'd like to know if there is a way to know and get the position where it's writing in the buffer. I mean something like the corresponding "__HAL_DMA_GET_COUNTER(...)" or to the "...->CNDTR" register of the STM32.
I already use the receive callback that trigger at the end, but it's not enough for my purpose.
Thanks,
Rob
Solved! Go to Solution.
- Labels:
-
DMA
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-21 7:09 AM
hi Rob,
I confirm that there is not such a command in the driver to get the writing position in the buffer.
One idea would be to extract it from the running task.
If we look at the serial peripheral configuration sd_rx/tx_dma, we shall find the following DMA setup: t
edmaChannelSetup(
sdp->rx_channel, /* channel. */
((vuint32_t)&sdp->linflexlp->BDRM) + 3U, /* src. */
rxbuf, /* dst. */
0, /* soff, do not advance. */
1, /* doff, advance by 1. */
0, /* ssize, 8 bits transfers. */
0, /* dsize, 8 bits transfers. */
1, /* nbytes, always one. */
n, /* iter. */
0, /* slast, no source adjust. */
0, /* dlast, no dest.adjust. */
EDMA_TCD_MODE_DREQ | EDMA_TCD_MODE_INT_END); /* mode. */
It should be sufficient to extract the information from "iter" from the DMA running node. This value should be decremented with every transmission.
Num_bytes_transferred = 1 * edmaGetTCD(***).n
I hope this could work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-21 7:09 AM
hi Rob,
I confirm that there is not such a command in the driver to get the writing position in the buffer.
One idea would be to extract it from the running task.
If we look at the serial peripheral configuration sd_rx/tx_dma, we shall find the following DMA setup: t
edmaChannelSetup(
sdp->rx_channel, /* channel. */
((vuint32_t)&sdp->linflexlp->BDRM) + 3U, /* src. */
rxbuf, /* dst. */
0, /* soff, do not advance. */
1, /* doff, advance by 1. */
0, /* ssize, 8 bits transfers. */
0, /* dsize, 8 bits transfers. */
1, /* nbytes, always one. */
n, /* iter. */
0, /* slast, no source adjust. */
0, /* dlast, no dest.adjust. */
EDMA_TCD_MODE_DREQ | EDMA_TCD_MODE_INT_END); /* mode. */
It should be sufficient to extract the information from "iter" from the DMA running node. This value should be decremented with every transmission.
Num_bytes_transferred = 1 * edmaGetTCD(***).n
I hope this could work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-27 6:01 AM
Thank you, this works for my purpouse.
Best regards.
