Skip to main content
deleted 14 characters in body; edited title
Source Link
ocrdu
  • 9.4k
  • 23
  • 33
  • 43

UART not sending correct data in stm32STM32

I have to send data by UART1 infrom my STM32F429. The The problem is that the data is not correctly sent correctly. I

I debugged and I got this. for testFor testing I want to send buffer[0]=60; , and on the other handside 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.

Here is my debugged screen shot, as you see it has wrongly occupied!enter image description here

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();
  }

and thisThis 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);

Thanks...

UART not sending correct data in stm32

I have to send data by UART1 in my STM32F429. The problem is the data is not correctly sent. I debugged and I got this. for test I want to send buffer[0]=60; and on the other hand I have to hear a sound as data received, but it doesn't work.

Here is my debugged screen shot, as you see it has wrongly occupied!

This 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();
  }

and 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);

Thanks...

UART not sending correct data in STM32

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.

enter image description here

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);
edited body
Source Link
niloofar
  • 11
  • 1
  • 4

I have to send data by UART1 in my STM32F429. The problem is the data is not correctly sent. I debugged and I got this. for test I want to send buffer[0]=70;buffer[0]=60; and on the other hand I have to hear a sound as data received, but it doesn't work.

Here is my debugged screen shot, as you see it has wrongly occupied!

This 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();
  }

and 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);

Thanks...

I have to send data by UART1 in my STM32F429. The problem is the data is not correctly sent. I debugged and I got this. for test I want to send buffer[0]=70; and on the other hand I have to hear a sound as data received, but it doesn't work.

Here is my debugged screen shot, as you see it has wrongly occupied!

This 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();
  }

and 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);

Thanks...

I have to send data by UART1 in my STM32F429. The problem is the data is not correctly sent. I debugged and I got this. for test I want to send buffer[0]=60; and on the other hand I have to hear a sound as data received, but it doesn't work.

Here is my debugged screen shot, as you see it has wrongly occupied!

This 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();
  }

and 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);

Thanks...

Source Link
niloofar
  • 11
  • 1
  • 4

UART not sending correct data in stm32

I have to send data by UART1 in my STM32F429. The problem is the data is not correctly sent. I debugged and I got this. for test I want to send buffer[0]=70; and on the other hand I have to hear a sound as data received, but it doesn't work.

Here is my debugged screen shot, as you see it has wrongly occupied!

This 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();
  }

and 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);

Thanks...