2019-04-17 12:51 AM
I'm using STM32 Cube FW-F4 V1.21.0 to generate UART driver code, it seem has a bug for:
HAL_UART_Transmit_IT(UART_HandleTypeDef
*huart, uint8_t *pData, uint16_t Size).
The UART will not send the
packet if any data in *pData = 0.
For example:
HAL_UART_Transmit_IT(&huart3, ModBusBuf, usLength);
assume usLength = 6;
ModBusBuf point to: 4,6,2,26,1,8; the Uart will send the packet.
if ModBusBuf point to: 4,6,2,0,1,8; the Uart will not send the
packet.
Is this bug fixed for newer version?
2019-04-17 03:24 AM
*pData = 0 means you're putting 0 in to pointers value which means NULL.
there is NULL check in HAL_UART_Transmit() function. you should use an array or point to adresses not values.
2019-04-17 05:23 AM
> The UART will not send the packet if any data in *pData = 0
Where do you see this? Could you point to this place in source?
(Note: this repository has several versions up to 1.24, you can navigate among versions via tags in Releases view)
-- pa
2019-04-17 05:55 AM
there it is. If you put zero in to *pData it self as a pointing adress it will send error and drop transmission. Other than this there is noway this error would occur.
@New.Fish I used this library in maybe 20 different projects and I can assure you it works with every character in ASCII table.
2019-04-17 06:20 AM
Ah, so it is not "*pData = 0". It is pData == NULL.
C is a tough language. Just one small starlet makes a lot of difference ))
-- pa
2019-04-17 11:06 AM
Learn direct and indirect addressing and the star will make sense.
Java hid it well....