![]() |
RZT Flexible Software Package Documentation
Release v3.0.0
|
|
Functions | |
fsp_err_t | R_DSMIF_Open (adc_ctrl_t *p_ctrl, adc_cfg_t const *const p_cfg) |
fsp_err_t | R_DSMIF_ScanStart (adc_ctrl_t *p_ctrl) |
fsp_err_t | R_DSMIF_ScanStop (adc_ctrl_t *p_ctrl) |
fsp_err_t | R_DSMIF_CfgSet (adc_ctrl_t *p_ctrl, adc_cfg_t const *const p_cfg) |
fsp_err_t | R_DSMIF_Read (adc_ctrl_t *p_ctrl, adc_channel_t const reg_id, uint32_t *const p_data) |
fsp_err_t | R_DSMIF_StatusGet (adc_ctrl_t *p_ctrl, adc_status_t *p_status) |
fsp_err_t | R_DSMIF_Close (adc_ctrl_t *p_ctrl) |
fsp_err_t | R_DSMIF_CallbackSet (adc_ctrl_t *const p_ctrl, void(*p_callback)(adc_callback_args_t *), void const *const p_context, adc_callback_args_t *const p_callback_memory) |
fsp_err_t | R_DSMIF_ErrorStatusGet (adc_ctrl_t *p_ctrl, dsmif_error_status_t *p_error_status) |
Driver for the DSMIF peripheral on RZ microprocessor. This module implements the ADC Interface.
The DSMIF module supports the following features:
Master mode supports the following output clock for RZ/T2M, RZ/T2ME and RZ/T2L:
Master mode supports the following output clock for RZ/T2H:
Filter received clock inversion function.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
Configuration | Options | Default | Description |
---|---|---|---|
General > Name | Name must be a valid C symbol | g_dsmif0 | Module name. |
General > Unit | Value must be an integer greater than or equal to 0 | 0 | DSMIF Unit No. |
Extra > Channel Synchronization > Counter Reset > Division counter initialization trigger |
| No Trigger | Current measurement filter initialization trigger. |
Extra > Channel Synchronization > Counter Reset > Edge |
| Negative Edge | Current measurement filter initialization trigger for division counter for decimation edge. |
Extra > Channel Synchronization > Capture Trigger A |
| No Trigger | Current capture trigger A selection. |
Extra > Channel Synchronization > Capture Trigger B |
| No Trigger | Current capture trigger B selection. |
Extra > Overcurrent Sum Error > Upper Limit > Detection |
| Invalid | Overcurrent sum error upper limit detection enable. |
Extra > Overcurrent Sum Error > Upper Limit > Limit Value | Overcurrent Sum Error Detect High Threshold between 0x00000 and 0x3FFFF | 0x00000 | Overcurrent Sum Error Detect High Threshold. |
Extra > Overcurrent Sum Error > Lower Limit > Detection |
| Invalid | Overcurrent sum error lower limit detection enable. |
Extra > Overcurrent Sum Error > Lower Limit > Limit Value | Overcurrent Sum Error Detect Low Threshold between 0x00000 and 0x3FFFF | 0x00000 | Overcurrent Sum Error Detect Low Threshold. |
Extra > Overcurrent Sum Error > Interrupts > Callback | Name must be a valid C symbol | NULL | A user callback function. If this callback function is provided, it is called from the interrupt service routine (ISR) each time the overcurrent sum error. |
Extra > Overcurrent Sum Error > Interrupts > Interrupt Priority | MCU Specific Options | Select the overcurrent sum error interrupt priority. | |
Extra > Overcurrent Sum Error > Interrupts > Upper Limit Interrupt |
| Disabled | Overcurrent sum error upper limit detection interrupt enable. |
Extra > Overcurrent Sum Error > Interrupts > Lower Limit Interrupt |
| Disabled | Overcurrent sum error lower limit detection interrupt enable. |
Extra > Overcurrent Sum Error > Mode |
| CH0, CH1, CH2 | Overcurrent sum error detect mode setting. |
Extra > Data Format Select |
| Left justified | Data shift setting when setting the Sinc filter output to the DSCDRCHn register. |
ELC > DSMIF CAP_TRG0 event > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CAP_TRG1 event > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CAP_TRG2 event > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CAP_TRG3 event > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CAP_TRG4 event > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CAP_TRG5 event > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CDCNT_INT_TRG0 > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CDCNT_INT_TRG1 > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
ELC > DSMIF CDCNT_INT_TRG2 > Trigger Source | MCU Specific Options | ELC_SSEL settings. | |
Unique No | Numbers only | 0 | A unique number that manages multiple instances. |
Configuration | Options | Default | Description |
---|---|---|---|
A/D Convert(Current Measurement) > Clock > Clock Mode |
| Slave | A/D conversion clock master/slave switching. |
A/D Convert(Current Measurement) > Clock > Clock(clock master mode) | MCU Specific Options | This setting needs the PCLKH setting that can be set on the Clocks tab. A/D conversion clock division ratio. | |
A/D Convert(Current Measurement) > Sinc Filter > Filter Order |
| Filter Order 3rd | Current measurement filter order setting. |
A/D Convert(Current Measurement) > Sinc Filter > Decimation Ratio | MCU Specific Options | Decimation ratio selection for current measurement. | |
A/D Convert(Current Measurement) > Interrupts > Capture |
| Disabled | Current data register update interrupt enable. |
A/D Convert(Current Measurement) > Capture Edge |
| Negative Edge | Sampling edge selection. |
Extra > Overcurrent > Sinc Filter > Filter Order |
| Filter Order 3rd | Overcurrent detection filter order setting. |
Extra > Overcurrent > Sinc Filter > Decimation Ratio | MCU Specific Options | Decimation ratio selection for overcurrent detectiont. | |
Extra > Overcurrent > Detection 0 > Upper Limit > Detection |
| Disabled | Overcurrent upper limit exceeded detection enable. |
Extra > Overcurrent > Detection 0 > Upper Limit > Limit Value | Overcurrent detection upper limit between 0x0 and 0xFFFF | 0x0 | Overcurrent detection upper limit. |
Extra > Overcurrent > Detection 0 > Lower Limit > Detection |
| Disabled | Overcurrent lower limit detection enable. |
Extra > Overcurrent > Detection 0 > Lower Limit > Limit Value | Overcurrent detection lower limit between 0x0 and 0xFFFF | 0x0 | Overcurrent detection lower limit. |
Extra > Overcurrent > Detection 0 > Interrupts > Upper Limit Interrupt |
| Disabled | Overcurrent upper limit exceeded output interrupt enable. |
Extra > Overcurrent > Detection 0 > Interrupts > Lower Limit Interrupt |
| Disabled | Overcurrent lower limit detection interrupt enable. |
Extra > Overcurrent > Detection 1 > Upper Limit > Detection |
| Disabled | Overcurrent upper limit exceeded detection enable. |
Extra > Overcurrent > Detection 1 > Upper Limit > Limit Value | Overcurrent detection upper limit between 0x0 and 0xFFFF | 0x0 | Overcurrent detection upper limit. |
Extra > Overcurrent > Detection 1 > Lower Limit > Detection |
| Disabled | Overcurrent lower limit detection enable. |
Extra > Overcurrent > Detection 1 > Lower Limit > Limit Value | Overcurrent detection lower limit between 0x0 and 0xFFFF | 0x0 | Overcurrent detection lower limit. |
Extra > Overcurrent > Detection 1 > Interrupts > Upper Limit Interrupt |
| Disabled | Overcurrent upper limit exceeded output interrupt enable. |
Extra > Overcurrent > Detection 1 > Interrupts > Lower Limit Interrupt |
| Disabled | Overcurrent lower limit detection interrupt enable. |
Extra > Overcurrent > Detection 2 > Upper Limit > Detection |
| Disabled | Overcurrent upper limit exceeded detection enable. |
Extra > Overcurrent > Detection 2 > Upper Limit > Limit Value | Overcurrent detection upper limit between 0x0 and 0xFFFF | 0x0 | Overcurrent detection upper limit. |
Extra > Overcurrent > Detection 2 > Lower Limit > Detection |
| Disabled | Overcurrent lower limit detection enable. |
Extra > Overcurrent > Detection 2 > Lower Limit > Limit Value | Overcurrent detection lower limit between 0x0 and 0xFFFF | 0x0 | Overcurrent detection lower limit. |
Extra > Overcurrent > Detection 2 > Interrupts > Upper Limit Interrupt |
| Disabled | Overcurrent upper limit exceeded output interrupt enable. |
Extra > Overcurrent > Detection 2 > Interrupts > Lower Limit Interrupt |
| Disabled | Overcurrent lower limit detection interrupt enable. |
Extra > Overcurrent > Window Notification > Notification 0 > Output Enable |
| Disabled | Overcurrent detection window notification 0 output enable. |
Extra > Overcurrent > Window Notification > Notification 0 > Function Enable |
| Disabled | Overcurrent detection window notification 0 function enable. |
Extra > Overcurrent > Window Notification > Notification 0 > Mode |
| (overcurrent data < lower limit 0) or (overcurrent data > upper limit 0) | Channel n overcurrent detection window notification 0 mode select. |
Extra > Overcurrent > Window Notification > Notification 1 > Output Enable |
| Disabled | Overcurrent detection window notification 1 output enable. |
Extra > Overcurrent > Window Notification > Notification 1 > Function Enable |
| Disabled | Overcurrent detection window notification 1 function enable. |
Extra > Overcurrent > Window Notification > Notification 1 > Mode |
| (overcurrent data < lower limit 1) or (overcurrent data > upper limit 1) | Channel n overcurrent detection window notification 1 mode select. |
Extra > Overcurrent > Window Notification > Notification 2 > Output Enable |
| Disabled | Overcurrent detection window notification 2 output enable. |
Extra > Overcurrent > Window Notification > Notification 2 > Function Enable |
| Disabled | Overcurrent detection window notification 2 function enable. |
Extra > Overcurrent > Window Notification > Notification 2 > Mode |
| (overcurrent data < lower limit 2) or (overcurrent data > upper limit 2) | Channel n overcurrent detection window notification 2 mode select. |
Extra > Overcurrent > Window Notification > Notification 3 > Output Enable |
| Disabled | Overcurrent detection window notification 3 output enable. |
Extra > Overcurrent > Window Notification > Notification 3 > Function Enable |
| Disabled | Overcurrent detection window notification 3 function enable. |
Extra > Overcurrent > Window Notification > Notification 3 > Mode | Refer to the RZT Configuration tool for available options. | Notification 0 | Channel n overcurrent detection window notification 3 mode select. |
Extra > Short Circuit > Interrupts > Interrupt |
| Disabled | Short circuit detection error interrupt enable. |
Extra > Short Circuit > Detection |
| Disabled | Short circuit detection enable. |
Extra > Short Circuit > High Count Threshold | Short circuit detection high continuous detection count between 0x0 and 0x1FFF | 0x0 | Short circuit detection high continuous detection count. |
Extra > Short Circuit > Low Count Threshold | Short circuit detection low continuous detection count between 0x0 and 0x1FFF | 0x0 | Short circuit detection low continuous detection count. |
Name | Manual Entry | g_dsmif_channel0 | Module name. |
The DSMIF clock is configurable on the clocks tab.
Master mode supports the following output clock for RZ/T2M, RZ/T2ME and RZ/T2L:
Master mode supports the following output clock for RZ/T2H:
The relationship between the I / O pin and the DSMIF unit for RZ/T2M, RZ/T2ME and RZ/T2L is as follows.
Item | Unit0(DSMIF0) | Unit1(DSMIF1) |
---|---|---|
Clock | MCLK0-2 | MCLK3-5 |
Data | MDAT0-2 | MDAT3-5 |
The relationship between the I / O pin and the DSMIF unit for RZ/T2H is as follows.
Item | Unitm(DSMIFn) |
---|---|
Clock | MCLKmn |
Data | MDATmn |
Note: m = 0 to 9 (unit), n = 0 to 2 (channel)
In this document, the term "sampling" refers to the ability to sample data from the DSMIF clock and works as follows:
If interrupts are not enabled, the R_DSMIF_StatusGet() API can be used to poll the DSMIF to determine when the scan has completed. The R_DSMIF_Read() API function is used to access the converted DSMIF result.
In the channel specification of R_DSMIF_Read(), select channels 0 to 2 even when using Unit1.
This is a basic example of minimal use of the DSMIF in an application.
Data Structures | |
struct | dsmif_extended_cfg_t |
struct | dsmif_instance_ctrl_t |
struct | dsmif_error_status_t |
Enumerations | |
enum | dsmif_sum_err_detect_channel_t |
enum | dsmif_clock_ctrl_t |
enum | dsmif_clock_edge_t |
enum | dsmif_filter_order_t |
enum | dsmif_data_shift_t |
enum | dsmif_capture_trigger_t |
enum | dsmif_counter_init_trigger_t |
enum | dsmif_current_data_t |
enum | dsmif_channel_mask_t |
enum | dsmif_channel_overcurrent_status_t |
enum | dsmif_channel_short_circuit_status_t |
enum | dsmif_overcurrent_sum_status_t |
struct dsmif_extended_cfg_t |
DSMIF configuration extension. This extension is required and must be provided in dsmif_cfg_t::p_extend.
Data Fields | ||
---|---|---|
bool | isel | Overcurrent sum error lower limit detection interrupt enable bit. |
bool | iseh | Overcurrent sum error upper limit detection interrupt enable bit. |
dsmif_sum_err_detect_channel_t | sedm | Overcurrent sum error detect mode setting bit. |
uint32_t | scmptbl | DSSELTR : Overcurrent Sum Error Detect Low Threshold Register. |
uint32_t | scmptbh | DSSEHTR : Overcurrent Sum Error Detect High Threshold Register. |
bool | seel | DSSECR : Overcurrent Sum Error lower limit detection enable. |
bool | seeh | DSSECR : Overcurrent Sum Error upper limit detection enable. |
dsmif_capture_trigger_t | cap_trig_a | DSCMCTCRCHn.CTSELA[2:0] : Current capture trigger A selection bit. |
dsmif_capture_trigger_t | cap_trig_b | DSCMCTCRCHn.CTSELB[2:0] : Current capture trigger B selection bit. |
dsmif_counter_init_trigger_t | cnt_init_trig | DSCMCTCRCHn.DITSEL[2:0] : Current measurement filter initialization trigger division counter for decimation. |
dsmif_clock_edge_t | edge | DSCMCTCRCHn.DEDGE[2:0] : Current measurement filter initialization trigger for division counter for decimation edge. |
dsmif_channel_cfg_t * | p_channel_cfgs[DSMIF_MAX_NUM_CHANNELS] | Configuration for each channel, set to NULL if unused. |
dsmif_channel_mask_t | channel_mask | Channel bitmask. |
struct dsmif_instance_ctrl_t |
DSMIF instance control block. DO NOT INITIALIZE.
struct dsmif_error_status_t |
DSMIF Error status.
Data Fields | ||
---|---|---|
dsmif_channel_overcurrent_status_t | channel_overcurrent_status | Channel Overcurrent state. |
dsmif_channel_short_circuit_status_t | channel_short_circuit_status | Channel Short circuit state. |
dsmif_overcurrent_sum_status_t | overcurrent_sum_status | Overcurrent Sum state. |
enum dsmif_clock_ctrl_t |
enum dsmif_clock_edge_t |
enum dsmif_filter_order_t |
enum dsmif_data_shift_t |
enum dsmif_current_data_t |
enum dsmif_channel_mask_t |
For DSMIF Scan configuration e_dsmif_ch_mask::channel_mask. Use bitwise OR to combine these masks for desired channels and sensors.
DSMIF Channel Overcurrent detect status.
fsp_err_t R_DSMIF_Open | ( | adc_ctrl_t * | p_ctrl, |
adc_cfg_t const *const | p_cfg | ||
) |
Applies power to the DSMIF and initializes the hardware based on the user configuration. As part of this initialization, set interrupts, set DSMIF error interrupt registers, etc.
FSP_SUCCESS | Configuration successful. |
FSP_ERR_ASSERTION | An input pointer is NULL or an input parameter is invalid. |
FSP_ERR_ALREADY_OPEN | Control block is already open. |
FSP_ERR_IRQ_BSP_DISABLED | A required interrupt is disabled |
FSP_ERR_IP_UNIT_NOT_PRESENT | The Unit requested in the p_cfg parameter is not available on this device. |
fsp_err_t R_DSMIF_ScanStart | ( | adc_ctrl_t * | p_ctrl | ) |
Starts either synchronous control mode or individual control mode .
FSP_SUCCESS | Scan started or hardware triggers enabled successfully. |
FSP_ERR_ASSERTION | An input pointer was NULL. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |
fsp_err_t R_DSMIF_ScanStop | ( | adc_ctrl_t * | p_ctrl | ) |
Stops any in-progress scan started by software.
FSP_SUCCESS | Scan stopped or hardware triggers disabled successfully. |
FSP_ERR_ASSERTION | An input pointer was NULL. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |
FSP_ERR_TIMEOUT | Timeout error. |
fsp_err_t R_DSMIF_CfgSet | ( | adc_ctrl_t * | p_ctrl, |
adc_cfg_t const *const | p_cfg | ||
) |
Configuration settings.(Overcurrent detection and Sum error detection).
FSP_SUCCESS | Configuration setting successfully. |
FSP_ERR_ASSERTION | An input pointer was NULL. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |
fsp_err_t R_DSMIF_Read | ( | adc_ctrl_t * | p_ctrl, |
adc_channel_t const | reg_id, | ||
uint32_t *const | p_data | ||
) |
Reads the most recent result from a channel.
FSP_SUCCESS | Result in p_data. |
FSP_ERR_ASSERTION | An input pointer was NULL or an input parameter was invalid. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |
fsp_err_t R_DSMIF_StatusGet | ( | adc_ctrl_t * | p_ctrl, |
adc_status_t * | p_status | ||
) |
Returns the status of a scan started by software.
FSP_SUCCESS | No software scan is in progress. |
FSP_ERR_ASSERTION | An input pointer was NULL. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |
fsp_err_t R_DSMIF_Close | ( | adc_ctrl_t * | p_ctrl | ) |
Stops any scan in progress, disables interrupts, and powers down the DSMIF peripheral.
FSP_SUCCESS | Instance control block closed successfully. |
FSP_ERR_ASSERTION | An input pointer was NULL. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |
fsp_err_t R_DSMIF_CallbackSet | ( | adc_ctrl_t *const | p_ctrl, |
void(*)(adc_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
adc_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback with the option to provide memory for the callback argument structure.
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | The control block has not been opened. |
fsp_err_t R_DSMIF_ErrorStatusGet | ( | adc_ctrl_t * | p_ctrl, |
dsmif_error_status_t * | p_error_status | ||
) |
Returns the error status of a scan started by software.
FSP_SUCCESS | No software scan is in progress. |
FSP_ERR_ASSERTION | An input pointer was NULL. |
FSP_ERR_NOT_OPEN | Instance control block is not open. |