AnsweredAssumed Answered

SPC560P ADC value not updating

Question asked by Marcell Daniel on Jul 12, 2017
Latest reply on Jul 14, 2017 by Marcell Daniel

Hello,

 

I am workin on SPC560P Discovery Board. I am trying to initialize the ADC peripheral using the components provided in the SPC5 Studio. What I am trying to do is to replicate the ADC Test Application in a different project. I initialize the ADC component in the project configuration and using this in the main.c

 

#include "components.h"
#include "adc_lld_cfg.h"

static adcsample_t samples[ADC1_GROUP_ADC1_CONF_NUM_CHANNELS *
                            ADC1_GROUP_ADC1_CONF_BUF_DEPTH];
static uint32_t          mswaittime;


int main(void) {
  componentsInit();
  irqIsrEnable();
  adc_lld_start(&ADCD2, NULL);
  sysWaitMilliseconds(1000UL);

while(1) {     
    adc_lld_start_conversion(&ADCD2, &adc1_group_ADC1_conf,
                        samples, ADC1_GROUP_ADC1_CONF_BUF_DEPTH);
    mswaittime = samples[0];
    sysWaitMilliseconds(100UL+mswaittime);
}
}

Configuring the ADC I am using the same values provided in the  ADC Test Application (channel: 10).

 

The problem is after loading the program on the board, that the ADC sample values are not updating, but remaining on a constant value. Removing the jp12 jumper is setting the sample value to 1, but changing the resistor has no effect on the sample value.

 

Can you help me out what am I missing here?

 

Regards, 

   Marcell

Outcomes