cy_ble_clk_8h

The header file of the BLE ECO clock driver.

Version

3.60

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
Copyright

Copyright 2017-2020 Cypress Semiconductor Corporation SPDX-License-Identifier: Apache-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defines

CY_BLE_CLK_DRV_VERSION_MAJOR

Driver major version.

CY_BLE_CLK_DRV_VERSION_MINOR

Driver minor version.

CY_BLE_CLK_ID

Driver ID.

Enums

enum cy_en_ble_mxd_radio_clk_div_t

cy_en_ble_mxd_radio_clk_div_t: BLE Radio ECO clock divider.

Values:

enumerator CY_BLE_MXD_RADIO_CLK_DIV_1
enumerator CY_BLE_MXD_RADIO_CLK_DIV_2
enumerator CY_BLE_MXD_RADIO_CLK_DIV_4
enumerator CY_BLE_MXD_RADIO_CLK_DIV_8
enumerator CY_BLE_MXD_RADIO_CLK_DIV_16
enum cy_en_ble_mxd_radio_clk_buf_amp_t

cy_en_ble_mxd_radio_clk_buf_amp_t: Sine wave buffer output capability select.

Values:

enumerator CY_BLE_MXD_RADIO_CLK_BUF_AMP_16M_SMALL
enumerator CY_BLE_MXD_RADIO_CLK_BUF_AMP_16M_LARGE
enumerator CY_BLE_MXD_RADIO_CLK_BUF_AMP_32M_SMALL
enumerator CY_BLE_MXD_RADIO_CLK_BUF_AMP_32M_LARGE
enum cy_en_ble_bless_xtal_clk_div_config_llclk_div_t

cy_en_ble_bless_xtal_clk_div_config_llclk_div_t: BLESS clock divider.

Values:

enumerator CY_BLE_BLESS_XTAL_CLK_DIV_1
enumerator CY_BLE_BLESS_XTAL_CLK_DIV_2
enumerator CY_BLE_BLESS_XTAL_CLK_DIV_4
enumerator CY_BLE_BLESS_XTAL_CLK_DIV_8
enum cy_en_ble_eco_freq_t

cy_en_ble_eco_freq_t: BLE ECO Clock Frequency.

Values:

enumerator CY_BLE_BLESS_ECO_FREQ_16MHZ

ECO Frequency of 16MHz.

enumerator CY_BLE_BLESS_ECO_FREQ_32MHZ

ECO Frequency of 32MHz.

enum cy_en_ble_eco_sys_clk_div_t

cy_en_ble_eco_sys_clk_div_t: BLE ECO System clock divider.

Values:

enumerator CY_BLE_SYS_ECO_CLK_DIV_1

Link Layer clock divider = 1.

enumerator CY_BLE_SYS_ECO_CLK_DIV_2

Link Layer clock divider = 2.

enumerator CY_BLE_SYS_ECO_CLK_DIV_4

Link Layer clock divider = 4.

enumerator CY_BLE_SYS_ECO_CLK_DIV_8

Link Layer clock divider = 8.

enumerator CY_BLE_SYS_ECO_CLK_DIV_INVALID

Invalid Link Layer clock divider.

enum cy_en_ble_eco_status_t

cy_en_ble_eco_status_t: BLE ECO Clock return value.

Values:

enumerator CY_BLE_ECO_SUCCESS

ECO started successfully.

enumerator CY_BLE_ECO_BAD_PARAM

Invalid input param values.

enumerator CY_BLE_ECO_RCB_CONTROL_LL

RCB is not available for Firmware control to restart ECO.

enumerator CY_BLE_ECO_ALREADY_STARTED

ECO already started.

enumerator CY_BLE_ECO_HARDWARE_ERROR

Hardware error.

enum cy_en_ble_eco_voltage_reg_t

cy_en_ble_eco_voltage_reg_t: BLE Voltage regulator.

Values:

enumerator CY_BLE_ECO_VOLTAGE_REG_AUTO

Use SIMO Buck or BLE LDO regulator depend on system usage.

enumerator CY_BLE_ECO_VOLTAGE_REG_BLESSLDO

Use BLE LDO.

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.

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.

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.

Returns

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

void Cy_BLE_EcoReset(void)

This API resets and disables the BLE ECO clock.

Returns

None

__STATIC_INLINE bool Cy_BLE_EcoIsEnabled (void)

Reports the Enabled/Disabled BLE ECO status.

Returns

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