cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Hardware Semaphor

HamidGolbari
Associate II

Dear ST support team, 

I am using STM32-H755 for my motor control application. I am using Hardware Semaphore for synchronization between two cores. What I did, I developed the notification release in M4  in a timer interrupt routine as below: 

void TIM8_UP_TIM13_IRQHandler(void)
{
/* USER CODE BEGIN TIM8_UP_TIM13_IRQn 0 */
uint32_t foc_timer_conter_register_value_ticks = 0;

/* USER CODE END TIM8_UP_TIM13_IRQn 0 */
/* USER CODE BEGIN TIM8_UP_TIM13_IRQn 1 */
if (__HAL_TIM_GET_FLAG(&htim8, TIM_FLAG_UPDATE) != RESET) {
if (__HAL_TIM_GET_IT_SOURCE(&htim8, TIM_IT_UPDATE) != RESET) {
__HAL_TIM_CLEAR_FLAG(&htim8, TIM_FLAG_UPDATE);
 
 
HAL_HSEM_FastTake(HSEM_ID_1);//Take HSEM
HAL_HSEM_Release(HSEM_ID_1, 0);//Release HSEM in order to notify the CPU2(CM7)
 
}
}
}

This notifies the M7 with frequency of 32KHz. 

Then I use the below code in M7:

 

void HSEM1_IRQHandler(void)
{
/* USER CODE BEGIN HSEM1_IRQn 0 */

/* USER CODE END HSEM1_IRQn 0 */
HAL_HSEM_IRQHandler();
/* USER CODE BEGIN HSEM1_IRQn 1 */
HAL_GPIO_TogglePin(sixth_point_GPIO_Port, sixth_point_Pin);
 
}

 The problem is that the frequency in M7 HSEM1 interrupt is not organized and sometimes it changes. I have attached a picture of toggled pin. I did a research on that but nothing found relating this issue.

 

Would you please help me with this issue?

 

Best regards,

Hamidreza 

 

 

 

 

 

 

 

 

 

 

1 REPLY 1
TDK
Guru

Looks like you have other code being executed that delays HSEM1_IRQHandler from being called. Move it up in priority if that is desired.

Also could be user code called by HAL_HSEM_IRQHandler that could be delaying things. Not much insight into what's happening in the system.

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