2019-04-14 07:51 AM
Hello,
I have several UARTs when initializing them all simply with HAL_UART_Init , each with its own UART_HandleTypeDef instance, than things works fine.
But on adding HAL_UART_DeInit before HAL_UART_Init (this is actually the generated code from stm32cube) , than the second UARTinit resulted in malfunction of the first UART.
I have verified that the instance of UART_HandleTypeDef is not the same.
Any idea why it behaves like this ?
Thanks,
ranran
2019-04-15 05:59 AM
Things are a little bit foggy here. correct me if I'm wrong, you have 2 UART instances as lets say huart1 and huart2.
you're using huart1 then closing it with HAL_UART_DeInit(&huart1) and initializing the second one with HAL_UART_Init(&huart2)
Assuming it is like this; are you getting any messages from huart1 instance after this?
if not are you re initializing your IRQ or Callbacks? like HAL_UART_Receive_IT(&huart1,etc,etc)
2019-04-15 09:01 AM
Check that the callback code that deals with the pins and clocks can actually discriminate between the devices you are talking too, and that the Instance properly identifies the UART being used.
ie look at HAL_UART_MspInit() and HAL_UART_MspDeInit() and make sure they aren't brain damaged.
2019-04-15 12:05 PM
Thanks clive one, I'll check it !