cancel
Showing results for 
Search instead for 
Did you mean: 

How to use CM4 SEV to communicate between CM4 and CM7 on STM32H7

OADDI.1
Associate II

Hello,

I'm trying to use the CM4_SEV_IRQHandler to send interrupt to the CM7 by CM4.

Do you know if there is some documentation about that because the reference manual just give the number of NVIC about this interrupt (p.800/3528)?

Can I use this interrupt to communicate between CM4 and CM7 with a shared SRAM?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
RMcCa
Senior II

The sev appears to be about synchronizing​ wakeups between processors. The two processors have seperate nvics connected to common sources. One core can start a hardware process that interrupts the other. I have tried this so far with the mdma and using the 2 seperate hsem release interrupts so that the 2 cores can signal back and forth in a simple nonblocking way.

View solution in original post

7 REPLIES 7
TDK
Guru

There are no examples of this in the CubeH7 repository. Doesn't appear to be commonly used.

Only 9 hits in the larger GitHub in general, none of which appear to actually be using it:

https://github.com/search?q=CM4_SEV_IRQHandler+extension%3Ac&type=Code&ref=advsearch&l=&l=

If you feel a post has answered your question, please click "Accept as Solution".
RMcCa
Senior II

The sev appears to be about synchronizing​ wakeups between processors. The two processors have seperate nvics connected to common sources. One core can start a hardware process that interrupts the other. I have tried this so far with the mdma and using the 2 seperate hsem release interrupts so that the 2 cores can signal back and forth in a simple nonblocking way.

Ok I understand...

Do you some code examples please because i've tried many times with no success.

Thanks

Pietro1
Associate

I've just had a similar needs and I solved using the "SEV" instruction.

From the ARM Cortex M4/M7 programming manuals (PM0214 and PM0253), when the SEV instruction is called, a signal is sent to all other CPU.

So:

  • in the CM7, enable the IRQ
  • in the CM4 code I wrote:
asm ( "sev" );
  • in the CM7, write you own code in CM4_SEV_IRQHandler() routine

Viceversa to communicate from CM7 to CM4.

I don't know if this is the best solution but it works for me. So please if someone see somthing wrong, please let me know.

Regards

EOzde.1
Associate III

SEV instruction doesn't work for me. I don't know why? Could you give more details about configuring interrupt ? Thank you.

Hi,

I configured the two event interrupt on CM4 and CM7 into NVIC1 and NVIC2:

0693W00000DmD3aQAF.png0693W00000DmD3fQAF.png 

In the two interrupt linked to the event I did a led toggle, as an example:

CM4 - stm32h7xx_it.c:

volatile int CalzoCount = 0;
void CM7_SEV_IRQHandler(void)
{
  /* USER CODE BEGIN CM7_SEV_IRQn 0 */
	/// Toggle LED2 due to event sent from CM7 core
	HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
  /* USER CODE END CM7_SEV_IRQn 0 */
  /* USER CODE BEGIN CM7_SEV_IRQn 1 */
	CalzoCount++; // monitor via STLink...
  /* USER CODE END CM7_SEV_IRQn 1 */
}

CM7 - stm32h7xx_it.c:

void CM4_SEV_IRQHandler(void)
{
  /* USER CODE BEGIN CM4_SEV_IRQn 0 */
	HAL_GPIO_TogglePin(LED4_GPIO_Port, LED4_Pin);
  /* USER CODE END CM4_SEV_IRQn 0 */
  /* USER CODE BEGIN CM4_SEV_IRQn 1 */
 
  /* USER CODE END CM4_SEV_IRQn 1 */
}

Using Timer4 on CM4 and Timer1 on CM7, I generate the SEV event:

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
	HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
	__SEV();
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
	HAL_GPIO_TogglePin(LED3_GPIO_Port, LED3_Pin);
	__SEV();
}

And that's it: the LED4 and LED1 blink at the same time, so LED2 and LED3 do.

Make sure the 5th bit of SCR register is high: if I'm not wrong, according to the ARM manual, this bit means the CPU accepts the event via SEV.

0693W00000DmD6FQAV.png 

I attatch the project, hoping it could be helpfull. It's developed with:

Regards

CBraojos
Associate II

SEV instruction doesn't work for me in D1Standby Mode. I try use SEV to wakeup CM7 sending a event from CM4. But the Interrupt does not work in this mode in the CM7.