2024-06-23 09:57 PM
Hello,
I have configured SPI Slave Receive only with Circular DMA, and I can receive data fine.
My problem is that I want to have the current receive index on the SPI DMA Buffer when I receive an external interrupt
I try to use StreamIndex but it show always the same value...
How do I get the current positioning of the received buffer
Thanks
Vincent
2024-06-24 01:11 AM
I tried to use &hspi3.hdmarx->Instance->NDTR;
but it is not giving me right result.
before the start of the receive transfer I cleaned the buffer with 0
I only send FF
I know that I received 152 bytes (last bytes before next 0).
How do I get the received buffer index, position, size when I stop the DMA
Vincent
2024-06-24 10:23 AM
> I tried to use &hspi3.hdmarx->Instance->NDTR; but it is not giving me right result.
And what result does it give?
That's the proper method, just realize, that NDTR counts from its initial value downwards.
(There is a caveat, if you attempt to read the newest item in the buffer too soon after reading NDTR, it may not be there yet. )
JW
2024-06-24 10:30 AM
Hello Jan,
ok for the downwards for receive, it is the same for the NDTR on send ?
Thanks
Vincent