AVRISP and PEN pin on ATMega128

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

I've done a number of designs with various AVRs but am working on my first ATMega128 design. I want to enable programming via the AVRISP and I understand that the MOSI/MISO lines from it to the M128 get routed to the PE0 and PE1 lines. The purpose of the PEN pin isn't as clear to me though. Should the RESET line from the AVRISP go to it or to the M128's RESET line? Why? Thanks.

Karl

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

Reset to reset as the serial prog mode works by holding the maga in reset.

The PEN can be left disconnected or held high.There is a built in pullup but if you are a bit over protective you may want to add your own.

The PEN when taken low puts the device into program mode and you can only get out of it by powering down the device.
It was a cause of broken hearts with the 103 as there was no built in pull up and if left floating could cause life to stop.

Keep it simple it will not bite as hard

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

I'm a bit unclear about the proper use of /PEN. I had trouble programming 128s by SPI with an STK500, with /PEN held low. The device would do one ISP operation after a power cycle, such as read the signature or the fuses, but after that, nothing worked. It wouldn't even read the signature a second time. Since the JTAG ICE worked just fine for programming, I didn't need to solve the ISP problem, but Sutton's answer sheds light - perhaps the STK500 couldn't make the M128 exit from programming mode without a power cycle. I'll try floating /PEN tomorrow and see if that makes a difference. But that leaves the question, what exactly is the /PEN signal good for? Page 7of the M128 data sheet suggests it's necessary for ISP; page 304 of the same document seems to suggest it's optional.

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

Proven by experiment. Do not take /PEN low when using the STK500 or AVRISP. Leave it open or pull it high.