[SOLVED] USBasp and TFT - MISO/MOSI line interference?

I'm away from my "arduino-laboratory", anyway I'm thinking about what happens while re-programming my Arduino Pro Mini - 3.3V while the TFT is connected and powered. I'm using a cheap 1.44" via adafruit libraries.

Here my simple schematics:

Somebody experienced troubles when trying to re-program Arduino with a similar wiring?

As I know the CS pin of the TFT is the key: it is connected to the SS pin of arduino to indicate whenever the master is sending data (and the slave has to receive them) or viceversa.
What if I put that pin to logic level high (i.e. connecting it to 3v3 by using a wire) when reprogramming arduino with the USBasp dongle?

In fact, it seems that the IDC-10 connector coming from the USBasp board is not using the SS pin at all:

Yes, installing a simple jumper to power off the TFT seems the most logic and easy option, but I have some dozens of PCBs yet designed and printed. So I would not to modify the design/layout of the PCB, as well as to wait a month until they are ready.... :frowning: :frowning: :frowning:

Your schematic does not show the ISP connections, how are you connecting the USBASB?

You need a 10k pull-up resistor on the processor RST pin.

Rhetorical statement: why do people order pc boards of an untested design?

Hi avr_fred,

Your schematic does not show the ISP connections, how are you connecting the USBASB?

It's quite straightforward from the image of the IDC-10 connector of the USBasp dongle I posted:
(Please note that the image I posted is for a 5 Volt programmer, I'm using a USBasp @ 3.3 Volt instead)

**IDC-10 **
MOSI MOSI pin (#14)
MISO MISO pin (#15)
SCK SCK pin (#16)
VCC +3.3V VCC pin (#21)
RESET Reset pin (#22)
GROUND GND pin (#23)

You need a 10k pull-up resistor on the processor RST pin.

The reset pin is also connected to the RST pin of the USBasp programmer (see table above). Your proposal will not affect the succes of the programming action?

Rhetorical statement: why do people order pc boards of an untested design?

I don't understand what you mean. I'm using the circuit above with success since 2 years.
Until now I was re-programming my Pro Mini by using an FTDI breakout. Now I want to approach to ISP programmers, that is something new for me.

Maybe a 10K pull-up resistor on the SS pin of Arduino (#23 in my schematic) ? ::slight_smile:

In this way the TFT should be never be "activated" as a slave and it will not be messed up by the write-operations of the ISP-programmer...

The SS line or the reset line of the TFT could hang things.

I’d pull both up or down as appropriate. Reset should be what holds the TFT in reset which should float the SPI pins of the TFT. The processor output pin that you're using to control it will be floating hi-z when programming - so what state does that leave the TFT in?

Tomorrow I will try to pull-up the RST pin only and see what happens. Then I will try to pull-up the SS and RST pins both.

Just one doubt: the RST pin is in common with the RST line coming the USBasp too. When re-programming an arduino it is normal to have it constantly at high-level?

But maybe the only way is doing some tests. I'm just worry to damage one (or more) TFT in doing that... :frowning:

10k pullup on reset is not needed when programming via ISP (though is recommended for noise rejection on reset pin). It is necessary if programming with serial bootloader using DTR reset trick.

You probably do need a pullup on the CS line. Also, check specs/resources/datasheet for the display - some "SPI" devices don't actually tristate MISO when CS is released (making it impossible to have more than one SPI device on the bus) - if that's the case, the standard solution is to connect ISP straight to the pins, but put a resistor between the MISO pin of microcontroller and MISO pin of the poorly-behaved SPI device (screen in this case), so if it and the ISP programmer fight for control of that line, the ISP programmer will win.

Also, is the screen being powered? If not, you'll be "backpowering" it through the SPI pins, and that will drag those pins down - potentially damaging the screen in the process.

Failure... :confused:

1st attempt: detach TFT power - Failed

I have cut the trace on the PCB powering the TFT display. Nevertheless, the display was still weakly powered via the other pins (MISO, SCK, etc.). The luminosity was low, but it was clearly still working.

After uploading the sketch via the USBasp programmer I've got the error during the verification phase: "verification error, first mismatch at byte 0x0000..."

2nd attempt: pull-up the chip-select line - Failed

I have attached a 10K pull-up resistor in order to force the line to the logic HIGH level (see the attached circuit).
After uploading the sketch, the verification phase failed:

avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

I have detached the arduino from the PCB board and tried to program it alone. Again the same error.
I was no able to re-program the Arduino anymore. Arduino fried. :sob:

Any other idea?
BTW, the display is using an ST7735 chip.


I've found the solution by reading a question on StackExchange:

I have added one 10K resistor on the MOSI line, just between the TFT and USBasp programmer. It has worked like a charm.
The MISO line was not used by the TFT at all, so need for a second resistor. Also, the SCK line is used for pure timing, so there is no real need to "silence" that one too.

As I have experienced , there is no real need to remove the resistor after the re-programming is complete. The TFT continue to work normally even with the resistor still in place.