2021-11-06 04:00 AM
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
Solved! Go to Solution.
2021-11-06 04:14 AM
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);
2021-11-06 04:14 AM
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);
2021-11-06 04:24 AM
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?
2021-11-06 04:28 AM
No the other way round, parameter passed needs to be an address.
You had it sending the byte stored at location 0xF8
2021-11-06 04:30 AM
Understood.
Thank you.:*
Greetings from Berlin