Does 6pin ICSP header offer everything I need atmega328P?

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

.. in the old days of AVR there were some things you needed to do that only parallel programming could handle, like blow a fuse. Which created an impossibility once the chip was soldered down on a target board with only an ISCP header for maybe flash or eeprom updates.

So I would appreciate a sanity check before picking a production method ... that a 6 pin header is enough to do all of the following scenarios, and if not, .. what are the gotchas?

For the atmega328P, can everything be done to a virgin chip over just a 6pin in-circuit serial programming interface (header) soldered on the target board? The 5v board has a 16MHz crystal on it. Using STK500 and Studio 4 for in-house programming.

I'm thinking of my options, of having the assembly house do bulk chip, or post-assembly (soldered down) programming flash and eeprom, over the 6pin header.

Or maybe mixed mode, whereby they do the flash (all the same) but I add just the eeprom config data over the 6pin header.

All possible?

Regards,
Scott

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

You can program flash, eeprom and fuses via ISP, I do it all the time. The one issue I ran across recently, and I know from posts here that others have also faced it, is if you get your chip in a state where it's not oscillating you may need to provide an external clock to X1 to make the ISP work. Then you fix the misprogrammed clock fuses via ISP and you're good.

Mike

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

I have a 16MHz crystal firmly planted to the chip on the board. The only way it could not oscillate is if internal oscillation was selected. But either way, the chip should be getting good vibrations.

Let me stretch your comment out a bit..
Can I program flash, eeprom, and fuses of the atmega328P all independently of one another, over the ICSP?

Regards,
Scott

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

Yes, you can. As long as you don't do something silly and pick an incompatible oscillator setting (like low frequency external).

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

theatrus wrote:
Yes, you can. As long as you don't do something silly and pick an incompatible oscillator setting (like low frequency external).

Thank you, that's exactly the kind of gotcha I was hoping to learn here.

And for the record, a virgin chip does not have low freq external as its default, does it?

Regards,
Scott

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

Virgin chips are set to use the internal oscillator (8MHz) divided by 8 (CKDIV8 fuse).

In any case, you can usually get the device to spin its wheels by injecting a logic level square wave to the first oscillator pin, irregardless of oscillator setting.

I haven't needed to bust out the high voltage programming setup for years. I'd rather pull the chip off the board and bin it than go though that :-)

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

Quote:
In any case, you can usually get the device to spin its wheels by injecting a logic level square wave to the first oscillator pin, irregardless of oscillator setting.

However, if you program the RSTDISBL fuse, then all ISP functionality is not available, regardless of any oscillator settings.

Regards,
Steve A.

The Board helps those that help themselves.

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

Koshchi wrote:
Quote:
In any case, you can usually get the device to spin its wheels by injecting a logic level square wave to the first oscillator pin, irregardless of oscillator setting.

However, if you program the RSTDISBL fuse, then all ISP functionality is not available, regardless of any oscillator settings.

Bing! Another gotcha revealed.

Thanks for this one.

Regards,
Scott

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

I guess on that note, but maybe stating the obvious - there is a serial program enable fuse bit SPIEN, turn that off, and you're not programming it again...

Regards,
Scott

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

ISPEN fuse cannot be modified from ISP programming, just as it was with the older AVR's. Note that on some of the older AVR's the fuses were modifiable from ISP mode, with the exception of the ISPEN fuse, and possibly a few others. Most of the other 90S era chips only had 2or 3 fuses, ISPEN, FSTRT, and sometimes RCEN, so there wasn't much need to have them accessible. Modern AVR's have many more fuse options, and it makes sense to have them available in all programming modes.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.