2025-07-18 8:51 AM
Hi,
I'm working on a STM32h747 dual core and I'm trying to put the CM4 to sleep so that it wakes up only on a CM7 event.
I used _WFE on CM4 and _SEV on CM7 but the CM4 is never wake up. I release a HSEM directly after WFE in CM4 to notify the CM7 that the CM4 is awake and I never receive it. I tested the HSEM mechanism without putting the CM4 to sleep and it works well.
Here the sleep procedure for the CM4 :
// Disable SEVONPEND => this bit define all pending interrupt (even disabled) as event
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
// Disable all interrups
__disable_irq();
// Enter in stop mode
/* Select the regulator state in STOP mode */
MODIFY_REG (PWR->CR1, PWR_CR1_LPDS, PWR_MAINREGULATOR_ON);
/* Set SLEEPDEEP bit of Cortex System Control Register */
SET_BIT (SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
/* Ensure that all instructions are done before entering STOP mode */
__DSB ();
__ISB ();
//Generate an event to clean pending events
__SEV();
__WFE(); // Consume manual event
//Sleep
__WFE ();
On CM7 side I only use __SEV when I want to wake up the CM4.
Where I did wrong ?