ADC spare signals ATMega256RFR2 evaluation board

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

Hi,

 

I am trying to connect an external sensor to the ATMega256RFR2 evaluation board.

 

What I want to know is that the spare signals shown in the diagram correspond to which ADC (i.e. pin 0,1...7 ?)

(In the attached diagram I have marked the ADC signals shown in the user guide...)

 

So, I will program the ADC accordingly (i.e. if I connect to ADC4,ADC3 etc, I will have to program the ADC registers to use that input).

 

I will be grateful for any help... :)

 

BR,

Prashant

This topic has a solution.

Prashant

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

RTFM: Section 4.1.2 "Other Headers" in the User Guide:

 

http://www.atmel.com/tools/atmeg...

 

The schematics & PCB layouts are also on that page.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The user guide comes with complete schematics.

 

Spare pins are (Vcc, PF4, PF5, PF6, PF7) where Vcc is pin 1.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Thanks for the reply alexru!

 

So, I am now trying to connect the external signal to ADC7 ... i.e. the pin pointed to in this diagram...

 

 

 

Following is the code I am using to read the ADC signal (modified the existing temperature sensor example):

uint16_t adc_meastemp (void)
{
    ADCSRC = 10<<ADSUT0; // set start-up time
    // ADCSRB = 1<<MUX5; // set MUX5 first
    // ADMUX = (3<<REFS0) + (9<<MUX0); // store new ADMUX, 1.6V AREF
    ADMUX=(1<<REFS0);
    uint8_t ch=7;
    ch = ch&0b00000111;
    ADMUX = (ADMUX & 0xF8)|ch;

    // switch ADC on, set prescaler, start conversion
    ADCSRA = (1<<ADEN) + (1<<ADSC) + (4<<ADPS0);
    do
    {} while( (ADCSRA & (1<<ADSC))); // wait for conversion end
    ADCSRA = 0; // disable the ADC
    
    // uint16_t temperature = 1.13*ADC - 272.8;
    
    // return temperature;
    
    return ADC;
}

 

Problem is I am getting value 0x3FF (i.e. 1023) irrespective of what signal I supply... From multimeter I measured that the input voltage was 3.65V but I kept getting value of 0x3FF... I even tried to connect the ground but still got the same value...

 

Any ideas please?

 

BR,

Prashant

Prashant

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

Why have you selected those particular pins? There are a few problems here:

1. They are not really "spare" they are actually connected to JTAG. So you will have to disable JTAG in a software before using them. So no debugging.

2. They still will be connected to JTAG programmer, so it will conflict with your inputs.

3. The pin you have marked is Vcc. You can clearly see that the other 4 pins go to the MCU.

4. If you measure 3.65V on that pin, then either your multimeter is way off, or something wrong with the board. Vcc should be 3.3V.

5. You can't measure voltages above Vref, and you have selected 1.6 V reference. All signals higher than this will be represented as a maximum value, which is exactly what you see here (for a different reason, of course).

6. You may also want to read the value first and then disable the ADC, but I'm not sure about that. Makes logical sense though.

 

In short - pick any other ADC channel freely available on the external connectors.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

I am sorry I was wrong about the point where I said that I get 0x3FF even when I connect ground to the input signal... In that case actually the board turns off (the LED goes off)... What I meant was that it shows 0x3FF even when I don't connect any input signal to ADC7... 

 

I am confused as to whether the input voltage range is 0-5V or 0-3.3V? Because on the board pins it shows 3.3V on the power signals.. that would explain its showing 0x3FF value when input signal (>3.3V) is provided...  But not the fact tht it shows 0x3FF even when no signal is connected... 

 

And the user guide also says "External power 4.3V to 5.5V Recommended" in section 3.3 (power supply) ... Meaning the input voltage range should be 0-5.5V??

 

BR,

Prashant

Prashant

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

Prashant Kyal wrote:

I am sorry I was wrong about the point where I said that I get 0x3FF even when I connect ground to the input signal... In that case actually the board turns off (the LED goes off)... What I meant was that it shows 0x3FF even when I don't connect any input signal to ADC7... 

Yes, because you are shorting VCC to ground.

 

Prashant Kyal wrote:
I am confused as to whether the input voltage range is 0-5V or 0-3.3V? Because on the board pins it shows 3.3V on the power signals.. that would explain its showing 0x3FF value when input signal (>3.3V) is provided...  But not the fact tht it shows 0x3FF even when no signal is connected...
Look at the schematic. PF7 is connected to a TMS signal driven from the EDBG chip. It is probably set to logical "1" in your case. But that still does not help you. ADC can't sample signals above Vref, that's how ADCs work. So you will need to externally divide your input voltage, so it fits into a range 0...Vref.

 

Prashant Kyal wrote:
And the user guide also says "External power 4.3V to 5.5V Recommended" in section 3.3 (power supply) ... Meaning the input voltage range should be 0-5.5V??
The power on the 5V_EXT pin of the power connector (J100) must be in that range if you choose to power the board from an external power supply. If you are using USB, then the board is powered from USB and you don't need to worry about that. All other input and output voltages must be 3.3V. All this is described in the datasheet. 

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

Last Edited: Sun. May 17, 2015 - 07:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, understood! Thanks for the reply :)

 

So, one last question... Basically I want to set the refernce vooltage as 5V... since my input signal is from 0-5V...

 

My understanding is that it's possible to have an input voltage range from 0-5V if I set the reference voltage accordingly.. i.e. as per the following table from datasheet:

 

Table 27-11. Reference Voltage Selections for ADC
REFS1 REFS0 Reference Voltage Selection
0 0 AREF, Internal VREF turned off
0 1 AVDD (1.8V)
1 0 Internal 1.5V Voltage Reference (no external capacitor at AREF pin)
1 1 Internal 1.6V Voltage Reference (no external capacitor at AREF pin)

 

If I choose the first option (0 0 AREF, Internal VREF turned off) and provide a 5V external signal to AREF  as per following table from user guide:

 

Table 4-7. SPARE signals header 2
Pin on header ATmega256RFR2 pin Function Shared functionality
1                                            AREF            Analog reference

 

I can then use one of the spare ADCs to measure signals from 0-5V... 

 

Please let me know if my understanding is correct..?

 

Thanks again for your help!

 

BR,

Prashant

Prashant

Last Edited: Sun. May 17, 2015 - 07:29 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Prashant Kyal wrote:
If I choose the first option (0 0 AREF, Internal VREF turned off) and provide a 5V external signal to AREF  as per following table from user guide:
You will exceed absolute maximum ratings for the device and kill it. Read the datasheet, it explains all of that. The device is a 3.3v device, no inputs should ever exceed 3.3V plus some margin, but not 5V, that's for sure.

 

Prashant Kyal wrote:
I can then use one of the spare ADCs to measure signals from 0-5V...
No, you can't. Just use internal reference and put a resistive divider to make sure that your 5 V is properly scaled.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.