Are you clearing the Pin interrupts in the associated Pin ISR?
Yes I added a "Clearpending" in the ISR.
But the problem might be that the interrupt is not going to the place I think it is, owing to the structure of the bootloader.
Found this still wont work in a standard non-bootloadable project.
In the attached, no wake when P2-0 activated. In fact worse than that the code usually stops working completely when this pin is activated.
Thanks, that confirms I have it all configured correctly.
It does not explain why the interrupt not waking the CPU though. The examples dont show a sleep/wake scenario.
I got this to work outside of the bootloader but still not working in bootloader.
The documentation suggests a number of options but in the end there is only one configuration which works ie:
The Interrupt component must be used, using the pin interrupt alone does not work. This must be connected to the ISR connection from the pin icon.
The interrupt component must not be configured as "level" (despite the app note example having it configured this way) it must be "Derived" and the pin interrupt set to falling or rising.
The interrupt component interrupt must be started during init.
In the ISR the PIN interrupt must be cleared (not the interrupt component interrupt)
Before sleeping the PIN interrupt must be cleared and the interrupt component interrupt must be enabled.
The interrupt component interrupt must be disabled when not sleeping.
This all works but when I transfer the same config to a bootloadable the code sticks in the ISR for ever.
EDIT: Now got this to work in the bootloadable! What a struggle.
It appears that the pins and interrupts need to be defined in the bootloader not the bootloadable. Then a StartEX can be done in the bootloadable to relocate the ISR into the bootloadable.
There is a huge omission in all the bootloader documentation. When a function which exists in the bootloader is called from the bootloadable simply defining it as an "extern" in SharedProjectAPI.h (as the docs state) is not enough. A file in the Bootloader "scripts" folder called "symbol_list.txt" needs to be edited to add it, otherwise it will not be found by the compiler.
Can you please upload your complete project again? In the first workspace bundle I could not see any handlings with the pin-interrupt.
I thought I would post the final resolution to this issue which I eventually found after many days in case anyone else falls into the trap.
In fact no interrupts were working in the bootloadable which I discovered when adding a timer interrupt.The reason is this: In the bootloadable there is a function "InitializeBootloaderSRAM". If this is called after any interrupts are defined, it overwrites the bootloadable vector table with the one from the bootloader so any defined vectors are reset back to the bootloader default handler which is an infinite loop.
Andy, thank you very much sharing your experience with us! To get it quite clear for me: Where was the call to InitializeBootloaderSRAM() placed? Did you insert that or was it called accidently??
The call is in the example bootloader/bootloadable projects in "main".
I was using this as a base but I put the definition of the timer and GPIO interrupts before it instead of after it. This call must be the very first line in "main".
The problem caused the code to jump back into the bootloader code from the bootloadable on any interrupt so was not obvious what was going on in the debugger as it would get lost.
Another issue with the bootloader which I raised a case for and has now been resolved:
Any component placed in the bootloadable schematic would be non-functional unless also placed in the bootloader schematic.
The workaround from Cypress:
Comment out or remove line#82 (Bootloader__libc_init_array();) of BtldrSramInit.c file in the bootloadable project.
This will be fixed in Creator 3.2 SP1