xRingbufferSendAcquire with byte buffer
Posted: Tue Aug 29, 2023 3:10 pm
Hi,
I am experimenting with ring buffers for transmitting SPI data between tasks.
I first create a contiguous, DMA-capable and 32-bit aligned memory region; then use that memory region to create a ring buffer.
When I try to take out a chunk of memory from the ring buffer to use as the SPI RX buffer,
it seems that xRingbufferSendAcquire does not work on byte buffers? Is there a workaround for this issue? Any help would be much appreciated.
Best,
Simon
I am experimenting with ring buffers for transmitting SPI data between tasks.
I first create a contiguous, DMA-capable and 32-bit aligned memory region; then use that memory region to create a ring buffer.
Code: Select all
StaticRingbuffer_t *buffer_struct = (StaticRingbuffer_t *)heap_caps_malloc(sizeof(StaticRingbuffer_t), MALLOC_CAP_DEFAULT);
uint8_t *buffer_storage= (uint8_t *)heap_caps_malloc(sizeof(uint8_t)*1024, MALLOC_CAP_DMA);
// Then create ring buffers with manually allocated memory
afe1_ring_buffer_handle = xRingbufferCreateStatic(1024, RINGBUF_TYPE_BYTEBUF, buffer_storage, buffer_struct);
if (afe1_ring_buffer_handle == NULL)
ESP_LOGE(TAG, "Failed to create ring buffer\n");
Code: Select all
BaseType_t ret = xRingbufferSendAcquire(in_args->ringBufHandle, &fifo_buffer, 3*128, portMAX_DELAY);
Best,
Simon