Reading ADC channels in Same70 Xplained board

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I am having problems reading the ADC channels on the Same70 Xplained board that I am experimenting with. I can read the ADC channels but the values read does not make sense. I am reading AFE0_AD0 channel on EXT2, and despite grounding the signal the ADC values read 4095. I tried using AFEC_SetAnalogOffset() to remove the offset and although this changes the values read, I cannot get a reading that makes sense to me. I believe that I am missing something here that I can't put my finger on. Any help with debugging this issue would be greatly appreciated.

 

-Thanks!

Last Edited: Mon. Jan 9, 2017 - 02:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We seem to be missing the code, kinda hard to tell what is wrong when you don't show the code???

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Code: 

    /*INITIALIZE AFEC0 FOR DIFFERENTIAL MODE, USER SEQUENCED, NO ANALOG OFFSET, SW TRIGGER, EOCx INTERRUPT, "afec_EOC_handler"*/
    afec_enable(AFEC0);
    struct afec_config afec_cfg;
    afec_get_config_defaults(&afec_cfg); /*AFEC0 defaults settings changed in "afec.c"*/
    afec_init(AFEC0, &afec_cfg);
    afec_set_trigger(AFEC0, AFEC_TRIG_SW); /*Software Trigger*/

    struct afec_ch_config afec_ch_cfg;
    afec_ch_get_config_defaults(&afec_ch_cfg);
    afec_ch_set_config(AFEC0, AFEC_CHANNEL_0, &afec_ch_cfg);
    afec_ch_set_config(AFEC0, AFEC_CHANNEL_1, &afec_ch_cfg);
    afec_ch_set_config(AFEC0, AFEC_CHANNEL_2, &afec_ch_cfg);

    /*Enable all associatd channels*/
    afec_channel_enable(AFEC0, AFEC_CHANNEL_0);
    afec_channel_enable(AFEC0, AFEC_CHANNEL_1);
    afec_channel_enable(AFEC0, AFEC_CHANNEL_2);
    afec_channel_set_analog_offset(AFEC0,AFEC_CHANNEL_0,0x200); //*Tried with varies offset values

    /*Set user sequence for AFEC*/
    afec_configure_sequence(AFEC0, chan_list,3);

    /*SET AFEC CALLBACK FUNCTION*/
    afec_set_callback(AFEC0, AFEC_INTERRUPT_EOC_2,afec_EOC_handler,1);

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have the same issue, by using the same code, I get eronous values around 4095.

Did you find the trick?

SAME70's FAN

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been attempting to also use the sequencing feature of the AFEC and also only see values such as 4095 (0xfff).

 

Is AFEC channel sequencing known to work at all ??

 

--Charles Johnson

ZIncFive, Inc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Need to see a complete set of code showing the output.

 

I have a Same70 Xplained board and can read 2 channels (2 & 5)'

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now reading 4 channels.

 

Without sequences.  reading channels 0,1,2,5  works correctly.

 

Enabling sequencing, sequence 2,1,0,5 doesn't work.  Channel 5 interrupt doesn't trigger.  Values are correct in the AFEC sequnce 1 register.  But debugger shows no channel 5 interrupt.

 

Changing the sequence to 5,2,1,0 works correctly.  Using channel 0 as the trigger.  But the channel 5 interrupt shows up.