Logic levels for 32U4 (Pro Micro)

I have a SparkFun Pro Micro 5V as shown here: https://www.sparkfun.com/products/11098

I am using an external signal derived from an optical sensor as an interrupt in on pin D3 (IRQ0). I have some very strange rigging problems and went to look at the data sheet for what the Atmel part considers to be minimum logic high voltage and maximum logic low voltage. I was unable to parse the datasheet (http://dlnmh9ip6v2uc.cloudfront.net/dat … ga32U4.pdf) to find this information. Any datasheet gurus willing to lend me a hand?

Not sure I get what you’re after…

Page 378 has the info.

V(ih) for minimum input low (4th column)

V(il) for maximum input low (6th column)

Pretty straight forward stuff unless I’m missing something.

The other problem is that little note (5) at the tops of the columns that says:

  1. All DC Characteristics contained in this datasheet are based on simulation and characterization of other AVR microcontrollers manufactured in the same process technology. These values are preliminary values representing design targets, and will be updated after characterization of actual silicon

That right there says “Your Mileage May Vary”.

If the Atmels are like the PICs, the fact that you’re using the pin as an interrupt won’t matter because that particular signal is pulled off the pin after the input buffers, clamping diodes, etc. So basically, a digital input is a digital input is a digital input, unless it’s an analog input.

Page 397 also has some good info on the relationship between voltage, temperature, low and high trip points, etc.

My question is one of hysteresis. I have a fairly slow rising edge (1-3ms) I am trying to get a single interrupt from. What I see are a dozen back to back interrupts during the rising edge. With other logic families, the voltages considered high and low differ by enough that tiny non monotonic fluctuations in the signal are not seen as new rising edges. But that is what I think I am seeing on the Atmel part.

Now I could add in a schmidt trigger or a comparator to square up the slow rising edge, but I do not want to waste my time if the root cause of this problem is something else. And hence I was looking for what the voltages that are considered True and False are on the Atmel when the pin is in interrupt mode.

I will go back and look at the pages you indicated. Thanks.

I have a fairly slow rising edge (1-3ms) I am trying to get a single interrupt from. What I see are a dozen back to back interrupts during the rising edge.

Couple of suggestions:

  • - The input pin is pulled up/down right? (not that I’ve ever NOT done that and troubleshooted for hours before finding it :doh: )
  • - check for lose/inadequate grounding
  • - Bounce library will help with troubleshooting, only after you check and recheck the items above
  • - I/O voltages really shouldn't be an issue even with using a 3v3 input on a 5v IC since the high is so much higher than the low condition
  • fll-freak:
    My question is one of hysteresis. I have a fairly slow rising edge (1-3ms) I am trying to get a single interrupt from. What I see are a dozen back to back interrupts during the rising edge. With other logic families, the voltages considered high and low differ by enough that tiny non monotonic fluctuations in the signal are not seen as new rising edges. But that is what I think I am seeing on the Atmel part.

    Ok, I smell what you're cooking and it makes quite a bit more sense. I've never run into that problem myself, but I can see how it could kick a guy in the nards...repeatedly.

    Somewhere in those same pages I saw a value of .05V for hysteresis for non-schmidt trigger pins.

    Past that, might be time for a bit of creative programming…disable further int’s for X number of ms after the initial interrupt. But I’m sure you’ve already worked thru that…

    Been out all day. The signal is indeed pulled high but with the internal pin pullups. I may switch to a stronger external (10K) pullup to see if that helps.

    SW “debouncing” is a possibility, but it seems like such a defeatist solution.

    If the hysteresis is only 0.5V that a squaring up of the signal with a comparator with 1V hysteresis might be the way to go.

    I hope to look at this in more detail this evening.

    .05V, not .5V

    What are you doing that has that slow rising edge?

    I am building a “gyro calibration turntable” from an old record player. On the outside edge of the shinny metal platter I have painted 88 black stripes. Against this I have pointed a reflective optical sensor with a 2mm focal length. The LED has a simple 220 ohm limiting resister and the transistor part has one leg to ground and the other end to the Arduino pin. I have enable the weak internal pullup (20-50K ohm). The analog value does not change in a binary fashion. It ramps up and down as more or less of the black stripe comes into view.

    Looking at it just now, I think I may be seeing the problem. To debug the system I have been setting an IO pin high then low in the ISR at the same time I am incrementing a counter. When that pulse comes out, the analog voltage from the encoder sensor drops a bit. Looks like more than 0.05V. But the voltage rail (output of the Arduino) look rock solid. I think that low glitch re-arms the edge trigger in the micro and as the signal is pretty much flat compared to the time it takes to perform the ISR, it triggers again and again. At some point the signal ramps up high enough that the little glitch is no longer in the no-man-land.

    So the question now MAY be: why the dip in voltage on the transistor output when a digital IO pin is pulsed. This may very well be some coupling inside the chip between IO pins. I may turn off the internal weak pull up and use an external stronger pullup (5-10K) and see what happens then.

    So I performed a test where the optical sensor and sensor were non-moving. The analog output of the sensor should be rock steady. And it is as long as no output pins are pulsing. When a pin does go high, the digital input line dips a bit (600mv) and the comes back up with a characteristic capacitor charge curve. I hope that you will see the scope trace attached.

    When I turn off the pulsing output output pin, there is no glitch and the system only counts one pulse per transition as it should.

    Edit: File attachments do not seem to work (or at least not for me).

    Edit: So if I add a small cap between ground and the output of the encoder transistor, the dip gets much worst. This is born out by my observation that putting a scope probe on the encoder output would cause 2-5 times more fake interrupts. 10nf, 333nf, 100uf, all cause more ringing. That does not make sense to me. The cap should slow down the response not excite it. Any ideas?

    Are you actually using a transistor to fire the Arduino pin? Or a MOSFET?

    Cap for slowing down the response - It might be exciting it if that input voltage is hanging around that Hi/Lo transition point for a longer period.

    dipping input line - need more decoupling or bulk caps on the Arduinio power source?

    You said the power rail on the Arduino looks solid, but can if source enough juice quick enough to whatever is going out of the Arduino…same thing for the LED. There’s a tad bit of capacitance in an LED, as well as at the base of a transistor. Not a lot, but, maybe it’s all stacking up against you.

    You also said earlier about the edge trigger in the micro. Is the interrupt actually edge triggered or is it level triggered? I don’t know what the actual difference is in the circuitry, but might be something to look into.

    Straws - Me grasping at them.

    The sensor I am using is a tiny (grain of rice) sized reflective IR sensor. It has an IR LED and a photo transistor mounted in a 4 pin package. I think the ones I am using are the Vishay part. The LED is on continuously. The transistor saturates when it is pointed at something shiny and stops conducting when looking at something non reflective to IR like black finger nail polish.

    With a 20K pull up, the current flow through the transistor when on is less than 1 ma. And since the edge is slow, there is no visible effect on the power rail.

    What does seem to be the problem is just turning on an IO pin that is not loaded in any way other than the capacitance from a scope probe. When the IO pin pulses, the voltage rail looks solid as I can tell. On AC coupling and 20mv per division I see no change in the power rail as measured on the 5V0 pin on the Pro Micro. But when I look at the pin from the optical sensor I see a substantial dip followed by a capacitive asymptotic charge back to the original voltage.

    So there is obviously some kind of cross connection between an output pin pulsing and needed a slug of current and the buffering circuit on an input pin. I gave up in frustration last night (as well as to spend time with my wife). What I did learn was that if I did not pulse the debug IO pin, my count became much more regular.

    As far as decoupling, the Pro Mini has a fair amount. I did try more, but that had no effect.

    Capacitance on the LED should not be an issue as it is on all the time. No pulsing and corresponding slugs of current.

    Not sure what the internal circuit is for the 32U4 as far as rising edge versus level. I would assume it is an edge detect as stated in the attachInterrupt method.

    Today I will try to reproduce this on an older Duo I have. It may be something in the layout of the ProMicro or the 32U4 chip itself as compared to the older chip.

    Ya know the more I think about it (and don’t get me wrong, I haven’t been thinking about it much :slight_smile: ), the more I go back to those circuits I built that didn’t operate correctly and in the end turned out that the only ground I had was intermittently thru various digital I/O pins.

    And the reason I mention this is because you’re seeing the voltage dip on the sensor, then the rising “cap curve” during the pulse.

    The “grain of rice” IR sensor. Is that the same 4 pin IR sensor used for line sensing? I forget the part number, but I’ve got a couple dozen here, SMT and PTH. Never had a problem with them, Arduino or PIC, on interrupt, digital, or A/D pins. I’m using them in SumoBots in various capacities, so I’m thinking that the slow edges you’re getting are the same slow edges I’m getting when the SumoBot gets close to a line, although in my case it’s a one-shot deal vs. a repeating thing.

    The part I am using is an Omron EE-SY125. I gave up on this for a while, but now I am wondering if driving an output pin into no load might be a bad thing. I may simply add a load resistor to ground and see if that minimizes the cross coupling from an output pin pulse to an input voltage.

    I do not think a bad ground is the case, but it could be that I am using 8 inches of wirewrap wire for the connection to the ProMicro. I may switch to a thicker gauge and see if that helps at all.

    Wirewrap wire is some small stuff, but jeez I wouldn’t think even a couple hundred mA would have a problem with it.

    I’m liking the idea of a load resistor. Kinda like terminating a line. Just might help with ‘ringing’, if in fact that is what’s going on.

    Load resistor on the ProMicro setup did not work. Neither did the Uno I have around. Still getting a gazillion edges.

    Went through my stash of parts looking for a comparator to implement 1 volt or so of hysteresis but could not find one. Of to the Shack at lunch tomorrow.

    fll-freak:
    Off to the Shack at lunch tomorrow.

    Uggg… :o

    Couldn’t you just desolder one off an old motherboard or something?

    I could, but I somehow enjoy sticking sharp objects into my eyes.

    I equate a trip to the Shack the same way.

    You might recall a long thread wherein the OP was (in part) getting an optical sensor interfaced with an Arduino. The intent was to measure an Airsoft BB passing by the sensor (thus blocking the IR path). The output was an OC type with, IIRC, a 15k internal pullup. Long story short, there were multiple interrupts happening. Some of these (IMO) were due to line reflections on the ? 18" ? of cable connecting the sensor to the Arduino. Decreasing the pullup resistance did have some effect, though it never completely cured the problem. I was never sure how much droop and ground bounce contributed. One thing I wanted to try was somewhat counter-intuitive. I wanted to add some capacitance to the line and/or (perhaps) some more series resistance. The idea was to detune the line so the reflections wouldn’t constructively add up enough to get past the Arduino’s hysterisis. Just something to ponder over …

    Good grief! You want me to read that massive thread on the BB gun? I stopped after the 3rd page!Ok, Ok. Perhaps this evening.

    I am not an EE, but I was under the impression that reflections were only an issue if the edge time was about the same as the transmission time of the cable. Since my edge times are about 1ms, that would mean a cable of 1000 feet. Mine are about 8 inches long.

    Now I have not gone back to investigate this issue any more. Last night was spend finalizing the motor control HW and SW to clear my bench. Now I should be able to dig into this problem.

    Page 328 of the 32U4 datasheet suggests that Vil (max) at 5V0 is 0.9V and Vih (min) is 1.9V. This would suggest a one volt hysteresis. But that does not seem to be the case at least in the case of rising edge interrupts where as little as 60mv seems to cause a rearming. I plan to put a precision ten turn pot on the interrupt pin with tons of capacitance and make a careful survey of the hysteresis. Will report results.