I have an ATmega8 with a Nokia LCD 5510 connected to it. Everything works great on a breadboard and my next step is to move it to a more permanent board. My problem is that I can't program the ATmega8 while the LCD is also connected. I assume it's because they use the same SPI pins and that the LCD somehow interferes with the programming. How can I do this different so that I can flash the ATmega via ISP without unplugging the LCD?

  • 2
    \$\begingroup\$ You'll really need to add a circuit to get a good answer on this. You can use Ctrl-M to launch the on-site schematic editor or otherwise just put a link to the schematic and someone can edit it in to the question. \$\endgroup\$
    – PeterJ
    Jul 19, 2013 at 12:25
  • 1
    \$\begingroup\$ Is the device active low? If yes, then did you add a pull up resistor? If you didn't, then the device would hog the SPI bus until it's released. \$\endgroup\$ Jul 19, 2013 at 16:26

2 Answers 2


You have to prevent any other device from driving the SPI lines during programming.

To avoid driver contention, a series resistor should be placed on each of the three dedicated lines if there is a possibility that external circuitry could be driving these lines.

enter image description here

Take a look at Application note AVR910.

To avoid problems, the In-System Programmer should be able to keep the entire Target System Reset for the duration of the programming cycle. The target system should never attempt to drive the three SPI lines while Reset is active.

So it would be best if the reset lines of the ATMEGA and the display are functionally connected to prevent the display from doing anything while the programmer holds reset.

  • 1
    \$\begingroup\$ If the LCD has a chip select line make sure to pull that high with a resistor as well. During programming the ATmega is in reset, which sets all the input/outputs as high impedance, so the LCD will be inactive. \$\endgroup\$
    – Austin
    Feb 5, 2016 at 15:09
  • 1
    \$\begingroup\$ @Rev1.0: It should be enough to have a resistor in the MISO line (because that's the only output of the SPI slave device, the other two lines are inputs and therefore can not cause any interference). \$\endgroup\$
    – Curd
    Feb 5, 2016 at 15:25
  • \$\begingroup\$ @Curd, add your answer with schematic and I'll upvote it. Sounds like the best two approaches are either adding a resistor to just the MISO line, or adding a CS pullup, or both. \$\endgroup\$ Apr 15, 2016 at 3:31

Another solution is to disable the screen during programming.

The screen is active when the CS (chip select) pin is low (0v). If you put a 10kR pull-up resistor between the CS pin and 3V3, it will be disabled/high by default. To enable it, connect the CS pin to an output of you micro controller and set that output to low (0V). I did that on one of my projects and it works well.

The screen runs at 3.3V, you will have to add voltage divider if your micro controller runs at 5V.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.