Problem with OpenAmp_ping pong
Dear Support team,
I am using this STM32H755 as a motor control application.
I have developed motor control algorithm on M4 and the communication with Master through SPI using M7.
I need to exchange data between M4 and M7 continuously. I tried with OpenAmp_PingPong example. It works fine but it works just one time at the beginning of the program or depends on this while loop
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM17) {
HAL_HSEM_FastTake(HSEM_ID_0);//Take HSEM
status = OPENAMP_send(&rp_endpoint, &message, sizeof(message));
//message++;
if (status < 0)
{
Error_Handler();
}
HAL_HSEM_Release(HSEM_ID_0, 0);//Release HSEM in order to notify the CPU2(CM4)
// Handle Timer 1 period elapsed event
// This code will execute when the period of Timer 1 elapses
}
}
In which the data is being sent in a timer or in an infinite loop.
I tried a lot with this but I could not. because both cores stopped working when I am doing this.
I also put the receive the receive message function on M4 side in this interrupt:
void HAL_HSEM_FreeCallback(uint32_t SemMask)
{
/* USER CODE BEGIN HSEM_FREE_CALLBACK */
receive_message();
/* USER CODE END HSEM_FREE_CALLBACK */
/* Prevent unused argument(s) compilation warning */
UNUSED(SemMask);
msg_received = RX_NEW_MSG;
#ifdef CORE_CM7
/* USER CODE BEGIN PRE_HSEM_FREE_CALLBACK_CM7 */
/* USER CODE END PRE_HSEM_FREE_CALLBACK_CM7 */
HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_1));
/* USER CODE BEGIN POST_HSEM_FREE_CALLBACK_CM7 */
/* USER CODE END POST_HSEM_FREE_CALLBACK_CM7 */
#endif
#ifdef CORE_CM4
/* USER CODE BEGIN PRE_HSEM_FREE_CALLBACK_CM4 */
/* USER CODE END PRE_HSEM_FREE_CALLBACK_CM4 */
HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
/* USER CODE BEGIN POST_HSEM_FREE_CALLBACK_CM4 */
/* USER CODE END POST_HSEM_FREE_CALLBACK_CM4 */
#endif
}
I should clarify that I do not want to use FreeRTOS. Would it be possible to help me?
Best regards,
Hamidreza
