I'm using the GPAIN inputs on the C5515 to measure voltage and I am finding the results odd. Using an adjustable power supply, I tried measuring various voltages primarily in the 0-1V range on the C5515ezDsp v2 USB stick and the results are very non-linear.
Here is where I altered various settings to get the measurements...
SAR_CTRL = 0x2000; // select channel, normal mode, continuous conversion
SAR_CTRL = SAR_CTRL|0x0800; // enable multi channel mode - more time to sampling input
// SAR_CTRL = SAR_CTRL|0x0400; // enable single conversion mode
SAR_CLKCTRL = 0x000B; // set clock divisor
SAR_PINCTRL = 0x3600; // bandgap 1v ref
// SAR_PINCTRL = 0x3400; // bandgap 0.8v ref
// SAR_PINCTRL = 0x3100; // VDD_ANA ref
// SAR_PINCTRL=SAR_PINCTRL|0x0008; // AVDD measure on channel 3
// SAR_PINCTRL=SAR_PINCTRL|0x0001; // divide input voltage by half
SAR_PINCTRL=SAR_PINCTRL|0x0004; // reserved bit must be set to read channel 2
// SAR_PINCTRL=SAR_PINCTRL|0x0002; // ground voltage divider for channel 1 or ch 0 cal measure
SAR_GPOCTRL = 0x0000; // turn off all GPOs
Here is the final graph..
As you can see, most settings start to saturate at about 0.8V and I can never saturate the A to D to 0x3FF or 1023 on the graph.
There are spots where the reading doesn't change and then suddenly steps to the next reading. The best performance was with VDD_ANA reference and not dividing reading by half.
Any insight into why the analogue inputs are so non-linear and regardless of reference never reach digital saturation or is that just the way it is?
Thanks,
Cam