This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PDM code implementation and testing

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void bsp_event_handler(bsp_event_t event)
{
ret_code_t err_code;
switch (event)
{
case BSP_EVENT_SLEEP:
sleep_mode_enter();
break; // BSP_EVENT_SLEEP
case BSP_EVENT_DISCONNECT:
err_code = sd_ble_gap_disconnect(m_conn_handle,
BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
break; // BSP_EVENT_DISCONNECT
case BSP_EVENT_WHITELIST_OFF:
if (m_conn_handle == BLE_CONN_HANDLE_INVALID)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have to connect a MIC  working on PDM to nrf52 DK Board.For that, I have written the above code.  But when I am testing I am not able to get the clock pulses at the defined pin. Also do not know at which Freq it is working?

And when I read the pdm documentation it says I need to change the PSEL.CLK register value? Then how should I do it and with what value? same for PSEL.DIN register. I am confused a lot. Please suggest me the solution to all my doubts.I have checked the clk pin on Oscilloscope, the clock is not being generated.In order to generate clk at pin number 22 of nrf52 DK board should I define pin clk  as #define CONFIG_IO_PDM_CLK 0x22 or 0x16 (hex value of 22 )instead o rtf 0x22?