RZV Flexible Software Package Documentation  Release v2.0.0

 
PDM Interface (r_pdm)

Functions

fsp_err_t R_PDM_Open (pdm_ctrl_t *const p_ctrl, pdm_cfg_t const *const p_cfg)
 
fsp_err_t R_PDM_Start (pdm_ctrl_t *const p_ctrl, void *const p_buffer, size_t const buffer_size, uint32_t const number_of_data_to_callback)
 
fsp_err_t R_PDM_Stop (pdm_ctrl_t *const p_ctrl)
 
fsp_err_t R_PDM_Read (pdm_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes)
 
fsp_err_t R_PDM_StatusGet (pdm_ctrl_t *const p_ctrl, pdm_status_t *const p_status)
 
fsp_err_t R_PDM_Close (pdm_ctrl_t *const p_ctrl)
 
fsp_err_t R_PDM_CallbackSet (pdm_ctrl_t *const p_ctrl, void(*p_callback)(pdm_callback_args_t *), void const *const p_context, pdm_callback_args_t *const p_callback_memory)
 

Detailed Description

Driver for the PDM peripheral on RZ MPUs. This module implements the PDM Interface.

Overview

Features

The PDM module supports the following features:

Reception of a voice data from external PDM device

Configuration

Build Time Configurations for r_pdm

The following build time configurations are defined in fsp_cfg/r_pdm_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.
DMAC Support
  • Enabled
  • Disabled
Disabled If code for DMAC transfer support is included in the build.

Configurations for Connectivity > PDM Driver on r_pdm

This module can be added to the Stacks tab via New Stack > Connectivity > PDM Driver on r_pdm.

ConfigurationOptionsDefaultDescription
Input > Edge
  • Rising
  • Falling
Rising Select the edge of input audio data.
Input > PDM_CLK frequencyRefer to the RZV Configuration tool for available options.module.driver.pdm.clock_div.clock_div_2 Select PDM_CLK Frequency (MHz).
Output > Bit Depth
  • 20 Bits mode {1 Sign bit and [18:0] bits of the buffer}
  • 20 Bits mode {2 Sign bits and [18:1] bits of the buffer}
  • 20 Bits mode {3 Sign bits and [18:2] bits of the buffer}
  • 20 Bits mode {4 Sign bits and [18:3] bits of the buffer}
  • 16 Bits mode {1 Sign bit and [18:4] bits of the buffer}
  • 16 Bits mode {1 Sign bit and [17:3] bits of the buffer}
  • 16 Bits mode {1 Sign bit and [16:2] bits of the buffer}
  • 16 Bits mode {1 Sign bit and [15:1] bits of the buffer}
  • 16 Bits mode {1 Sign bit and [14:0] bits of the buffer}
module.driver.pdm.pcm_width.pcm_width_20bits_0_18 Select the bit depth of one sample of audio data.
Output > Target sampling frequencyRefer to the RZV Configuration tool for available options.30 kHz Select Target sampling Frequency (kHz).
Filter > Low-pass filter > Low-pass filter input shift
  • No shift
  • 1-bit right shift
  • 2-bits right shift
  • 3-bits right shift
