Functions

group group_ble_clk_functions

Functions

cy_en_ble_eco_status_t Cy_BLE_EcoConfigure(cy_en_ble_eco_freq_t freq, cy_en_ble_eco_sys_clk_div_t sysClkDiv, uint32_t cLoad, uint32_t xtalStartUpTime, cy_en_ble_eco_voltage_reg_t voltageReg)

This API configures and enables the BLE ECO clock.

If Cy_BLE_Enable() API is called by the application, the stack enables the BLE ECO clock automatically with the following default parameters:

Parameter

Value

ECO Frequency

CY_BLE_DEFAULT_ECO_FREQ

Divider

CY_BLE_DEFAULT_ECO_DIV

Startup time

CY_BLE_DEFAULT_OSC_STARTUP_DELAY_LF

Load cap

CY_BLE_DEFAULT_CAP_TRIM_VALUE

If there is a need to start the BLE ECO with non-default parameters, call the

Cy_BLE_EcoConfigure() function with the custom configuration each time before calling the Cy_BLE_Enable() function.

This clock is stopped in Deep Sleep and Hibernate power modes.

Error Codes

Description

CY_BLE_ECO_SUCCESS

The function completed successfully.

CY_BLE_ECO_BAD_PARAM

The wrong input parameter.

CY_BLE_ECO_RCB_CONTROL_LL

The RCB Control is with BLE Link Layer.

CY_BLE_ECO_ALREADY_STARTED

The BLE ECO clock is already started.

CY_BLE_ECO_HARDWARE_ERROR

The RCB or BLE ECO operation failed.

For the PSoC 64 devices, there are possible situations when the function returns the PRA error status code. This is because for PSoC 64 devices, the function uses the PRA driver to change the frequency value on the protected side. Refer to

cy_en_pra_status_t for more details.
Return

cy_en_ble_eco_status_t : The return value indicates if the function succeeded or failed. The possible error codes:

Parameters
  • freq: - Operating frequency of the crystal, type of cy_en_ble_eco_freq_t.

  • sysClkDiv: - System divider for ECO clock, type of cy_en_ble_eco_sys_clk_div_t.

  • cLoad: - ECO crystal load capacitance in multiple of 0.075pF (pF_from_user valid range: 7.5…26.625pF) cLoad = ((pF_from_user - 7.5)/0.075)

  • xtalStartUpTime: - ECO crystal startup time in multiple of 31.25us (startup_time_from_user valid range: 400…4593.75us) xtalStartUpTime = startup_time_from_user/31.25

  • voltageReg: - BLE Voltage regulator, type of cy_en_ble_eco_voltage_reg_t.

note

Limitation: Do not call this API if the BLE is executed with LPM. There is a risk that when the Cy_BLE_EcoConfigure() function is called on one core, the BLE is in Deep Sleep mode on the other core. It will cause a fault hard exception.

Function Usage

    /* BLE ECO configuration: ECO Frequency: 32 MHZ, Divider: 2 */
    /* Start-up time(uS): 1500, Load cap(pF): 9.9 */
    
    uint32_t startTime = (uint32_t)(1500 / 31.25);
    uint32_t loadCap   = (uint32_t)((9.9 - 7.5) / 0.075);
    
    /* Configure the BLE ECO clock */
    (void) Cy_BLE_EcoConfigure(CY_BLE_BLESS_ECO_FREQ_32MHZ, CY_BLE_SYS_ECO_CLK_DIV_2, loadCap, startTime, CY_BLE_ECO_VOLTAGE_REG_AUTO);
    
    /* In case if there is a need to get the BLE ECO frequency */
    uint32_t bleEcoFreq = Cy_SysClk_AltHfGetFrequency();

Side Effects

The I/O pins will be automatically unfrozen coming out of Hibernate when the BLE ECO is in use.

void Cy_BLE_EcoReset(void)

This API resets and disables the BLE ECO clock.

Return

None

__STATIC_INLINE bool Cy_BLE_EcoIsEnabled (void)

Reports the Enabled/Disabled BLE ECO status.

Return

Boolean status of BLE ECO: true - Enabled, false - Disabled.