NRF5340 with PDM

HI,

 We are using the IM69D120 PDM mic for our audio application. I am able to interface the MIC and record audio with the NRF5340. 

       I have read the PDM data and stored it in an external SRAM connected through SPI. Then I read the data from SRAM and transferred it through BLE and captured the data with the help of the python app.

1) Test Case 1:  PIN mapping.

      At first, I connected the SRAM Pin to port 0 pins. I can get clear audio. But, I changed the SRAM pins to port 1 I can't be able to get the clear audio. The output audio has a clipping sound randomly.

      1) why is the audio coming correctly with port 0 pins alone? why it is not coming with port 1 pins? 

       2) Is there any configurations there to make it work with port 1 pins?

  2) Test Case 2: Zephyr timer and thread.

          Once I started using timer and thread in the same project. Again, I am not getting the non-quality audio.

           1) I need to know if this is because of zephyr. Because I have read the zephyr documentation (https://docs.zephyrproject.org/2.6.0/boards/arm/nrf5340dk_nrf5340/doc/index.html)

                in this documentation, the PDM is not listed in the zephyr supported hardware features list. 

Thanks & Regards

Navin

Parents
  • 1) There is no reason I can think of that should cause this. Are you sure the only change you did was the pin mapping and no other changes was performed?

    2) Maybe look at the PDM buffer and try to increase it? Sounds to me that the other thread/timer delay the PDM handling, so you may need to look into buffer size and priority of the PDM handling.

    Best regards,
    Kenneth

  • Hi Kenneth,

     Thanks for your response. 

    1) I am sure there are no other changes performed.

    2) PDM  and timer will run parallelly.Because based on the timer action we need to read one interrupt.

    Thanks & Regards

    Navin

  • Hi kenneth,

    Are you There. We are waiting for your reply.

    Thanks & Regards

    Navin 

  • Hi,

    The only thing I can think of that have some influence here is that port1 by default is setup to be used by the network core. But I assume you have changed that so that the pdm pins in question does not conflict with this. What analysis have you done on the "clipping sound"? Does it repeat repeatedly at some interval? Is it constant on all audio etc? Is some of the audio good?

    Kenneth

  • Hi Keneth,

    The only thing I can think of that have some influence here is that port1 by default is setup to be used by the network core. But I assume you have changed that so that the pdm pins in question does not conflict with this

      I have mentioned those Pins as Port 1. But I have not changed the pins to application core pins. Kindly tell me the procedure to do that. I will check.

    What analysis have you done on the "clipping sound"? Does it repeat repeatedly at some interval? Is it constant on all audio etc? Is some of the audio good?

    the clipping sounds are random and are not at some regular intervals. in all audio, we get like like one to 3 clipping sound at a random interval.

    If We tried with the Audio application alone (means without adding any timer or interrupt). Then We can able to get clear audio.

    Thanks & Regards

    Navin

  • Mr.NCK said:
      I have mentioned those Pins as Port 1. But I have not changed the pins to application core pins. Kindly tell me the procedure to do that. I will check.

    If the problem was related to pin assignment between cores they should not work at all, you can find relevant information here on how this assignment is done (though this has changed a bit between ncs releases, so I am also adding a link to a devzone case);

    New: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/api/bindings/gpio/nordic,nrf-gpio-forwarder.html 

    Older:  RE: nrf5340: How to Reconfigure Pins P0.08. P0.09, P0.10, P0.11, P0.12 for SPI Bus  

    You do have good grounding between the mic and DK right, the pin header is proper connected?

    Mr.NCK said:
    the clipping sounds are random and are not at some regular intervals. in all audio, we get like like one to 3 clipping sound at a random interval.

    I doubt this is related to the pin assignment, it sounds much more related to application priority and not a pin conflict. I can not understand reason why changing pin the used by the PDM peripheral should cause what you describe. I suggest to continue debugging and simplify the project to narrow down the root cause, you may also consider looking at the audio source to make sure it's not saturating the input etc.

    Hopefully you will be able to narrow it down and find root cause. If you are unable to make this work, then I guess you need to provide some means of me to recreate this here, but then I likely would need your harware (or at least the mic I can attach to the nRF5340-DK) and a project that I can use to change between the pins when running on the DK.

    Edit; You are on a recent release of ncs?

    Kenneth

  • Hi @Mr.NCK and @Kenneth,

    Sorry to bring up this old thread, but I am currently working on a very similar PDM audio setup on nRF5340 and I’m really interested in the final outcome of this case.

    From this discussion it looks like:
    - You were able to interface the IM69D120 PDM mic with the nRF5340, store the PDM data in external SRAM over SPI and send it over BLE.
    - You got clear audio when the SRAM was connected to Port 0 and when you did not use additional timer/thread.
    - When you moved the SRAM pins to Port 1, or when you started to use a Zephyr timer and an extra thread, you began to hear random clipping in the audio.

    I would like to ask a couple of follow-up questions:

    1. Did you finally manage to solve the clipping issue and get stable audio on nRF5340 (especially for the Port 1 + timer/thread case)?
    - If yes, was the root cause related to network core pin assignment, thread/timer priorities, buffer sizes, nRF Connect SDK version, or something else?

    2. Were there any specific changes you made in devicetree, Kconfig, PDM configuration, or the way you handled the PDM/ISR threads that were important to make the audio clean?

    3. If you have a small example project or can briefly describe the key steps of your working configuration, would it be possible to share it (even in a simplified form)?

    For context, my current setup is:

    - Board: nRF5340 Audio DK (PCA10121)
    - SoC: nRF5340
    - External PDM microphone: ST MP45DT02
    - nRF Connect SDK: v2.5.2
    - Goal: reliable PDM audio capture on nRF5340, and later feeding this PDM audio into the `nrf5340_audio` (Walkie Talkie) application as the audio source.

    Even a short summary of what worked and what did not work in your case would be extremely helpful.
    Thank you very much for your time and for any hints you can share!

    Best regards,
    LjHuang

