Skip to content

Commit 92b019f

Browse files
committed
FUTURE_SEQUANA_PSA: fixed deep sleep mode
Enabled tickless mode for Sequana PSA M0 core code to allow it to enter deep sleep mode. This fixes issue #9094 where tests were failing due to M0 core not entering deep sleep mode, blocking the whole chip. Fixed incorrect resource management on M0 core, which crashed tickless mode.
1 parent 160a771 commit 92b019f

File tree

7 files changed

+29698
-28969
lines changed

7 files changed

+29698
-28969
lines changed

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/TARGET_CY8C63XX/device.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,13 @@
6767
* multiplexer. This requires that we define which of the 32 NVIC channels is used
6868
* by which interrupt. This is done here.
6969
*/
70-
#define CY_M0_CORE_IRQ_CHANNEL_US_TICKER ((IRQn_Type)0)
70+
#define CY_M0_CORE_IRQ_CHANNEL_LP_TICKER ((IRQn_Type)0)
71+
#define CY_M0_CORE_IRQ_CHANNEL_IPC_SYS ((IRQn_Type)1)
72+
#define CY_M0_CORE_IRQ_CHANNEL_IPC_USR ((IRQn_Type)2)
73+
#define CY_M0_CORE_IRQ_CHANNEL_PSA_MAILBOX ((IRQn_Type)3)
7174
#define CY_M0_CORE_IRQ_CHANNEL_SERIAL ((IRQn_Type)4)
72-
#define CY_M0_CORE_IRQ_CHANNEL_BLE ((IRQn_Type)3)
75+
#define CY_M0_CORE_IRQ_CHANNEL_BLE ((IRQn_Type)7)
76+
#define CY_M0_CORE_IRQ_CHANNEL_US_TICKER ((IRQn_Type)8)
7377

7478
/** Identifiers used in allocation of NVIC channels.
7579
*/
@@ -78,4 +82,5 @@
7882
#define CY_BLE_IRQN_ID (0x300)
7983
#define CY_GPIO_IRQN_ID (0x400)
8084
#define CY_LP_TICKER_IRQN_ID (0x500)
85+
#define CY_PSA_MAILBOX_IRQN_ID (0x600)
8186
#endif

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/TARGET_FUTURE_SEQUANA_M0_PSA/spm_init_api.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020

2121
#include "spm_api.h"
2222

23-
#include "cmsis.h"
23+
#include "device.h"
2424
#include "cyip_ipc.h"
2525
#include "cy_ipc_drv.h"
2626
#include "cy_syslib.h"
2727
#include "cy_sysint.h"
28-
28+
#include "psoc6_utils.h"
29+
#include "mbed_error.h"
2930

3031

3132
/* ------------------------------------ Definitions ---------------------------------- */
@@ -65,9 +66,12 @@ void mailbox_init(void)
6566

6667
// Configure interrupts ISR / MUX and priority
6768
cy_stc_sysint_t ipc_intr_Config;
68-
ipc_intr_Config.intrSrc = (IRQn_Type)NvicMux3_IRQn; // Can be any Mux we choose
69+
ipc_intr_Config.intrSrc = CY_M0_CORE_IRQ_CHANNEL_PSA_MAILBOX;
6970
ipc_intr_Config.cm0pSrc = (cy_en_intr_t)cpuss_interrupts_ipc_0_IRQn + SPM_IPC_NOTIFY_CM0P_INTR; // Must match the interrupt we trigger using NOTIFY on CM4
7071
ipc_intr_Config.intrPriority = 1;
72+
if (cy_m0_nvic_reserve_channel(CY_M0_CORE_IRQ_CHANNEL_PSA_MAILBOX, CY_PSA_MAILBOX_IRQN_ID) == (IRQn_Type)(-1)) {
73+
error("PSA SPM Mailbox NVIC channel reservation conflict.");
74+
}
7175
(void)Cy_SysInt_Init(&ipc_intr_Config, ipc_interrupt_handler);
7276

7377
// Set specific NOTIFY interrupt mask only.

0 commit comments

Comments
 (0)