Activating GPIO output in < 10usec when exiting Hibernate Mode

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

cross mob
MikeAustin
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

I have an application where I am trying to minimise current draw when waiting for an external trigger signal, but then need the PSOC to leap out of bed and set one of my GPIO pins high as quickly as possible - I'm talking sub 10usec after the trigger is received, if possible.

I'm putting my code into Hibernate and triggering it out of this mode with a GPIO interrupt.  But I'm coming up against a couple of issues:

1.  In the default start up code that PSOC Creator spews out (cyfitter_cfg.c), there are a number of delays (one of them is 500msec!!) slotted into the startup code to allow various clocks to settle.  So, if I leave the cyfitter_cfg.c as is, I've got no hope.  I'm seeing delays of 520msec or more between when the trigger occurs, and when my GPIO is set high.

2. In attempt to get around the above issue, I manually changed cyfitter_cfg.c so that the very first thing it does is write to one of my GPIO pins, but I think some other code needs to run beforehand, so that the appropriate GPIO is configured correctly (in my case as an output with Strong Drive).  This is where I read this: https://community.cypress.com/t5/Knowledge-Base-Articles/GPIO-State-during-Startup-in-PSoC-4-KBA2279...

I read in the datasheet for the PSOC4 that the wakeup time for the PSOC4 to exit Hibernate mode is 3msec, but its not clear what this refers to, particularly given the fact that there is a 500msec thumb-twiddling delay inserted into the start up code by default.

Does anyone know a way I can get my GPIO pin set up and write a "1" to it in the sort of time frame  I'm needing? (< 10usec after the trigger signal)

Cheers,

Mike

0 Likes
1 Solution
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

The minimum time required for the device to wake up from Hibernate mode/Stop mode and execute the first instruction is around 2 milli seconds (if you are using PSoC 4200). Please note that this time cannot be reduced. 

After this time, you can modify the start-up code and write directly to the registers without using any APIs.

Thanks and regards

Ganesh

View solution in original post

0 Likes
3 Replies
MikeAustin
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

OK, had a further play around with this.  Added my "write to GPIO pin" code at Line 344 of cyfitter_cgf.c (just after its set up all the base addresses for the GPIO ports) and this reduced the time to activation down to around 1.8msec from the time the trigger was applied to bring the chip out of Hibernate mode.

I'm still no where near my target figure of 10usec though 😞

0 Likes
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

There are basically two components of MCU boot. 1. Hardware Boot 2. Software Boot

1. The Hardware Boot time is fixed. 

2. During software boot you can set the GPIO status as early as possible. For that you can write to GPIO register directly just after firmware execution reaches reset vector. Please find the corresponding register address from the PSoC 4x Registers TRM ( x is varied with respect to device family).

Please let us know the time improvements.

Thanks 

Ganesh

0 Likes
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

The minimum time required for the device to wake up from Hibernate mode/Stop mode and execute the first instruction is around 2 milli seconds (if you are using PSoC 4200). Please note that this time cannot be reduced. 

After this time, you can modify the start-up code and write directly to the registers without using any APIs.

Thanks and regards

Ganesh

0 Likes