Two STM32 - UART communication
Hello,
I've been doing a small project lately and ran into a problem in one part. I have two STM32 microcontrollers and I want to communicate both of them with eachother over UART. One of them is designed to send a fixed array of 6 characters
uint8_t k[6]={3,7,9,12,16,19};
The other microcontroller is simply to receive it. When I send a single byte over the UART it all works without a problem. When I want to send the whole array it only fills the first element.This first element is filled with random numbers from this sent array.
I know for sure there is no problem on the sending side. I checked it on an oscilloscope. The problem lies in the receiving side.
I suspect that the problem lies in the timing, but I don't know how to fix it
In both microcontrollers the baud rate is the same – 9600. The data frame is also the same 8N1.
RX device code
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
uint8_t buff[6];
/* USER CODE END 0 */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_UART_Receive(&huart2, buff, sizeof(buff), 10000);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
TX device code
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
uint8_t k[6]={3,7,9,12,16,19};
/* USER CODE END 0 */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_UART_Transmit(&huart2, k, sizeof(k), 10);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */



