I am using the function HAL_UART_Transmit to send a string of 4 character in output to a display. I order to test the function first I am using a serial monitor (TERMITE) on my PC but i got this problem in the title.
I am using NUCLEO-H743ZI with HAL libraries generated with CubeMX and this is my code in the main file:
HAL_UART_Transmit(&huart3, transBuff, 1, 200);
HAL_UART_Transmit(&huart3, (uint8_t *)mbuff, sizeof(mbuff), 200);
in the first case when i send mbuff i receive "d" and that is correct, but when I send a string with more than one character (transBuff) instead of receiving "cosa" i receive "c7a".
Has anyone got the same problem?
the configuration of USART is the following:
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_7B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart3.Init.Prescaler = UART_PRESCALER_DIV2;
huart3.Init.FIFOMode = UART_FIFOMODE_DISABLE;
huart3.Init.TXFIFOThreshold = UART_TXFIFO_THRESHOLD_1_8;
huart3.Init.RXFIFOThreshold = UART_RXFIFO_THRESHOLD_1_8;
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart3) != HAL_OK)
All the setting in the serial monitor are correct. Using Printf function the reception is always good but using the HAL_UART_Transmit function with more than one character there are some problems. Could be a problem with the clock syncronization? Should be better to decreas the BAUD rate in this case?