No shift Select the low-pass (half-band decimation) filter input shift setting.
Filter > Low-pass filter > LPF Coefficient h0(10)Value must be an integer between 0x0000 and 0x1FFF0x0400 Specify the Low-Pass Filter Coefficient h0(10)
Filter > Low-pass filter > LPF Coefficient h1(0)Value must be an integer between 0x0000 and 0x1FFF0x1FF8 Specify the Low-Pass Filter Coefficient h1(0)
Filter > Low-pass filter > LPF Coefficient h1(1)Value must be an integer between 0x0000 and 0x1FFF0x000A Specify the Low-Pass Filter Coefficient h1(1)
Filter > Low-pass filter > LPF Coefficient h1(2)Value must be an integer between 0x0000 and 0x1FFF0x1FF0 Specify the Low-Pass Filter Coefficient h1(2)
Filter > Low-pass filter > LPF Coefficient h1(3)Value must be an integer between 0x0000 and 0x1FFF0x0018 Specify the Low-Pass Filter Coefficient h1(3)
Filter > Low-pass filter > LPF Coefficient h1(4)Value must be an integer between 0x0000 and 0x1FFF0x1FDC Specify the Low-Pass Filter Coefficient h1(4)
Filter > Low-pass filter > LPF Coefficient h1(5)Value must be an integer between 0x0000 and 0x1FFF0x0034 Specify the Low-Pass Filter Coefficient h1(5)
Filter > Low-pass filter > LPF Coefficient h1(6)Value must be an integer between 0x0000 and 0x1FFF0x1FB3 Specify the Low-Pass Filter Coefficient h1(6)
Filter > Low-pass filter > LPF Coefficient h1(7)Value must be an integer between 0x0000 and 0x1FFF0x0076 Specify the Low-Pass Filter Coefficient h1(7)
Filter > Low-pass filter > LPF Coefficient h1(8)Value must be an integer between 0x0000 and 0x1FFF0x1F2E Specify the Low-Pass Filter Coefficient h1(8)
Filter > Low-pass filter > LPF Coefficient h1(9)Value must be an integer between 0x0000 and 0x1FFF0x0289 Specify the Low-Pass Filter Coefficient h1(9)
Filter > Low-pass filter > LPF Coefficient h1(10)Value must be an integer between 0x0000 and 0x1FFF0x0289 Specify the Low-Pass Filter Coefficient h1(10)
Filter > Low-pass filter > LPF Coefficient h1(11)Value must be an integer between 0x0000 and 0x1FFF0x1F2E Specify the Low-Pass Filter Coefficient h1(11)
Filter > Low-pass filter > LPF Coefficient h1(12)Value must be an integer between 0x0000 and 0x1FFF0x0076 Specify the Low-Pass Filter Coefficient h1(12)
Filter > Low-pass filter > LPF Coefficient h1(13)Value must be an integer between 0x0000 and 0x1FFF0x1FB3 Specify the Low-Pass Filter Coefficient h1(13)
Filter > Low-pass filter > LPF Coefficient h1(14)Value must be an integer between 0x0000 and 0x1FFF0x0034 Specify the Low-Pass Filter Coefficient h1(14)
Filter > Low-pass filter > LPF Coefficient h1(15)Value must be an integer between 0x0000 and 0x1FFF0x1FDC Specify the Low-Pass Filter Coefficient h1(15)
Filter > Low-pass filter > LPF Coefficient h1(16)Value must be an integer between 0x0000 and 0x1FFF0x0018 Specify the Low-Pass Filter Coefficient h1(16)
Filter > Low-pass filter > LPF Coefficient h1(17)Value must be an integer between 0x0000 and 0x1FFF0x1FF0 Specify the Low-Pass Filter Coefficient h1(17)
Filter > Low-pass filter > LPF Coefficient h1(18)Value must be an integer between 0x0000 and 0x1FFF0x000A Specify the Low-Pass Filter Coefficient h1(18)
Filter > Low-pass filter > LPF Coefficient h1(19)Value must be an integer between 0x0000 and 0x1FFF0x1FF8 Specify the Low-Pass Filter Coefficient h1(19)
Filter > Compensation filter > Compensation filter input shift
  • No shift
  • 1-bit right shift
  • 2-bits right shift
  • 3-bits right shift
No shift Select the compensation filter input shift setting.
Filter > Compensation filter > Compensation Filter Coefficient h(0)Value must be an integer between 0x0000 and 0x1FFF0x1FE8 Specify the Compensation Filter Coefficient h(0)
Filter > Compensation filter > Compensation Filter Coefficient h(1)Value must be an integer between 0x0000 and 0x1FFF0x0039 Specify the Compensation Filter Coefficient h(1)
Filter > Compensation filter > Compensation Filter Coefficient h(2)Value must be an integer between 0x0000 and 0x1FFF0x003C Specify the Compensation Filter Coefficient h(2)
Filter > Compensation filter > Compensation Filter Coefficient h(3)Value must be an integer between 0x0000 and 0x1FFF0x1E56 Specify the Compensation Filter Coefficient h(3)
Filter > Compensation filter > Compensation Filter Coefficient h(4)Value must be an integer between 0x0000 and 0x1FFF0x01DC Specify the Compensation Filter Coefficient h(4)
Filter > Compensation filter > Compensation Filter Coefficient h(5)Value must be an integer between 0x0000 and 0x1FFF0x06E1 Specify the Compensation Filter Coefficient h(5)
Filter > Compensation filter > Compensation Filter Coefficient h(6)Value must be an integer between 0x0000 and 0x1FFF0x01DC Specify the Compensation Filter Coefficient h(6)
Filter > Compensation filter > Compensation Filter Coefficient h(7)Value must be an integer between 0x0000 and 0x1FFF0x1E56 Specify the Compensation Filter Coefficient h(7)
Filter > Compensation filter > Compensation Filter Coefficient h(8)Value must be an integer between 0x0000 and 0x1FFF0x003C Specify the Compensation Filter Coefficient h(8)
Filter > Compensation filter > Compensation Filter Coefficient h(9)Value must be an integer between 0x0000 and 0x1FFF0x0039 Specify the Compensation Filter Coefficient h(9)
Filter > Compensation filter > Compensation Filter Coefficient h(10)Value must be an integer between 0x0000 and 0x1FFF0x1FE8 Specify the Compensation Filter Coefficient h(10)
Filter > High-pass filter > High-pass filter input shift
  • No shift
  • 1-bit right shift
  • 2-bits right shift
  • 3-bits right shift
