freeRTOS CapSense deep sleep

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JaVe_4484771
Level 1
Level 1

Hi,

I'm using the psoc6 dev kit for development. We have freeRTOS enabled with a couple of tasks running. The main ones are tasks for ble and CapSense. Is there a way to put the device in deep sleep mode with freeRTOS enabled?

I know the CapSense has to be woken up  from deep sleep using an interrupt to poll it. We tried using the ble interrupt call back function for that. I also tried using a Watchdog interrupt to wake up the cap sense, but it doesn't seem to work. Are there any examples for psoc 6 with ble+capsense+freeRTOS+deepsleep?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hi JaVe_4484771​,

Please find the attached project the implements the CapSense task in Implementing BLE Multi-connection (4 Slaves) project with DeepSleep and RTOS.

The CapSense scan is implemented in two modes:

1. Fast Scan mode - > Refresh Rate is 30 ms.

2. Slow Scan mode - > Refresh rate is 200 ms

These values can be configured based on the touch response.

Device starts with the fast scan mode with refresh rate set to 30 ms. Refresh rate is set using vTaskDelay(). When there is a touch, the device stays in fast scan mode. If there is no valid touch for SCANMODE_TIMEOUT_VALUE amount of time, device enters the slow scan mode.

In the slow scan mode, the device scans for every 200 ms. If there is a valid touch, the device moves into the fast scan mode.

Please refer to the code example document available with the BLE project for implementation details of BLE.

Please test this project and let us know it works at your end.

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

7 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi JaVe_4484771​,

You can refer to the code example CE223508 – PSoC 6 MCU Implementing BLE Multi-connection (4 Slaves) for Deep sleep + RTOS + BLE.

https://www.cypress.com/documentation/code-examples/ce223508-psoc-6-mcu-implementing-ble-multi-conne...

You can refer to the code example  CE218136 - PSoC 6 MCU E-INK Display with CapSense (RTOS) for CapSense + RTOS

https://www.cypress.com/documentation/code-examples/ce218136-psoc-6-mcu-e-ink-display-capsense-rtos

Please let us know if you find any difficulties in combining the two projects. We are happy to help.

You can also refer to the following project that has PSoC 4 based r Deep sleep + RTOS + BLE + CapSense

Free RTOS with PSoC 4 BLE - Hackster.io

Reference:

Tickless Low power features in FreeRTOS

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

I combined the two projects by adding a cap sense task to the first project, but the cap sense doesn't seem to wake up from deep sleep. I've attached a copy of the modified example I'm working with.

0 Likes
lock attach
Attachments are accessible only for community members.

Hi JaVe_4484771​,

Please find the attached project the implements the CapSense task in Implementing BLE Multi-connection (4 Slaves) project with DeepSleep and RTOS.

The CapSense scan is implemented in two modes:

1. Fast Scan mode - > Refresh Rate is 30 ms.

2. Slow Scan mode - > Refresh rate is 200 ms

These values can be configured based on the touch response.

Device starts with the fast scan mode with refresh rate set to 30 ms. Refresh rate is set using vTaskDelay(). When there is a touch, the device stays in fast scan mode. If there is no valid touch for SCANMODE_TIMEOUT_VALUE amount of time, device enters the slow scan mode.

In the slow scan mode, the device scans for every 200 ms. If there is a valid touch, the device moves into the fast scan mode.

Please refer to the code example document available with the BLE project for implementation details of BLE.

Please test this project and let us know it works at your end.

Regards,

Bragadeesh

Regards,
Bragadeesh

Hi,

The capsense only seems to work when I comment out Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT) in vApplicationSleep

0 Likes

Hi JaVe_4484771​,

Could you please let us know how you are confirming that the CapSense is not working when in deep sleep?

I'm using the same project at my end and it is working fine. Have you modified anything in the project?

Regards,

Bragadeesh

Regards,
Bragadeesh

Hi,

Sorry, it looks like it is working with Deep sleep. I believe led8 blinks with button1 touch. Do you know what the approximate expected current for this project should be?

0 Likes

Hi JaVe_4484771​,


We're glad that the solution works at your end.

The power consumption (average) will depend on the blocks that are turned ON , how long they are turned ON and how long the system stays in deep sleep/ sleep mode (depends on application).

Therefore, we recommend you to refer to the PSoC datasheet and look for the active/ sleep / deep sleep mode power consumption to determine the actual power consumed by your device for this application.

Regards,

Bragadeesh

Regards,
Bragadeesh