Skip to main content
Visitor II
July 7, 2025
Question

how i correct these errors

  • July 7, 2025
  • 3 replies
  • 319 views

Please somebody can help me to correct my errors in stm32cubeide for stm32f401cdu6 project

../Core/Src/main.c: In function 'HAL_UART_RxCpltCallback':

../Core/Src/main.c:77:38: warning: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]

77 | rxbuffer[bufferIndex]="\0";

| ^

../Core/Src/main.c:84:37: warning: passing argument 2 of 'HAL_UART_Receive_IT' makes pointer from integer without a cast [-Wint-conversion]

84 | HAL_UART_Receive_IT(&huart6,uart_char,1);

| ^~~~~~~~~

| |

| char

In file included from ../Core/Inc/stm32f4xx_hal_conf.h:411,

from ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h:29,

from ../Core/Inc/main.h:30,

from ../Core/Src/main.c:20:

../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h:748:75: note: expected 'uint8_t *' {aka 'unsigned char *'} but argument is of type 'char'

748 | HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);

| ~~~~~~~~~^~~~~

../Core/Src/main.c: In function 'processsms':

../Core/Src/main.c:91:17: warning: implicit declaration of function 'sendcommand2' [-Wimplicit-function-declaration]

91 | sendcommand2("We Have Mesaj");

| ^~~~~~~~~~~~

../Core/Src/main.c: At top level:

../Core/Src/main.c:103:6: warning: conflicting types for 'sendcommand2'; have 'void(char *)'

103 | void sendcommand2 (char * cmdx)

| ^~~~~~~~~~~~

../Core/Src/main.c:91:17: note: previous implicit declaration of 'sendcommand2' with type 'void(char *)'

91 | sendcommand2("We Have Mesaj");

| ^~~~~~~~~~~~

../Core/Src/main.c: In function 'main':

../Core/Src/main.c:157:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

157 | HAL_UART_Receive_IT(&huart2,(uint8_t *)uart_char,1);

3 replies

Technical Moderator
July 7, 2025

Hello @ta2eh 

Could you please share your code?

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"
TDK
Super User
July 8, 2025

> HAL_UART_Receive_IT(&huart2,(uint8_t *)uart_char,1);

Probably want this:

HAL_UART_Receive_IT(&huart2,(uint8_t *)&uart_char, 1);

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
Danish1
Lead III
July 8, 2025

77 | rxbuffer[bufferIndex]="\0";

You need to use single quotes  not double-quotes " around the \0 string-termination-character

Double-quotes in C indicate a C-string, which is a pointer-to- character (the end of the string being marked by ‘\0’) whereas single-quotes indicate the character itself