No shift Select the high-pass filter input shift setting.
Filter > High-pass filter > HPF Coefficient s(0)Value must be an integer between 0x0000 and 0xFFFF0x3F61 Specify the High-Pass Filter Coefficient s(0)
Filter > High-pass filter > HPF Coefficient k(1)Value must be an integer between 0x0000 and 0xFFFF0x3EC1 Specify the High-Pass Filter Coefficient k(1)
Filter > High-pass filter > HPF Coefficient h(0)Value must be an integer between 0x0000 and 0xFFFF0x4000 Specify the High-Pass Filter Coefficient h(0)
Filter > High-pass filter > HPF Coefficient h(1)Value must be an integer between 0x0000 and 0xFFFF0xC000 Specify the High-Pass Filter Coefficient h(1)
Filter > Moving average mode
  • 1-order (filter is skipped)
  • 2-order
  • 4-order
1-order (filter is skipped) Select the moving average mode for sound detection data.
Filter > Sinc filter mode
  • 1-order
  • 2-order
  • 3-order
  • 4-order
4-order Select the sinc filter mode setting.
Data Reception > Buffer overwrite detection enable
  • Enabled
  • Disabled
Enabled Select buffer overwrite detection.
Data Reception > Data reception interrupt threshold
  • 1 or more data
  • 2 or more data
  • 4 or more data
  • 8 or more data
  • 16 or more data
1 or more data Select Data reception interrupt threshold.
Sound Detection > Sound detection enable
  • Enabled
  • Disabled
module.driver.pdm.sound_detection.sound_detection Select sound detection.
Sound Detection > Sound detection lower limitValue must be an integer between 0x0000 and 0xFFFFF0x0 Specify the Sound detection lower limit
Sound Detection > Sound detection upper limitValue must be an integer between 0x0000 and 0xFFFFF0x0 Specify the Sound detection upper limit
Short circuit detection > Short circuit detection enable
  • Enabled
  • Disabled
module.driver.pdm.short_circuit.short_circuit Select short circuit detection.
Short circuit detection > Short circuit detection High Continuous detection countValue must be an integer between 0x0000 and 0x1FFF0x0 Specify the Short circuit detection High Continuous detection count.
Short circuit detection > Short circuit detection Low Continuous detection countValue must be an integer between 0x0000 and 0x1FFF0x0 Short circuit detection Low Continuous detection count.
Overvoltage detection > Overvoltage detection lower limit enable
  • Enabled
  • Disabled
module.driver.pdm.overvoltage_detection_lower_limit_error.overvoltage_detection_lower_limit_error Select overvoltage detection lower limit.
Overvoltage detection > Overvoltage detection lower limitValue must be an integer between 0x0000 and 0xFFFFF0x0 Specify the Overvoltage detection lower limit
Overvoltage detection > Overvoltage detection upper limit enable
  • Enabled
  • Disabled
module.driver.pdm.overvoltage_detection_upper_limit_error.overvoltage_detection_upper_limit_error Select overvoltage detection upper limit.
Overvoltage detection > Overvoltage detection upper limitValue must be an integer between 0x0000 and 0xFFFFF0x0 Specify the Overvoltage detection upper limit
Interrupt > CallbackName must be a valid C symbolNULL A user callback function can be provided. If this callback function is provided, it will be called from all three interrupt service routines (ISR).
Interrupt > Sound Detection Interrupt EnableMCU Specific OptionsEnable the sound detection interrupt.
Interrupt > Sound Detection Interrupt PriorityValue must be an integer between 0 and 25524 Select the sound detection interrupt priority.
Interrupt > Data Reception Interrupt EnableMCU Specific OptionsEnable the data reception interrupt.
Interrupt > Data Reception Interrupt PriorityValue must be an integer between 0 and 25524 Select the data reception interrupt priority.
Interrupt > Error Detection Interrupt EnableMCU Specific OptionsEnable the error detection interrupt.
Interrupt > Error Detection Interrupt PriorityValue must be an integer between 0 and 25524 Select the error detection interrupt priority.
NameName must be a valid C symbolg_pdm0 Module name.
UnitValue must be an non-negative integer0 Specify the PDM unit.
ChannelValue must be an non-negative integer1 Specify the PDM channel.

