Possible bug on ADC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Possible bug on ADC

392 Views
Teckna
Contributor V

I'm using MQX 3.8, CW 10.2 and a custom board based on K60N512.

 

If I open the ADC channel with the ADC_CHANNEL_ACCUMULATE attribute set, the driver accumulate all samples from one sequence into one value.

The problem is that the buffer is accumulated in a buffer (result) defined as ADC_VALUE_TYPE, that is defined as uint_16 (16 bits wide)

 

adc_ch->g.buffer_driver->result += adc_ptr->R[ch_num]; (file adc_kadc.c, line 635)

 

The Kinetis ADC module is 16 bits wide, than the values cannot be accumulated otherwise an overflow error can occur.

 

Is this right?

 

Many thanks

Teckna

 

0 Kudos
1 Reply

228 Views
DavidS
NXP Employee
NXP Employee

Hi Teckna,

I think you are right and I will consult with our MQX Development team.

I think we need a 32-bit accumulator.

I will update post when I hear back from MQX Development team.

Regards,

David

0 Kudos