ISP/IO pin sharing = corruption ?

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

I made a board to 'serialize' a graphic LCD via i2c; the mega168 is used and I used the typical ISP pins for general IOs too

The problem is that I fail to program the part when the LCd screen is on it's socket (avrdude checksum fails). It seems that one of the line gets 'hijacked' by the LCd and corrupts the programming.

Here is the schematic; I suspect the 'E' line to be problematic.
(Please ignore the VDD/V0 part, it's been reworked, as a few other things)

I've been thinking that maybe I could tie the LCd reset to the Mega reset, to make sure the LCd is in reset when the mega is programmed, but that would probably stops me from being able to reset the screen independently ...

Any suggestion ? I'm a stark newbie :D

Author of simavr - Follow me on twitter : @buserror

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

Can anyone else see the schematics, as I can't?

Yup, sharing the ISP pins may be problematic and must be taken into account when designing.

You can just control the LCD reset with any regular IO pin, but put a pull-down or pull-up resistor there so that when the AVR is in reset, the LCD reset is active too because of the resistor.

- Jani

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

(It's a .png image, the schematic)

Thanks for the idea, I'll try to add a pull-down on that line... 1K would work fine I supose ?

Author of simavr - Follow me on twitter : @buserror

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

My mistake, I just forgot I changed my FireFox settings to load images only from the originating server by default, and this is why the image was not shown.

1k would work just fine, but remember that your display spends most of the time active, not in reset, so the smaller the resistance, the more power is wasted. I'd put a 10k or 100k maybe.

- Jani

EDIT: You propably need to put pull-ups and pull-downs on the E, R/W, CS1 and CS2 pins too, to keep the LCD in a high impedance state, so it will not try to drive any pins shared with ISP.

Last Edited: Tue. Jun 5, 2007 - 12:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To resolve the (potential) drive contention. Connect the shared programming pins as follows:

AVR - + - 1k - LCD
      |
      + - -- - ISP

----
CPL

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

Theiran's tip is OK :!: The capacitance of the LCD-lines screws up the ISP as well. And next: don't share E with ISP-pins. You'll get a buserror ;) As Jani suggests: use pull-down of 10k on E-line.

Yes, I've been there too ....

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

Hmm, a pull-down/up on E pin won't do any good, as that is the ISP MOSI pin too. Only rescue is the series resistors which isolate the LCD, or the pull-ups on CS pins.

- Jani

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

There are two problems:
1. buscontection : during ISP, E is "jogged" as well (when shared as OP does); with undefined levels on CS and R/W that's bad :(
2. even when the LCD is kept inactive during ISP (by keeping E low with 10k pull down, and not sharing it with ISP-pins), the programming can get disturbed due to the capacitance of the LCD-lines. And it's this second one that took me while to find. A mega32 would ISP fine @ 8 MHz AVRclock, but with 16 MHz it failed. Note that this has nothing to do with ISP-speed needing to be less than clock/4 !

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

Thanks guys, I added pulldown resistors on RESET, CS1 and CS2 and now I can program the m168 without corruption.

Now, to add a reset button and... write the damn code :D

Author of simavr - Follow me on twitter : @buserror