Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
D_Sd_3235936
Level 4
Level 4
25 sign-ins 50 questions asked 25 replies posted

Hi

After Init,  at some point I need to change the 'Samples Averaged' of the ADC_SAR_Seq.

 

What is the correct flow to do that?

 

This is how the component initialized in PSOC creator:

D_Sd_3235936_0-1657190941312.png

 


Thanks!

 

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

SAR_SAMPLE_CTRL register in the ADC related registers has bitfield SAR_AVG_CNT which takes care of the average sampling.Averaging Count for channels that have over sampling enabled (AVG_EN). A channel will be sampled back to back (1<<(AVG_CNT+1)) = [2..256] times before the result is stored and the next enabled channel is sampled (1st order accumulate and dump filter). If shifting is not enabled (AVG_SHIFT=0) then the result is forced to shift right so that is fits in 16 bits, so right shift is done by max(0,AVG_CNT-3). SAR_AVG_SHIFT is then used to make sure whether the bits are shifted to fit the resolution. SAR_CHAN_CONFIG bit for each channel will have a SAR_AVG_EN bit before initializing the channel. Ideally these needs be enabled and before re-enabling the ADC and starting the conversion.

Best Regards,
Vasanth

View solution in original post

0 Likes
1 Reply
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

SAR_SAMPLE_CTRL register in the ADC related registers has bitfield SAR_AVG_CNT which takes care of the average sampling.Averaging Count for channels that have over sampling enabled (AVG_EN). A channel will be sampled back to back (1<<(AVG_CNT+1)) = [2..256] times before the result is stored and the next enabled channel is sampled (1st order accumulate and dump filter). If shifting is not enabled (AVG_SHIFT=0) then the result is forced to shift right so that is fits in 16 bits, so right shift is done by max(0,AVG_CNT-3). SAR_AVG_SHIFT is then used to make sure whether the bits are shifted to fit the resolution. SAR_CHAN_CONFIG bit for each channel will have a SAR_AVG_EN bit before initializing the channel. Ideally these needs be enabled and before re-enabling the ADC and starting the conversion.

Best Regards,
Vasanth

0 Likes