huart2 died on reception and needs repower
F4 board (Master) with huart1 & huart2 identically configured, talking to 2 identical boards(Slaves) with the same program. huart1 works perfectly, huart2 dies after receiving from slave.
Sequence:
Master sends 6 chars ( 9600) using HAL_UART_Transmit_IT() and slave answer with 20 chars repeatedly. Works fine when tested with huart1(on PB6,PB7).
Connecting the same slave to huart2(on PA2,PA3) instead, Master sends, slave received, slave answer with 20 chars, then Master try to send again but nothing coming out on the wire.
HAL_UART_Transmit_IT() still generate a call to HAL_UART_TxCpltCallback() but nothing is out.
The only way to get this single transaction again is to repower the Master.
The program do not even try to receive. No call to any IRQ or polling reception function. If I disconnect the Master's RX wire, it can transmit again (but useless without the slaves answer) .
Settings are identical for both huarts and done with QubeIDE.
Here is the simple program I use
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){
__NOP();
}
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart){
__NOP();
}
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart){
__NOP();
}
UART_HandleTypeDef *uartUsed;
int main(void)
{
HAL_Init();
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_I2C1_Init();
MX_USART1_UART_Init();
MX_RTC_Init();
MX_USART2_UART_Init();
MX_USART6_UART_Init();
MX_TIM1_Init();
uartUsed=&huart2;
while (1)
{
HAL_Delay(1000);
HAL_UART_Transmit_IT(uartUsed,txBuffCmd,6);
}
static void MX_USART1_UART_Init(void)
{
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE END USART1_Init 0 */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 9600;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */
}
/**
* @brief USART2 Initialization Function
* @param None
* @retval None
*/
static void MX_USART2_UART_Init(void)
{
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 9600;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}