How to make CM4 use the same UART instance as CM7 on STM32H7?
Post edited by a ST moderator. Please use </> button to paste your code.
Hi,
I’m working with an STM32H7 (dual-core) and I want both CM4 and CM7 to be able to transmit on the same UART. On CM7, I initialize the UART normally MX_USART1_UART_Init(). On CM4, I try to send data via HAL and I’ve protected access with a hardware semaphore.
Problem is that CM4 doesn’t see the properly initialized huart1 from CM7 and nothing is transmitted.
What exactly do I need to do so that CM4 can use the same huart1, i tried the
__attribute__((section(".RAM_D2"))) UART Handle TypeDef huart1;
but it doesn't work ither. . Also why both cores declares huart1on their own??
Thanks in advance for any help!
code:
int __io_putchar(int ch)
{
// Take semaphore
HAL_HSEM_FastTake(UART_HSEM_ID);
if (ch == '\n') {
uint8_t cr = '\r';
HAL_UART_Transmit(&huart1, &cr, 1, HAL_MAX_DELAY);
}
HAL_UART_Transmit(&huart1, (uint8_t*)&ch, 1, HAL_MAX_DELAY);
// Release semaphore
HAL_HSEM_Release(UART_HSEM_ID, 0);
return ch;
}
