Two questions regarding analog comparator

Go To Last Post
79 posts / 0 new

Pages

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

Certainly.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

Thanks :)

Will do that if I get the 128RFA1 available today :)

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

kilo ohm---Point#3 (V)---Point#1(V)
0,00----------0,36------------0,00
0,06----------1,39------------0,21
0,10----------1,42------------0,36
0,15----------1,45------------0,55
0,20----------1,47------------0,74
0,25----------1,50------------0,91
0,30----------1,54------------1,10
0,35----------1,57------------1,25
0,40----------1,62------------1,47
0,45----------1,70------------1,65
0,50----------1,84------------1,84
0,60----------2,24------------2,24
0,70----------2,66------------2,66
0,80----------3,09------------3,09
0,87----------3,38------------3,38

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

Now you can clearly see that your 128rfa1 is pulling the pot output high with ~100 uA current (I=(0.36V-0V)/3.4k). This current value suggests again that you failed to turn off the PORTE.2 pullup resistor - actually you did the opposite in your code (PORTE=0x04 line). Replace it with PORTE=0 and check for the effect.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

I've done all the last tests with DDRE=0x00 and PORTE=0x00.

I tried now to change it to PortE=0x04, and did measurements on 0,00k-ohm, 0,10k-ohm, 0,30k-ohm, 0,50k-ohm and 0,80k-ohm.

On these five tests, there was NO difference from the test I did above with PortE=0x00, except for 0,5k-ohm. Here I get 1,84V on #1, and 1,9V on #3. When I changed it back to 0x00, it jumped down to 1,84.

So... The pull-up does not deactivate when it is suposed to? Is that the error?

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

Check your entire code for ANY wrires to PORTE.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

Here is my entire code. I really can't understand that it can be anything "wrong" in this simple code?

/*
 *  Written in AVR Studio 5
 *  Compiler: AVR GNU C Compiler (GCC)
 *
 *  Author: AVR Tutorials
 *  Website: www.AVR-Tutorials.com
*/
 
#include
#include 
#include



 
int main()
{
   DDRE=0x00;
   PORTE=0x00;
 
    
   while(1)
   {
       
   }
 
   return 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Never used 128RFA1, does it possibly have JTAG pins on PORTE?
If so disable JTAG fuse.

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

Make sure nothing of STK600 is connected to PORTE.2. Since the analog comparator's inputs can be connected to some other chip pins by ADMUX settings, remap the AC inputs to some other ANx inputs and check over if you still have problems.

Also make sure the STK600 is smart enough to have the [not AVCC, corrected->]AVDD pin connected to the VCC.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

Last Edited: Wed. May 9, 2012 - 06:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lennart wrote:
Never used 128RFA1, does it possibly have JTAG pins on PORTE?
If so disable JTAG fuse.

Uhm. I have a 10-pin cable from JTAG to a 10-pin just next to the JTAG-port on the STK600. But these are definitely not on the PORTE or any other ports. It's seperated on its own section of the STK600. So, I don't think so?

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

MBedder wrote:
Make sure nothing of STK600 is connected to PORTE.2. Since the analog comparator's inputs can be connected to some other chip pins by ADMUX settings, remap the AC inputs to some other ANx inputs and check over if you still have problems.

Also make sure the STK600 is smart enough to have the AVCC pin connected to the VCC.

I don't know how I can make sure that nothing of STK600 is connected to PORTE.2. Well, isn't it obviously that the STK600 is connected to the PORTE.2? Isn't that kind of the point with the STK600? Anyway, I'm sure that nothing "else" is connected to my circuit.

About what you say regarding ADMUX and remapping: I depend on to use the MUX-functionality because I use both AIN1 and ADC0 as the inverting inputs for the comparator. I'm positive to your idea to remap the input-pins for the comparator, because it seems that it's only PortE.2, PortE.3 and PortE.4 that is damaged (or having the same problems). How can I learn how to do this?

The word "AVCC" is not existing, neither in the 128RFA1-datasheet or the STK600-datasheet. Could you please tell me more about this?

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

Sorry, I mean AVDD. And by STK600 I mean any components of STK600 PCB.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

Quote:

But these are definitely not on the PORTE or any other ports.

??? So, how does the JTAG work, if not connected to your target chip? ESP?

What does the datasheet say? You can look at the pinout diagram, or the JTAG section, or the pin descriptions, or the alternate function tables, or ...

Anyway, JTAG is on port F.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

I connect the stk600 JTAG programmer signal to the JTAG pins target device as ilustrated in these pictures:

Does that mean that the PORTF and the "JTAG Pins target device" is basicly the same port? Could I connect the "stk600 JTAG programmer signal" to the PORTF instead?

I will look more on AVDD tomorrow. Tomorrow I will also take the 128RFA1 to my employer, so I can compare it to another 128RFA1 that they have. Maybe I can borrow an functioning 128RFA1, or maybe is is able to find the problem.

I'll give you report :)

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

Quote:
Does that mean that the PORTF and the "JTAG Pins target device" is basicly the same port? Could I connect the "stk600 JTAG programmer signal" to the PORTF instead?
No, only 4 pins of JTAG are connected to PortF.
Don't know where reset pin is located on that chip but reset is one of the pins used by JTAG.
In short, use JTAG connector for JTAG.
You might want to remember which pins on PortF that are JTAG cause they will behave odd as long as JTAG is enabled.

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

Thank you for the clarification :)

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

