CYBLE-022001-00 fails to hibernate

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

cross mob
Anonymous
Not applicable

Hello All,

I am working on a project using CYBLE-022001-00. I have noticed that the despite calling CySysPmHibernate() device fails to hibernate. The function call to CySysPmHibernate() simply returns. This looks exactly like the issue described here:

PsoC 4100 is not properly waking from Hibernate with GPIO Interupt

It seems the device fails to hibernate around once every 50 times. Then it gets locked in the wakeup interrupt as interrupt flag is never cleared.

Is there a bug in the CYBLE-022001-00 causing this?

Regards,

Piotr

0 Likes
1 Solution
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Have you tested the project attached in this thread - PsoC 4100 is not properly waking from Hibernate with GPIO Interupt  ? Let me know if you are having the same issue with this project , so that we can proceed the debugging further.

-Gyan

View solution in original post

0 Likes
10 Replies
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Have you tested the project attached in this thread - PsoC 4100 is not properly waking from Hibernate with GPIO Interupt  ? Let me know if you are having the same issue with this project , so that we can proceed the debugging further.

-Gyan

0 Likes
Anonymous
Not applicable

Hi Gyan,

Thanks for your reply.

The project attached to this thread has this piece of code:

    for(;;)

    {

        /* Place your application code here. */

        CySysPmFreezeIo();

        CySysPmHibernate();

    }

This looks like it will try to hibernate until it will succeed. I don't see a reason to use  "for(;;)" unless there is a bug in the cypress module/software and it won't hibernate from time to time.

I have already "solved" my problem by simply doing this:

CySysPmHibernate();   

CySoftwareReset();

But what I need to know is why this problem is occurring. If this is caused by a memory leak/ bad practice on my side I need to look for the cause. Simply patching it without knowing the reason is not enough for me.

Regards,

Piotr

0 Likes

Hello Piotr,

      The API CySysPmHibernate() will put the system in Hibernate Low Power State on  a single call. It does not return any failure code. It is used in for(;;) loop because as soon as the application activity is finished we want to put our device in Hibernate Mode. You can put it anywhere based on your application.

For your reported issue , your workaround is meaningless because if the CPU is stuck somewhere then who will execute CySoftwareReset();.

Please test the project mentioned in that thread and let me know if you see any issues. If you see the issue then let me know your test setup. If you are using any custom board please share the schematic and your firmware.

-Gyan

0 Likes
Anonymous
Not applicable

Thanks Gyan,

I think this sentence:

It is used in for(;;) loop because as soon as the application activity is finished we want to put our device in Hibernate Mode.

doesn't make sense. After waking up from the hibernation the device should start from the reset vector, so calling it in infinite loop is misleading, unless you want to workaround bug.

You are right my solution would be meaningless the same way how the for(;;) is meaningless if the API would works as intended, but it doesn't.

I can see using a debugger or using a IO pin to debug that the code simply skips the hibernation and continue executing.

If I use the test project you have mentioned without removing the for loop I am sure it will work.

I think if you don't trust in what I am saying it is pointless discussing it any further. Maybe someone else with similar experience will comment here.

Regards,

Piotr

0 Likes

Hello Piotr,

     We have not denied till now that there is no issue. We are asking you to test the mentioned project in thread or share your project/ hardware files so that we can test and find if there is any such issues.

Since in the thread you mentioned the customer has not come back with any further updates and we assume that the issue was because of user errors.

-Gyan

0 Likes
Anonymous
Not applicable

I cannot reproduce the issue using your project. In other words it works as expected.

However it doesn't really help me. The project is very simple, it doesn't include BLE stack at all, so there is no interactions between modules, hence I am still not sure which part of the code is causing the problem, cypress API or my software.

Anyway I won't spent more time on it, as I cannot justify it since I have a working workaround.

Thank you for your help.

Regards,

Piotr

0 Likes
It is used in for(;;) loop because as soon as the application activity is finished we want to put our device in Hibernate Mode.

doesn't make sense. After waking up from the hibernation the device should start from the reset vector, so calling it in infinite loop is misleading, unless you want to workaround bug.

GYAN: If the device is locked in ISR then how calling this API in for(;;) will help to workaround this bug. I meant calling this API in infinite loop is one approach and you can use it anywhere as I mentioned in my previous response.

0 Likes
Anonymous
Not applicable
GYAN: If the device is locked in ISR then how calling this API in for(;;) will help to workaround this bug.

You are calling CySysPmFreezeIo(); so you will have no interrupts if failed to hibernate.

About my case, sorry I forgot to mention that I disable the global interrupts before hibernating to be able to proceed with the code execution. I seems that the state of the global interrupts flag is irrelevant when in hibernation state.

CyGlobalIntDisable;

Wakeup_Interrupt_ClearPending();   

Wakeup_Interrupt_Start();

CySysPmHibernate();

CySoftwareReset();

I will try testing your project.

Regards,

Piotr

0 Likes
Anonymous
Not applicable

By the way here is another report of a similar issue:

Hibernate Fails After User SFlash Write

I am using the flash as well in my project. However I took out the code writing too it during tests to see if it helps and it didn't.

0 Likes

Could you please share the project where I can reproduce the issue and the steps to follow for testing the project ? if not complete , a simple version of your project which can reproduce it.

-Gyan

0 Likes