ADC icon indicating copy to clipboard operation
ADC copied to clipboard

DMA ringbuffer fills only half the buffer

Open vincent-esperance opened this issue 9 years ago • 1 comments

Hi,

If you try the DMA ringbuffer with the Teensy 3.1, it does not work as expected : only half the buffer is filled, I think that the correction needs to be done on line 85, you should have 2 * b_size for the second argument which I believe is in bytes, the comment is already pointing to that possible issue

dmaChannel->destinationCircular((uint16_t_)p_elems, 2 * b_size); // 2_b_size is necessary for some reason

There is a side effect if you set this to 2 * b_size, the IsFull function as written now detect the half-full condition .. I am not completely clear on how to use the IsEmpy and IsFull function, it would be more convenient to have a function telling you what is the present level of the buffer.

Anyway, the package is very interesting and usefull some comments could improve its usage

Yours Vincent

vincent-esperance avatar Feb 27 '16 13:02 vincent-esperance

I'm rewriting the whole DMA thing. As you rightly point out it doesn't really work. The new DMARingBuffer will be a ping pong buffer and the RingBuffer will be a software-only circular buffer.

pedvide avatar Nov 19 '16 11:11 pedvide