series1/i2s/i2s - LDMA Descriptors get deallocated while still being in use
Example path, file name, line number(s) series1/i2s/i2s/src/main_gg11.c line 144.
I've written the following paragraphs based on this specific example, but the same problem exists for other examples as well. I've gone over all examples for series 1 and have been able to also find the problem in:
series1/adc/adc_scan_letimer_prs_dma series1/adc/adc_scan_prs_gpio_dma series1/adc/adc_single_letimer_prs_dma series1/adc/adc_single_prs_gpio_dma
Expected behavior LDMA descriptors for both right and left channels should be saved in static memory.
Observed/problematic behavior LDMA descriptors are currently allocated in automatic memory which gets deallocated after the DMA operation is initialized. Therefore, on each new iteraton of the left and right sound DMA channels, new descriptors are loaded by the LDMA periphary from deallocated memory. If this memory gets corrupted at some point (which is exactly what happened to me when I programmed based on this example), the chip goes to the DefaultHandler (so I guess an exception is raised).
Additional context When using an LDMA descriptor in linked mode, the LDMA loads the next descriptor from memory (RAM/Flash) each time it finishes with the current descriptor. Even when setting the descriptor in a relative link mode with the address being 0 (which is used for looping the same descriptor an infinite amount of times), the descriptor gets loaded from memory on each new "iteraton". Therefore, the descriptor must remain intact and allocated in memory until the DMA operaton is done.