2019-12-09 3:19 AM
EDIT: Nevermind this thread can be deleted, apologies. I didn't enable the HSEM2 Global interrupts under NVIC1/2 in CubeMX.
Hi,
I'm having issues getting the hardware semaphore interrupts to function correctly, or I'm misunderstanding their usage. I'm using a cubeMX generated project in SW4STM32. Below is a code snippet from the main.c file on the M4.
uint32_t sem_mask = __HAL_HSEM_SEMID_TO_MASK(8);
HAL_HSEM_ActivateNotification(sem_mask);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1) {
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_HSEM_Take(8,8);
HAL_Delay(1000);
HAL_HSEM_Release(8, 8);
HAL_Delay(1000);
}I've just picked a random semaphore, so number 8, out of 31.
From the comments in hal_hsem.c this is what I could gather about the usage. I've implemented the handler at the bottom of the same file:
void HAL_HSEM_FreeCallback(uint32_t SemMask){
HAL_GPIO_TogglePin(GPIOI, GPIO_PIN_14);
}My problem is the callback is never called, implying the interrupt is not firing.
2019-12-20 9:25 AM
Hello @savvn001 ,
It is preferable to keep your initial post and add a reply where you provide your finding.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.