Clock Configuration

The PDM peripheral runs on PDM_0_CCLK. PDM_0_CCLK frequency is 48 MHz and can not be configured on the Clocks tab of the RZ Configuration editor.

Pin Configuration

The PDM uses the following pins:

Usage Notes

Audio Data

PDM hardware converts PDM data to PCM data.

Data arrays have the following size, alignment, and length based on the "Bit Depth" setting:

Bit Depth Array Data Type Required Alignment
16 Bits 32-bit integer, right justified 4 byte alignment
20 Bits 32-bit integer, right justified 4 byte alignment

Data Format for 16 Bits

Bit Description
31-20 Fixed to 0
19-16 Sign bits
15-0 Fixed-point data

Data Format for 20 Bits

Bit Description
31-20 Fixed to 0
19-0 Fixed-point data

Examples

Basic Example

This is a basic example of minimal use of the PDM in an application.

#define BUFFER_SIZE 0x1000
uint32_t buffer[BUFFER_SIZE] __attribute__((aligned(16)));
void pdm_basic_example (void)
{
fsp_err_t err = FSP_SUCCESS;
/* Initialize the module. */
err = R_PDM_Open(&g_pdm_ctrl, &g_pdm_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
err = R_PDM_Start(&g_pdm_ctrl, buffer, sizeof(buffer), BUFFER_SIZE / 2);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
}

Data Structures

struct  pdm_instance_ctrl_t
 
struct  pdm_extended_cfg_t
 

Enumerations

enum  pdm_clk_div_t
 
enum  pdm_moving_average_mode_t
 
enum  pdm_low_pass_filter_shift_t
 
enum  pdm_compensation_filter_shift_t
 
enum  pdm_high_pass_filter_shift_t
 
enum  pdm_sinc_filter_mode_t
 
enum  pdm_interrupt_threshold_t
 

Data Structure Documentation

◆ pdm_instance_ctrl_t

struct pdm_instance_ctrl_t

Channel instance control block. DO NOT INITIALIZE. Initialization occurs when pdm_api_t::open is called.

◆ pdm_extended_cfg_t

struct pdm_extended_cfg_t

PDM configuration extension. This extension is optional.

Data Fields
pdm_clk_div_t clock_div PDM_CLKn's division ratio to core clock.
uint8_t sound_detection_enable Sound detection enable.

Function Settings.

uint8_t short_circuit_detection_enable Short circuit detection enable.
uint8_t over_voltage_lower_limit_detection_enable Overvoltage detection lower limit enable.
uint8_t over_voltage_upper_limit_detection_enable Overvoltage detection upper limit enable.
uint8_t buffer_overwrite_detection_enable Buffer overwrite detection enable.
pdm_moving_average_mode_t moving_average_mode Moving average mode f or sound detection data.

Filter Settings.

pdm_low_pass_filter_shift_t low_pass_filter_shift Low-pass (half -band decimation) filter input shift setting.
pdm_compensation_filter_shift_t compensation_filter_shift Compensation filter input shift setting.
pdm_high_pass_filter_shift_t high_pass_filter_shift High-pass filter input shift setting.
pdm_sinc_filter_mode_t sinc_filter_mode Sinc filter mode setting.
uint8_t sincrng Sinc filter output valid range.
uint8_t sincdec Sinc filter decimation ratio.
uint16_t hpf_coefficient_s0 High-pass filter coefficient s0 (16-bit signed fixed point data)
uint16_t hpf_coefficient_k1 High-pass filter coefficient k1 (16-bit signed fixed point data)
uint16_t hpf_coefficient_h[2] High-pass filter coefficient h(p) (16-bit signed fixed point data)
uint16_t compensation_filter_coefficient_h[11] High-pass filter coefficient h(p) (13-bit signed fixed point data)
uint16_t lpf_coefficient_h0 Low-pass (half-band decimation) filter coefficient h0 (13-bit signed fixed point data)
uint16_t lpf_coefficient_h1[20] Low-pass (half-band decimation) filter coefficient h1 (13-bit signed fixed point data)
uint32_t filter_setting_time Filter setting time.
pdm_interrupt_threshold_t interupt_threshold Data reception interrupt threshold.

Sound Detection Threshold.

uint32_t sound_detection_lower_limit Sound detection lower limit (20-bit signed fixed point data)
uint32_t sound_detection_upper_limit Sound detection upper limit (20-bit signed fixed point data)
uint16_t short_circuit_count_h Short circuit detection High Continuous detection count.

Short-Circuit Detection.

uint16_t short_circuit_count_l Continuous detection count.
uint32_t overvoltage_detection_lower_limit Overvoltage detection lower limit (20-bit signed fixed point data)

Overvoltage Detection.

uint32_t overvoltage_detection_upper_limit Overvoltage detection upper limit (20-bit signed fixed point data)

Enumeration Type Documentation

◆ pdm_clk_div_t

PDM_CLKn's division ratio to core clock.

Enumerator
PDM_CLOCK_DIV_2 

0000b: 1/2

PDM_CLOCK_DIV_4 

0001b: 1/4

PDM_CLOCK_DIV_6 

0010b: 1/6

PDM_CLOCK_DIV_8 

0011b: 1/8

PDM_CLOCK_DIV_10 

0100b: 1/10

PDM_CLOCK_DIV_12 

0101b: 1/12

PDM_CLOCK_DIV_14 

0110b: 1/14

PDM_CLOCK_DIV_16 

0111b: 1/16

PDM_CLOCK_DIV_18 

1000b: 1/18

PDM_CLOCK_DIV_20 

1001b: 1/20

PDM_CLOCK_DIV_22 

1010b: 1/22

PDM_CLOCK_DIV_24 

1011b: 1/24

PDM_CLOCK_DIV_26 

1100b: 1/26

PDM_CLOCK_DIV_28 

1101b: 1/28

PDM_CLOCK_DIV_30 

1110b: 1/30

PDM_CLOCK_DIV_32 

1111b: 1/32

◆ pdm_moving_average_mode_t

Moving average mode for sound detection data.

Enumerator
PDM_MOVING_AVERAGE_MODE_1_ORDER 

1-order

PDM_MOVING_AVERAGE_MODE_2_ORDER 

2-order

PDM_MOVING_AVERAGE_MODE_4_ORDER 

4-order

◆ pdm_low_pass_filter_shift_t

Low-pass (half-band decimation) filter input shift setting.

Enumerator
PDM_LPF_RIGHT_SHIFT_0 

No shift.

PDM_LPF_RIGHT_SHIFT_1 

1-bit right shift

PDM_LPF_RIGHT_SHIFT_2 

2-bit right shift

PDM_LPF_RIGHT_SHIFT_3 

3-bit right shift

◆ pdm_compensation_filter_shift_t

Compensation filter input shift setting.

Enumerator
PDM_COMPENSATION_FILTER_RIGHT_SHIFT_0 

No shift.

PDM_COMPENSATION_FILTER_RIGHT_SHIFT_1 

1-bit right shift

PDM_COMPENSATION_FILTER_RIGHT_SHIFT_2 

2-bit right shift

PDM_COMPENSATION_FILTER_RIGHT_SHIFT_3 

3-bit right shift

◆ pdm_high_pass_filter_shift_t

High-pass filter input shift setting.

Enumerator
PDM_HPF_RIGHT_SHIFT_0 

No shift.

PDM_HPF_RIGHT_SHIFT_1 

1-bit right shift

PDM_HPF_RIGHT_SHIFT_2 

2-bit right shift

PDM_HPF_RIGHT_SHIFT_3 

3-bit right shift

◆ pdm_sinc_filter_mode_t

Sinc filter mode setting.

Enumerator
PDM_SINC_FILTER_MODE_1 

1-order

PDM_SINC_FILTER_MODE_2 

2-order

PDM_SINC_FILTER_MODE_3 

3-order

PDM_SINC_FILTER_MODE_4 

4-order

◆ pdm_interrupt_threshold_t

Data reception interrupt threshold.

Enumerator
PDM_INTERRUPT_THRESHOLD_1 

000b: Output interrupt when receiving 1 or more data

PDM_INTERRUPT_THRESHOLD_2 

001b: Output interrupt when receiving 2 or more data

PDM_INTERRUPT_THRESHOLD_4 

010b: Output interrupt when receiving 4 or more data

PDM_INTERRUPT_THRESHOLD_8 

011b: Output interrupt when receiving 8 or more data

PDM_INTERRUPT_THRESHOLD_16 

100b: Output interrupt when receiving 16 or more data

Function Documentation

◆ R_PDM_Open()

fsp_err_t R_PDM_Open ( pdm_ctrl_t *const  p_ctrl,
pdm_cfg_t const *const  p_cfg 
)

Opens the PDM. Implements pdm_api_t::open.

This function sets this clock divisor and the configurations specified in pdm_cfg_t. It also opens the timer and transfer instances if they are provided.

Return values
FSP_SUCCESSReady for PDM communication.
FSP_ERR_ASSERTIONThe pointer to p_ctrl or p_cfg is null.
FSP_ERR_ALREADY_OPENThe control block has already been opened.
FSP_ERR_IP_CHANNEL_NOT_PRESENTChannel number is not available on this device.
Returns
See Common Error Codes or functions called by this function for other popdmble return codes. This function calls:

◆ R_PDM_Start()

fsp_err_t R_PDM_Start ( pdm_ctrl_t *const  p_ctrl,
void *const  p_buffer,
size_t const  buffer_size,
uint32_t const  number_of_data_to_callback 
)

Starts PDM. Implements pdm_api_t::start.

This function enables reception, and enables any transfer instances used.

The PDM will start on the next frame boundary.

Return values
FSP_SUCCESSPDM communication stop request issued.
FSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
FSP_ERR_INVALID_SIZEThe size of buffer is not the multiple of pdm_interrupt_threshold_t.
FSP_ERR_INVALID_ALIGNMENTThe alignment of argument buffer_size is not matched with hardware specification.
FSP_ERR_NOT_OPENThe channel is not opened.
Returns
See Common Error Codes or lower level drivers for other popdmble return codes.

◆ R_PDM_Stop()

fsp_err_t R_PDM_Stop ( pdm_ctrl_t *const  p_ctrl)

Stops PDM. Implements pdm_api_t::stop.

This function disables reception, and disables any transfer instances used.

The PDM will stop on the next frame boundary.

Return values
FSP_SUCCESSPDM communication stop request issued.
FSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
FSP_ERR_NOT_OPENThe channel is not opened.
Returns
See Common Error Codes or lower level drivers for other popdmble return codes.

◆ R_PDM_Read()

fsp_err_t R_PDM_Read ( pdm_ctrl_t *const  p_ctrl,
void *const  p_dest,
uint32_t const  bytes 
)

Reads data into provided buffer. Implements pdm_api_t::read.

This function resets the transfer if the transfer interface is used, or reads the length of data available in the FIFO then stores the remaining read buffer in the control block to be filled in the ISR.

Read() cannot be called if another Start() operation is in progress. Read can be called when the PDM is idle.

Return values
FSP_SUCCESSRead initiated successfully.
FSP_ERR_IN_USEPeripheral is in the wrong mode or not idle.
FSP_ERR_ASSERTIONThe pointer to p_ctrl or p_dest was null, or bytes requested was 0.
FSP_ERR_NOT_OPENThe channel is not opened.
Returns
See Common Error Codes or functions called by this function for other popdmble return codes. This function calls:

◆ R_PDM_StatusGet()

fsp_err_t R_PDM_StatusGet ( pdm_ctrl_t *const  p_ctrl,
pdm_status_t *const  p_status 
)

Gets PDM status and stores it in provided pointer p_status. Implements pdm_api_t::statusGet.

Return values
FSP_SUCCESSInformation stored successfully.
FSP_ERR_ASSERTIONThe p_ctrl or p_status parameter was null.
FSP_ERR_NOT_OPENThe channel is not opened.

◆ R_PDM_Close()

fsp_err_t R_PDM_Close ( pdm_ctrl_t *const  p_ctrl)

Closes PDM. Implements pdm_api_t::close.

This function powers down the PDM and closes the lower level timer and transfer drivers if they are used.

Return values
FSP_SUCCESSDevice closed successfully.
FSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
FSP_ERR_NOT_OPENThe channel is not opened.

◆ R_PDM_CallbackSet()

fsp_err_t R_PDM_CallbackSet ( pdm_ctrl_t *const  p_ctrl,
void(*)(pdm_callback_args_t *)  p_callback,
void const *const  p_context,
pdm_callback_args_t *const  p_callback_memory 
)

Updates the user callback and has option of providing memory for callback structure. Implements pdm_api_t::callbackSet

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_NO_CALLBACK_MEMORYp_callback is non-secure and p_callback_memory is either secure or NULL.