Skip to content

Conversation

Rathan25
Copy link

@Rathan25 Rathan25 commented Sep 18, 2025

PR Description.

  1. Added PDM.begin(), Which dose initialization of PDM, enables channels, configures sample rate.
  2. Added PDM.end(), which disables PDM and clear the FIFOs.
  3. In example added Basic test on begin() and end().

Done unit test with channels and passing sample rate. For single channel it configures with left channel . Going forward need to check with application

Captured logs:
image

Copy link
Member

@ederjc ederjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please complete the work or open against a feature branch.
Also, make sure the checks are passing.

@Rathan25 Rathan25 changed the base branch from main to pdm_integration September 22, 2025 11:39
Copy link
Member

@jaenrig-ifx jaenrig-ifx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start 👍
We have to also start thinking of the tests in arduino-core-test
In micropython we have faked a pcm signal with gpio toggling and then read the pattern from the receiver:
https://github.com/Infineon/micropython/blob/ports-psoc6-main/tests/ports/psoc6/board_ext_hw/multi/pdm_pcm_rx.py
https://github.com/Infineon/micropython/blob/ports-psoc6-main/tests/ports/psoc6/board_ext_hw/multi/pdm_pcm_tx.py

# Instances (KEYWORD2)
#######################################

PDM KEYWORD2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are going to be able to create multiple instances, this should be a data type -> KEYWORD1

#include "Arduino.h"
#include "cyhal_pdmpcm.h"

#define PDM_DATA P10_5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return; \
}

bool PdmClass::begin(int channels, int sample_rate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, there are few more things that need to be taken care in the begin:

#define PDM_DATA P10_5
#define PDM_CLK P10_4

#define SAMPLE_RATE_HZ 8000u
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defines can be private, in the .cpp?

#define SAMPLE_RATE_HZ 8000u
#define DECIMATION_RATE 64u

class PdmClass {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants