STMicroelectronics / stm32l0xx-hal-driver

Provides the STM32Cube MCU Component "hal_driver" of the STM32L0 series.
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

HAL_ADC_Start_DMA() misleading param description #6

Closed tdjastrzebski closed 1 year ago

tdjastrzebski commented 2 years ago

HAL_ADC_Start_DMA() method, the last Length param description reads:

* @param Length Number of data to be transferred from ADC peripheral to memory

This is misleading. Param name and the description suggests data buffer length (bytes?) is required while number of conversions is expected.

This value is finally used to set hdma->Instance->CNDTR register (DMA channel x number of data to transfer register). According to docs "It is decremented after each single DMA ‘read followed by write’ transfer, indicating the remaining amount of data items to transfer."

I think HAL_DMA_Start_IT() and DMA_SetConfig() methods suffer from a similar documentation ambiguity. DataLength param name is used while DataLength is not same as amount of data items. DataLength suggest number of bytes while number of data items (count) is expected.

As far as I can tell, the problem exists in all HAL packages. HAL param names do not seem to use very consistent naming. Size and Length words are used interchangeably. In this case Count word would probably be a much better choice.

ASELSTM commented 2 years ago

ST Internal Reference: 121956

ASELSTM commented 1 year ago

Hi @tdjastrzebski,

Thank you for your contribution. This issue has been fixed in the frame of version v1.10.6 of the stm32l0xx_hal_driver. Please allow me then to close this thread.

With regards,