- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
My application communicates via UART to a CYBLE-416045-02. Before sending anything to the PSoC, I set a GPIO (named RTS) that toggles an interrupt on the PSoC, which in turns wakes it from deepsleep, and the PSoC then sets its pin CTS, which tells my application that the data can be sent. The PSoC then won't go to deepsleep until the RTS pin has been set to low. Here's what the code looks like on my application:
int Uart_Send(uint8_t* bytes, size_t len) {
Gpio_Write(RTS, 1);
// We block here to wait for the PSoC to wake up from deepsleep, which shouldn't be too long
while(!Gpio_Read(CTS)) {
Gpio_Write(RTS, 0); // We toggle the pin to make sure that
Gpio_Write(RTS, 1); // the PSoC didn't miss any GPIO interrupt
}
return uart.send(bytes, len);
}
void Uart_EndOfTransactionCallback() {
Gpio_Write(RTS, 0);
}
I was previously on PDL 3.0.4 and never had issues with this code. However, after upgrading to PDL 3.1.2 and performing the necessary changes (see below), it seems that the PSoC sometimes hangs in deepsleep and stops responding to my GPIO requests, as my application never leaves the while loop. Also worth noting that the problem disappears if I comment the Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT); line from the PSoC.
Here are the changes that were required after upgrading to PDL 3.1.2:
- Redefining CY_CORTEX_M4_APPL_ADDR to the correct address in system_psoc6.h
- Changing my use of the CY_IPC_CYPIPE_INTR_MASK macro to CY_SYS_CYPIPE_INTR_MASK
I did try to delete the "Generated_Source" folder and performing a Clean&Build, but that did not fix the problem.
Has this behavior been observed by anyone?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just remind you one possible cause of failed wake up from DeepSleep, it's described in the following KBA - Updating PDL syspm Driver for Hard Fault Problem – KBA229335
Can you take a try and then let me know if it's helpful?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you test on DVK board or custom board? What's the silicon version?
Just from your description, it looks you device can not be waken up from DeepSleep through GPIO interrupt, right?
I have tried another code example implementing interrupt from DeepSleep, and it can work with PDL3.1.2 - https://www.cypress.com/documentation/code-examples/ce219521-psoc-6-mcu-gpio-interrupt
Can you refer to this code example for any possible cause?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just remind you one possible cause of failed wake up from DeepSleep, it's described in the following KBA - Updating PDL syspm Driver for Hard Fault Problem – KBA229335
Can you take a try and then let me know if it's helpful?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ShipingW_81,
I don't think it's a GPIO interrupt problem, as it works most of the times, but sporadically fails. The KBA seems interesting, I'll try it and make my application run for the day to see if it crashes.
Thanks,
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ShipingW_81,
It's been running for 22 hours, now, so I think it's safe to say that the fix worked! Thank you.
I will add a pre-build instruction that overwrites the automatically generated file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fred, Glad to see your issue get resolved!