Programmable Sample Time parameter for faster sample rates #62
Labels
conclusion: resolved
Issue was resolved
topic: code
Related to content of the project itself
type: enhancement
Proposed improvement
In
HALConfig.cpp
, thehal_adc_config()
routine currently has the Sample Time (sConfig.SamplingTime
) hard coded to a value ofADC_SAMPLETIME_8CYCLES_5
(8.5 clocks).According to the datasheet, a value of
ADC_SAMPLETIME_2CYCLES_5
(2.5 clocks) is legal. This increases the maximum sample rate from 1.8 MS/s to 2.9 MS/s.Due to concerns about operating conditions (temperature, voltage etc), it would NOT be a good idea to simply change the hard-coded value from 8.5 clocks to 2.5 clocks. Instead, a new defaulted argument can be added to
hal_adc_config()
which can be set toSAMPLE_SLOW
orSAMPLE_FAST
to enable switching between 8.5 clocks and 2.5 clocks as the user prefers based on their operating conditions and needs. The default would beSAMPLE_SLOW
to retain backward compatibility.The text was updated successfully, but these errors were encountered: