|
RA FSP DocumentationRelease v6.7.0
|
Functions | |
| fsp_err_t | R_CAC_Open (cac_ctrl_t *const p_ctrl, cac_cfg_t const *const p_cfg) |
| fsp_err_t | R_CAC_StartMeasurement (cac_ctrl_t *const p_ctrl) |
| fsp_err_t | R_CAC_StopMeasurement (cac_ctrl_t *const p_ctrl) |
| fsp_err_t | R_CAC_Read (cac_ctrl_t *const p_ctrl, uint32_t *const p_counter) |
| fsp_err_t | R_CAC_CallbackSet (cac_ctrl_t *const p_ctrl, void(*p_callback)(cac_callback_args_t *), void *const p_context, cac_callback_args_t *const p_callback_memory) |
| fsp_err_t | R_CAC_Close (cac_ctrl_t *const p_ctrl) |
Driver for the CAC peripheral on RA MCUs. This module implements the CAC Interface.
The interface for the clock frequency accuracy measurement circuit (CAC) peripheral is used to check a system clock frequency with a reference clock signal by counting the number of measurement clock edges that occur between two edges of the reference clock.
| Device Group | Devices |
|---|---|
| RA2 | RA2A1, RA2A2, RA2E1, RA2E2, RA2E3, RA2L1, RA2L2, RA2T1 |
| RA4 | RA4C1, RA4E1, RA4E2, RA4L1, RA4M1, RA4M2, RA4M3, RA4T1, RA4W1 |
| RA6 | RA6E1, RA6E2, RA6M1, RA6M2, RA6M3, RA6M4, RA6M5, RA6T1, RA6T2, RA6T3 |
| RA8 | RA8D1, RA8D2, RA8E1, RA8E2, RA8M1, RA8M2, RA8P1, RA8T1, RA8T2 |
The following build time configurations are defined in fsp_cfg/r_cac_cfg.h:
| Configuration | Options | Default | Description |
|---|---|---|---|
| Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
This module can be added to the Stacks tab via New Stack > Monitoring > Clock Accuracy Circuit (r_cac). Non-secure callable guard functions can be generated for this module by right clicking the module in the RA Configuration tool and checking the "Non-secure Callable" box.
| Configuration | Options | Default | Description |
|---|---|---|---|
| Name | Name must be a valid C symbol | g_cac0 | Module name. |
| Reference clock divider |
| 32 | Reference clock divider. |
| Reference clock source | MCU Specific Options | Reference clock source. | |
| Reference clock digital filter |
| Disabled | Reference clock digital filter. |
| Reference clock edge detect |
| Rising | Reference clock edge detection. |
| Measurement clock divider |
| 1 | Measurement clock divider. |
| Measurement clock source | MCU Specific Options | Measurement clock source. | |
| Upper Limit Threshold | Value must be a non-negative integer, between 0 to 65535 | 0 | Top end of allowable range for measurement completion. |
| Lower Limit Threshold | Value must be a non-negative integer, between 0 to 65535 | 0 | Bottom end of allowable range for measurement completion. |
| Frequency Error Interrupt Priority | MCU Specific Options | CAC frequency error interrupt priority. | |
| Measurement End Interrupt Priority | MCU Specific Options | CAC measurement end interrupt priority. | |
| Overflow Interrupt Priority | MCU Specific Options | CAC overflow interrupt priority. | |
| Callback | Name must be a valid C symbol | NULL | Function name for callback |
The CAC measurement clock source can be configured as the following:
The CAC reference clock source can be configured as the following:
The CACREF pin can be configured to provide the reference clock for CAC measurements.
The clock measurement result may be off by up to one pulse depending on the phase difference between the edge detection circuit, digital filter, and CACREF pin signal, if applicable.
The frequency error interrupt is only triggered at the end of a CAC measurement. This means that there will be a measurement complete interrupt in addition to the frequency error interrupt.
This is a basic example of minimal use of the CAC in an application.
Data Structures | |
| struct | cac_instance_ctrl_t |
| struct cac_instance_ctrl_t |
CAC instance control block. DO NOT INITIALIZE.
| fsp_err_t R_CAC_Open | ( | cac_ctrl_t *const | p_ctrl, |
| cac_cfg_t const *const | p_cfg ) |
The Open function configures the CAC based on the provided user configuration settings.
| FSP_SUCCESS | CAC is available and available for measurement(s). |
| FSP_ERR_ASSERTION | An argument is invalid. |
| FSP_ERR_ALREADY_OPEN | The CAC has already been opened. |
| fsp_err_t R_CAC_StartMeasurement | ( | cac_ctrl_t *const | p_ctrl | ) |
Start the CAC measurement process.
| FSP_SUCCESS | CAC measurement started. |
| FSP_ERR_ASSERTION | NULL provided for p_instance_ctrl or p_cfg. |
| FSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
| fsp_err_t R_CAC_StopMeasurement | ( | cac_ctrl_t *const | p_ctrl | ) |
Stop the CAC measurement process.
| FSP_SUCCESS | CAC measuring has been stopped. |
| FSP_ERR_ASSERTION | NULL provided for p_instance_ctrl or p_cfg. |
| FSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
| fsp_err_t R_CAC_Read | ( | cac_ctrl_t *const | p_ctrl, |
| uint32_t *const | p_counter ) |
Read and return the CAC status and counter registers.
| FSP_SUCCESS | CAC read successful. |
| FSP_ERR_ASSERTION | An argument is NULL. |
| FSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
| fsp_err_t R_CAC_CallbackSet | ( | cac_ctrl_t *const | p_ctrl, |
| void(* | p_callback )(cac_callback_args_t *), | ||
| void *const | p_context, | ||
| cac_callback_args_t *const | p_callback_memory ) |
Updates the user callback with the option to provide memory for the callback argument structure. Implements cac_api_t::callbackSet.
| 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_NO_CALLBACK_MEMORY | p_callback is non-secure and p_callback_memory is either secure or NULL. |
| fsp_err_t R_CAC_Close | ( | cac_ctrl_t *const | p_ctrl | ) |
Release any resources that were allocated by the Open() or any subsequent CAC operations.
| FSP_SUCCESS | Successful close. |
| FSP_ERR_ASSERTION | NULL provided for p_instance_ctrl or p_cfg. |
| FSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |