Low Power Callbacks

group group_scb_spi_low_power_functions

Functions

cy_en_syspm_status_t Cy_SCB_SPI_DeepSleepCallback(cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)

This function handles the transition of the SCB SPI into and out of Deep Sleep mode.

It prevents the device from entering Deep Sleep mode if the SPI slave or master is actively communicating, or there is any data in the TX or RX FIFOs. The following behavior of the SPI SCB depends on whether the SCB block is wakeup-capable or not:

  • Wakeup-capable: any transfer intended to the slave wakes up the device from Deep Sleep mode. The slave responds with 0xFF to the transfer and incoming data is ignored. If the transfer occurs before the device enters Deep Sleep mode, the device will not enter Deep Sleep mode and incoming data is stored in the RX FIFO. The SCB clock is disabled before entering Deep Sleep and enabled after the device exits Deep Sleep mode. The SCB clock disabling may lead to corrupted data in the RX FIFO. Clear the RX FIFO after this callback is executed. Note that for proper SPI operation after Deep Sleep the source of hf_clk[0] must be stable, this includes the FLL/PLL. The SysClk callback ensures that hf_clk[0] gets stable and it must be called before Cy_SCB_SPI_DeepSleepCallback. Only the SPI slave can be configured to be a wakeup source from Deep Sleep mode.

  • Not wakeup-capable: the SPI is disabled. It is enabled when the device fails to enter Deep Sleep mode or it is awakened from Deep Sleep mode. While the SPI is disabled, it stops driving the outputs and ignores the inputs. Any incoming data is ignored. Refer to section Low Power Support for more information about SPI pins when SCB disabled.

This function must be called during execution of Cy_SysPm_CpuEnterDeepSleep. To do it, register this function as a callback before calling Cy_SysPm_CpuEnterDeepSleep : specify CY_SYSPM_DEEPSLEEP as the callback type and call Cy_SysPm_RegisterCallback.

note

Only applicable for rev-08 of the CY8CKIT-062-BLE. For proper operation, when the SPI slave is configured to be a wakeup source from Deep Sleep mode, this function must be copied and modified by the user. The SPI clock disable code must be inserted in the CY_SYSPM_BEFORE_TRANSITION and clock enable code in the CY_SYSPM_AFTER_TRANSITION mode processing.

Parameters
Returns

cy_en_syspm_status_t

cy_en_syspm_status_t Cy_SCB_SPI_HibernateCallback(cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)

This function handles the transition of the SCB SPI into Hibernate mode.

It prevents the device from entering Hibernate mode if the SPI slave or master is actively communicating, or there is any data in the TX or RX FIFOs. If the SPI is ready to enter Hibernate mode, it is disabled. If the device failed to enter Hibernate mode, the SPI is re-enabled. While the SPI is disabled, it stops driving the outputs and ignores the inputs. Any incoming data is ignored. Refer to section Low Power Support for more information about SPI pins when SCB disabled.

This function must be called during execution of Cy_SysPm_SystemEnterHibernate. To do it, register this function as a callback before calling Cy_SysPm_SystemEnterHibernate : specify CY_SYSPM_HIBERNATE as the callback type and call Cy_SysPm_RegisterCallback.

Parameters
Returns

cy_en_syspm_status_t