stm32h7-dual-core-inter-cpu-async-communication
stm32h7-dual-core-inter-cpu-async-communication copied to clipboard
Example for communication between two cores using notification in stm32h747
We are working on stm32h747 protenta board. We are tried to send data from CM7 to CM4 by using the following example.
https://github.com/MaJerle/stm32h7-dual-core-inter-cpu-async-communication
We can able to send data from CM7 to CM4. But it taking around 600ms. Can I get any example to send data from CM7 to CM4 using notification (such as HSEM, EXTI, SEV).
Thanks, Ashok Kumar.
What has taken 600ms?
Hello @MaJerle,
Thanks for your response to my query. We are sending 32kb data chunk by chunk (512 bytes for each chunk) between CM7 to CM4. Time taken by the 32kb data between the cores is 600ms.
Please check code for CM4
` int index=0,data=0,count=0; long int timeElapsed_ms = 0; size_t len=0;
timeElapsed_ms = HAL_GetTick(); /* Infinite loop / / USER CODE BEGIN WHILE / while (1) { / USER CODE END WHILE / void addr;
//time = HAL_GetTick();
if((len = ringbuff_get_linear_block_read_length(rb_cm7_to_cm4)) > 0)
{
addr = ringbuff_get_linear_block_read_address(rb_cm7_to_cm4);
memcpy(&buff[index],addr,512);
// printf("%d\n",len);
data++;
// printf("%d\n",data);
/* Transmit data */
//HAL_UART_Transmit(&huart1,&buff[index],1000, 1000);
printf("%s\n",&buff[index]);
memset(addr,0,512);
index = index + 512;
/* Mark buffer as read */
ringbuff_skip(rb_cm7_to_cm4,len);
// printf("\n%d.time ms = %ld\n",count++,(HAL_GetTick() - timeElapsed_ms));
}
if(index == 32768)
{
len=0;
// printf("%d",data);
index = 0;
if(data == 64)
{
// for(int i=0;i<32768;i+=512) // { // printf("%s\n",&buff[i]); // HAL_Delay(1000); // } data = 0; } }`
Please check code for CM7
`while (1) { /* USER CODE END WHILE */ // if(flag == 1) // { time = HAL_GetTick(); if(time - t1 >= 1000) { t1 = time; if(index<length) {
if((length - index) < 512)
{
ringbuff_write(rb_cm7_to_cm4,&str[index],(length - index));
}
else
{
ringbuff_write(rb_cm7_to_cm4,&str[index],512);
}
index = index + 512;
}
else
{
ringbuff_free(rb_cm7_to_cm4);
//flag = 0;
}
// HAL_Delay(2);
// }
}
/* USER CODE BEGIN 3 */
}`
Thanks, Ashok.
Please format the code.