To summarize my last post:
ATmega 644 in a breadboard, JTAG functionality only seems to work reliably when powered at 3.3V vs 5V.
I was a little distraught that I had to spend time with dumb issues like this, and not on to cooler stuff. In building this power supply though, I'm sure that I'm going to face a lot of noise issues. I felt dumb.
Well, I'm an Engineer, and what do Engineers do when they feel dumb? They get empirical. Hypothesize, Measure, Test, Rinse, Repeat. Through process of elimination, I knew I could come up with a list of things that were not the cause of my problems. I made a list of random notes as I tried various things that might show a different behavior.
- Added 20pF caps to the 20MHz xtal. - no difference in behavior. (Sidebar: I've always skimped on the 'recommended' xtal caps in my designs, and I've never noticed adverse effects. I'm still 'a noob' in the electronics world, so maybe I've just never had it explained what purpose they serve, but I'm starting to think it's a ploy by the capacitor cartels to increase business)
- Next I tried various resistors in series between the 'Vtarget' lead of the Dragon's JTAG and VCC. My hypothesis was that there might be high harmonic "ring" in the line that interfered with the level converter on the Dragon (which is supposedly engineered aggressively with respect to cost) Basically my thoughts were that it was the "R" part of a low pass RC filter. I already had a variety of power conditioning caps, so I figured the "C" part of the filter had already been in place.
- Tried powering the Dragon from different USB ports.
- Tried powering the vTarget line from the VCC connection on the Dragon itself. I was a little worried that this was not a smart thing to do, since I was powering the Breadboard from a different supply, the level converter might not be converting to the same level.
- Tried powering the entire circuit from the VCC connection on the Dragon
None of these made any difference in the behavior. When VCC was 5 volts, it always failed, at 3.3 it was fine.
I had been using my homemade "JTAG-breadboard lead adapter" to connect the JTAG cable to my breadboard. It's not pretty:
|My homemade JTAG lead adapter. The ATmega 644 is removed in this pic.|
Notice how I wrap the JTAG TCK and TDO lines around the ground wires.
That seemed to improve reliability in past projects, so I always do it now.
The lead adapter and its four digital communications lines were my next target of suspicion. I was about to start inserting series resistors and pullups, without a digital scope, it's pure grasping at straws. By the way, I have a birthday coming up, in exchange for being a year closer to death, I typically get swag. I got clearance from m'lady to go ahead and procure a DSO Quad today. (Note to self: don't use "m'lady" in a social environment, it's a nerd tell). If I still have issues when the DSO gets here next week, I will rain down upon this circuit in analog sampling fury..
Back to my problems. Before getting janky with the JTAG lines, I decided to try my trusty AVR Dragon Rider. (A dev board similar in concept to an STK-500, except you get to put it together yourself). Failing that, I had another 644 chip I could try (ALWAYS have a spare MCU in big projects, so a mishap doens't stop you in your tracks)
Lo and behold, I get perfect 5V operations in the Rider!
|Here there be Dragon Riders.|
What does this tell me?
I think it's safe to say it this point there are 3 possibilities:
- Powering entirely from the Dragon (The Rider does that) gives a better power source than anything I'd used.
- The breadboard is somehow making *a lot* of noise.
- My homemade cable adapter is crap.
1 & 2 are possible, but my money is on #3.
So what is different about the Dragon Rider? I put the Rider together over two years ago, so I dont remember a lot about the schematic, but just form following the the JTAG traces on the PCB, the traces are maybe half the length to the chip that they are in the breadboard. Short is better and position matters. My adapter is a rats nest.
To test this theory, I could cut the wires as short as possible. I'm a little afraid to try that, since if it doesn't improve it, I've lost some flexibility in having a little maneuver room on the leads. (My adapter works for any 10 pin JTAG target, and the coloring follows Atmel/Altera 10 PIN JTAG conventions, though it would work for othter brand chips too)
The other idea I can try is from a blog I read recently, a "BreadHead" is an ISP breadboard adapter made by Blondihacks. It's got minimal sized leads to the AVR. I think I might try and make a JTAG version. A really neat adaptation of that idea might be a 40 pin socket with a 10 pin header off one side.
Till next time,
Post a Comment
I welcome you're thoughts. Keep it classy, think of the children.