STM32H747XI Disc0 - UART with Interrupt - Data transfer between Cores
Hi all,
I'm new on STM32H747XI-Disc0. I ve started learn step-by-step everything from basics. So, I'm sorry for my basic questions...
According to my tutorial timeline, today I ve started to learn UART communication. I tried to type a small example :
- I assigned PI12 GPIO output to CM7 (LED_M7, I gave an alias) and PI14 GPIO output to CM4 (LED_M4, I gave an alias).
- These LEDs blink on according to their small duties.
This example :
on CM7 :
char data_transmit[100];
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
//The following line is canceled, because of fast interaction.
//But I tested this callback function, and works good and expected.
//HAL_UART_Transmit_IT(&huart1, (uint8_t *)data_transmit, sizeof(data_transmit));
}
...
int main(void)
{
//I used this for transfering my command to related char array
strcpy(data_transmit,"LIGHT_LED_M4\r\n");
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
HAL_UART_Transmit_IT(&huart1, (uint8_t *)data_transmit, sizeof(data_transmit));
HAL_GPIO_TogglePin(GPIOI, LED_M7_Pin);
HAL_Delay(1000);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
According to CM7 core, LED_M7 (PI12 connected) is blinking individual from UART Transmit (Interrupt method). UART Transmit IT function (also callback function works good too) works successfully. I can check sent data by Hercules.
on CM4 core :
uint8_t target_command[100] = "LIGHT_LED_M4";
uint8_t rx_data[100];
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Receive_IT(&huart1, rx_data, sizeof(rx_data));
}
...
int main(void)
{
...
/* USER CODE BEGIN 2 */
HAL_UART_Receive_IT(&huart1, rx_data, sizeof(rx_data));
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
if(strcmp((char *)rx_data,(char *)target_command) == 0)
{
HAL_GPIO_TogglePin(GPIOI, LED_M4_Pin);
HAL_Delay(250);
}
//HAL_GPIO_TogglePin(GPIOI, LED_M4_Pin);
//HAL_Delay(250);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
According to my experiment, I tried to send a command from CM7 core side as "LIGHT_LED_M4" with UART1 -> HAL_UART_Transmit_IT(&huart1, target_command, sizeof(target_command) - and these command should be read by CM4 core and check this "LIGHT_LED_M4" command if it is, toggle LED_M4. But CM4 side not working and no reaction for this command.
Is this possible ? If it is possible, how can I do it ? What I do wrong on CM4 side ?
By the way, for inter communication on STM32 dual core (OpenAMP / RpMSG or OpenAMP/FreeRTOS) I will start to learn...
This is just for learning experiment. For the next tests, I will try to communicate with Nextion LCD screen.
Thanks a lot for your help, and sorry for my basic questions.
