79793809

Date: 2025-10-18 14:53:07
Score: 0.5
Natty:
Report link

From my experience of HAL code so far whoever wrote some of it should be shot.

Take for instance HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size).

I would expect this to transmit any multi byte buffer perfectly from start to finish once kicked off - but no!

YOU have to make sure that pData is pointing to a STATIC buffer, (and you can't change the contents of that static buffer until the transmission has completed), i.e. YOU have to wait until you get the Tx Complete callback invoked before you can either reuse the buffer, or before the buffer goes out of scope on your stack\heap.

In other words if you want proper interrupt based buffer transmission YOU have to implement ring buffering yourself on top of the HAL code provided by ST. The ST code will only reliably work sending single bytes at a time which rather renders pointless using interrupt driven comms in the first place.

Same applies to how they implemented DMA Idle buffer handling... a real mess when it could have been done properly using industry standard ring buffering patterns.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: user24878093