hi,

I have encountered a very weird response of of the internal adc when including the arm_math library. I use kinetis design studio and ksdk 1.3. in my application I use adc0 in the 16bit differential mode. my board is custom made and is based on the k64f mcu. My aim to use the arm_math library to process the digitized data. however, when I include the arm_math library by (#include arm_math.h ), the digitized data show just half the value of the previous measurement without the arm_math library. I have made sure that the measurement conditions have been kept all the same for both measurement.

does anyone have any explanation for that or have encountered this problem?

thanks

Hi, Friend,

Regarding your question, if you use the api function defined in arm_math.h, you have to know the data type in the api function. When you use 16 bits mode and differential mode of ADC to sample external analog signal, the sample can be positive or negative,we say that the sample is in q16 mode, this is the q16 mode representation. In differential mode, the maximum positive is 0x7FFF(32767 in decimal) , which represent 3.3V, the minimum negative value is 0x8000, which represents -3.3V. In differential, the ADC range is enlarged twice, in other words, the adc range is from -3.3V to +3.3V, the total range is 6.6V. In differential mode, the ADC resolution is 6.6V/65535. In the case, you can call the function with q16 data type.

If you use 16 bits mode and single-ended mode of ADC, because the ADC can not sample/represent negative, you will get the value from 0 to 65535, the 65535(0xFFFF) represent 3.3V. In other words, the ADC range is 3.3V instead of 6.6V as that of differential mode. in single-ended mode, the ADC resolution is 3.3V/65535.

I think it can explain why you get half in differential mode than than in single-ended mode.

Hope it can help you.

BR

Xiangjun Rong