Problem with USART communication between 2 processors
I have two STM32H743 processors which are connected by USART ports. We have to transmit data between these 2 µPs and have no other ports left (SPI or so) which could be used instead.
I initialized the 2 USARTs using STM32CubeMX with the identical settings (Bitrate 800kHz only, Clock-Polarity High, Clock 2.Edge, etc.)
husart2.Instance = USART2;
husart2.Init.BaudRate = 800000;// 25000000;
husart2.Init.WordLength = USART_WORDLENGTH_8B;
husart2.Init.StopBits = USART_STOPBITS_1;
husart2.Init.Parity = USART_PARITY_NONE;
husart2.Init.Mode = USART_MODE_TX_RX;
husart2.Init.CLKPolarity = USART_POLARITY_HIGH;
husart2.Init.CLKPhase = USART_PHASE_1EDGE;
husart2.Init.CLKLastBit = USART_LASTBIT_ENABLE;
husart2.Init.Prescaler = USART_PRESCALER_DIV1;
husart2.Init.SlaveMode = USART_SLAVEMODE_DISABLE;
husart2.Init.FIFOMode = USART_FIFOMODE_ENABLE;
husart2.Init.TXFIFOThreshold = USART_TXFIFO_THRESHOLD_1_8;
husart2.Init.RXFIFOThreshold = USART_RXFIFO_THRESHOLD_1_8;
if (HAL_USART_Init(&husart2) != HAL_OK)
{
Error_Handler();
}
When transmitting only one byte (not via DMA, just with HAL_USART_Transmit_IT), and echoing it back, it seems that the data gets shifted by one bit in the end.
I send 0x55, the receiver gets 0x55, this is sent back but then the original sender gets 0xAA received.
What could be the reason? I played around with 1./2 Edge but this doesn't help.
Transmitted data on the Osci looks ok. Pin speed for the ports are set to "High".
Thank you for any hints.