Reply
  • Hi @Mr.NCK and @Kenneth,

    Sorry to bring up this old thread, but I am currently working on a very similar PDM audio setup on nRF5340 and I’m really interested in the final outcome of this case.

    From this discussion it looks like:
    - You were able to interface the IM69D120 PDM mic with the nRF5340, store the PDM data in external SRAM over SPI and send it over BLE.
    - You got clear audio when the SRAM was connected to Port 0 and when you did not use additional timer/thread.
    - When you moved the SRAM pins to Port 1, or when you started to use a Zephyr timer and an extra thread, you began to hear random clipping in the audio.

    I would like to ask a couple of follow-up questions:

    1. Did you finally manage to solve the clipping issue and get stable audio on nRF5340 (especially for the Port 1 + timer/thread case)?
    - If yes, was the root cause related to network core pin assignment, thread/timer priorities, buffer sizes, nRF Connect SDK version, or something else?

    2. Were there any specific changes you made in devicetree, Kconfig, PDM configuration, or the way you handled the PDM/ISR threads that were important to make the audio clean?

    3. If you have a small example project or can briefly describe the key steps of your working configuration, would it be possible to share it (even in a simplified form)?

    For context, my current setup is:

    - Board: nRF5340 Audio DK (PCA10121)
    - SoC: nRF5340
    - External PDM microphone: ST MP45DT02
    - nRF Connect SDK: v2.5.2
    - Goal: reliable PDM audio capture on nRF5340, and later feeding this PDM audio into the `nrf5340_audio` (Walkie Talkie) application as the audio source.

    Even a short summary of what worked and what did not work in your case would be extremely helpful.
    Thank you very much for your time and for any hints you can share!

    Best regards,
    LjHuang

Children
No Data
Related