Hmm. My employer also have stk and rfa1. He measured almost the same as me. Conclusion: nothing is specifically wrong with my rfa1, but it seems to be a common 'error'. I just think it's wierd that it's not a known error :s

But should I then use the voltage follower op-amp to get a working solution for our presentation, or do you have any other suggestion?

Last Edited: Thu. May 10, 2012 - 07:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since the STK600 schematics is still top secret, you should inspect the whole PE2 trace on STK600 PCB and find all PCB components connected to it. Another solution is to throw away the STK and either route your own M128RFA1 breakout board or get the ready made one like this.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

I think that would be way more than what we are able to do in 19 days. I've now got answers from Atmel support, so I think I will continue with them. I will reply here if I get a working solution. But realy... Thank you guys for the support! :D

Quote:

We have observed the following behaviour at our side, where the voltage measurements (using multimeter) directly on the PE2 and PB2 pins of on the ATmega128RFA1-EK + STK600 :

DDRB = Low and PortB = Low -> 0.2V
DDRB = Low and PortB = High -> 3.3V
DDRB = High and PortB = Low -> 0.002V
DDRB = High and PortB = High-> 3.3V

DDRE = Low and PortE = Low -> 1.85V
DDRE = Low and PortE = High -> 3.3V
DDRE = High and PortE = Low -> 0.1V
DDRE = High and PortE = High-> 3.3V

Ther variation between the two ports shall be due to the difference in the alternate port function (refer section 14.3 Alternate Port Functions in datasheet).

We assume you are trying to input sensor reading to Analog comparator. Do you find any wrong results in analog comparator? If so please provide the code and output results.

Please explain the actual issue that you are facing at your side.

Best Regards,
Sivagurunathan S
Atmel Technical Support Team

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

Sivagurunathan S wrote:
Ther variation between the two ports shall be due to the difference in the alternate port function
Email him he's an ignorant idiot. Period.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

The alternate port function for PE2 is Analog Comparator Positive Input (surprise??!!).
Someone with a bigger brain than me maybe can explain why 1.85V is the "normal" value to be expected.

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

MBedder: Could you please be more specific? As the noob I am, I don't think it's a good idea for me to walk around and call everyone "Stupid Doctor" and "Ignorant idiot" =)
Why do you think he is ignorant? Because he is neglecting the fact that I got almost 2V on my input? He is pointing out that it has something to do with the comparator, and it seems like he wants to help me?
Constructive feedback will be appreciated :)

But yes, I'm really wondering the same thing as Lennart. Why the F... is it like this :S

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

The first thing which he must have checked is the STK600 schematics which he as a techsupport guy should have an access to. Instead, he was blindly repeating your experiment which obviously has shown nearly the same results as yours.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

Mhm, I see. I will try to formulate a reply to him tomorrow =)

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

Feel free to supply a link to my posts to him :lol:

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

Ok, new reply from AVR support.

Quote:
Please understand that we have the LED and Resistor connected to PE2 pin in the ATmega128RFA1-EK card. This might affect your expected results.

Please refer the schematics of ATmega128RFA1-EK board, you can find this document in the location -> http://www.atmel.com/tools/ATMEG...

Try removing the resistor which is connected to PE2 pin, this will isolate the pin from VTG_INT.

Hope this solves the issue.

I assume that they are referring to the R8=470R and green D2 in the upper right corner of the schematics.

Does anyone of you know how I "remove" the resistor? Do they actually mean physically to remove that little resistor with a soldering iron?

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

Quote:
Please understand that we have the LED and Resistor connected to PE2 pin in the ATmega128RFA1-EK card. This might affect your expected results.
Bingo! That's exactly why I said he's an idiot when I saw he's doing the measurements without trying to locate and disconnect all external components from PE2. Nevertheless, that had to be the first thing you had to do yourself - checking the available schematics.

Yes, you have to desolder the resistor.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

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

Sorry :/

That part in the upper right corner was outside my screen, so I did not notice it.

I know you have told me to remove all the external components, but could not imagine that you were referring to the the external components that was soldered on the 128RFA1 by the manufacturers :)

But thank you so much for your help and time! I'll try to do this tomorrow if I'm allowed by my employer. Can't understand that I can do this without killing the guarantee :O

Pages