Oct 31, 2022
05:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 31, 2022
05:29 PM
I am using the digital microphones on CY8CPROTO-062-4343W and having a problem when using the DMA to transfer data from the PDM to memory. I have the following code to setup the PDM
/* Initialize the PDM/PCM block */
active_rx_buffer = audio_frame0;
full_rx_buffer = audio_frame1;
cyhal_pdm_pcm_init(&pdm_pcm, PDM_DATA, PDM_CLK, &audio_clock, &pdm_pcm_cfg);
cyhal_pdm_pcm_register_callback(&pdm_pcm, pdm_pcm_isr_handler, NULL);
// cyhal_pdm_pcm_set_async_mode(&pdm_pcm, CYHAL_ASYNC_DMA, CYHAL_DMA_PRIORITY_DEFAULT); // turn on DMA, currently broken
cyhal_pdm_pcm_enable_event(&pdm_pcm, CYHAL_PDM_PCM_ASYNC_COMPLETE, CYHAL_ISR_PRIORITY_DEFAULT, true);
cyhal_pdm_pcm_start(&pdm_pcm);
cyhal_pdm_pcm_read_async(&pdm_pcm, active_rx_buffer, FRAME_SIZE); // trigger the first packet
The remainder of the code is similar to the code in Github posted here: https://github.com/infineon/mtb-example-psoc6-pdm-pcm two days ago, and snippet 2 posted here: https://infineon.github.io/mtb-hal-cat1/html/group__group__hal__pdmpcm.html.
When the cyhal_pdm_pcm_set_async_mode() is commented out the application works as expected.
When I turn on the DMA I get 4x more callbacks per second and all of the data in the second buffer is corrupt.
Is there a problem with the HAL library routines?
Solved! Go to Solution.
Labels
- Labels:
-
ispn:40047:1:0
-
l1:314:1:0
-
PSoC6MCU
1 Solution
Oct 31, 2022
07:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 31, 2022
07:56 PM
Hello. I was able to reproduce this problem. I will file an internal ticket to address this issue.
In the meanwhile, we recommend to use the interrupt based ASYNC reads. Actually there is not much gain using DMA here, because of the way the HAL implements the DMA based transfers. It uses software triggers to do so.
1 Reply
Oct 31, 2022
07:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 31, 2022
07:56 PM
Hello. I was able to reproduce this problem. I will file an internal ticket to address this issue.
In the meanwhile, we recommend to use the interrupt based ASYNC reads. Actually there is not much gain using DMA here, because of the way the HAL implements the DMA based transfers. It uses software triggers to do so.