cancel
Showing results for 
Search instead for 
Did you mean: 

Code Examples

RonakH
New Contributor

Hello everyone,

I am sharing a project that shows a basic example of how we can use the SCB UART block to wake up the PSoC 4 from DeepSleep mode. I have seen multiple examples of using the I2C for waking up PSoC 4 from DeepSleep. The example with UART is a useful one that can be used in various projects.

 

Kit used: CY8CKIT-145-40XX PSoC 4000S Prototyping Kit (Link)

Softwares used: PSoC Creator 4.4, Tera Term

Documents referred: PSoC 4 Serial Communication Block (SCB) Component Datasheet (Link)

Method:

  • Select an empty project
  • In the TopDesign add the UART component (Make sure it is SCB version of UART not UDB) 
  • Mark the option “Enable wakeup from Deep Sleep Mode” in the configuration window option for the UART SCB block component
  • I have attached the screenshot of what configuration I have done for the UART 

RonakH_0-1621094424453.png

  • Also, add a Digital Output pin in the TopDesign which will be used in connecting an LED that will indicate in which mode PSoC 4 is currently in. 

 

RonakH_1-1621095000658.png

  • The next step of the project is the Pin Assignment
  • Attaching the screenshot of my pin assignment for the project attached. You may change it according to the board used by you

RonakH_2-1621095201331.png

Code:

int main(void)
{
CyGlobalIntEnable;
UART_Start();

for(;;)
{

LED_Write(0); CyDelay(100);
LED_Write(1); CyDelay(100);
LED_Write(0); CyDelay(100);
LED_Write(1); CyDelay(100);
LED_Write(0); CyDelay(100);
LED_Write(1); CyDelay(100);

UART_Sleep();  // required to be used to use the feature of UART to wakeup the device from DeepSleep
CySysPmDeepSleep();
UART_Wakeup();

}
}

 

Observations:

The program is written such that the LED will remain off in the deep sleep mode but when the device enters the active mode it will blink 3 times after which the device enters the deep sleep mode again.

After configuring any terminal software(I have used Tera Term) you can connect to the PSoC kit with UART. After which entering any character which will make the device Wakeup from the DeepSleep mode. Thus any character entered in the terminal will lead to the LED getting blicked 3 times.


Attaching the project here

Thanks and regards,

Ronak H

 

 

0 Likes
1 Reply
Hari
Moderator
Moderator

Hi Ronak, 

 

Thank you for sharing this project with the community 🙂

 

Best regards, 

Hari

0 Likes