cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 problem receiving 0xF8 over UART with HAL

ABenz.11
Associate II

Hello I am trying to send hex values over UART with HAL_Transmit

in the cubeIDE I do:

HAL_UART_Transmit(&huart2,(0xF << 4) | (0x8), 1,10);

However I receive in Hterm

0xC5

I cannot make sense over it. Sending text with " some text" works fine

HAL_UART_Transmit(&huart2,"some text", 9,10);

What am I doing wrong??

Thanks and stay healthy

1 ACCEPTED SOLUTION

Accepted Solutions

It wants to be passed an address/pointer to value, not the value/data directly.

ie

uint8_t data = 0xF8;

HAL_UART_Transmit(&huart2,&data, 1,10);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

It wants to be passed an address/pointer to value, not the value/data directly.

ie

uint8_t data = 0xF8;

HAL_UART_Transmit(&huart2,&data, 1,10);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ABenz.11
Associate II

That works.

So without the & it will send the "address position" of the variable "data" and with the & it will send the "data" @ that position?

Is that correct?

No the other way round, parameter passed needs to be an address.

Y​ou had it sending the byte stored at location 0xF8

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ABenz.11
Associate II

Understood.

Thank you.��

Greetings from Berlin