I have to send data by UART1 from my STM32F429. The problem is that the data is not sent correctly.
I debugged and I got this.
For testing I want to send buffer[0]=60;, and on the other side I have to hear a sound as data is received, but it doesn't work.
Here is my debugger screen shot, as you see it has wrongly occupied.
This is my UART configuration:
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
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_8;
if (HAL_UART_Init(&huart1) != HAL_OK) {
Error_Handler();
}
This is my code to send data:
buffer[0]=60;
HAL_UART_Transmit_IT(&huart1,(uint8_t*)buffer[0],1);
HAL_UART_TxCpltCallback(&huart1);
HAL_GPIO_WritePin(RED_GPIO_Port, RED_Pin, GPIO_PIN_SET);
HAL_Delay(500);
HAL_GPIO_WritePin(RED_GPIO_Port, RED_Pin, GPIO_PIN_RESET);
HAL_Delay(500);
