No success running TFT ST7735 on MKR1000

This is my first crack at running a display on Arduino (except basic lesson with 2x16 LCD on UNO). So far, I have not been able to get anything on the display except all white.

This project is on the MKR1000. I am using the Adafruit-ST7735-Library, and their example:
"graphics test.ino" at this url:

Compiles and loads OK. Digital monitor will continuously display a digitalWrite that I put in the loop, but nothing happens on the screen.

The display module is a Qianson 1.8 inch Full Color 128x160 SPI TFT LCD Display Module (tho inscription says 128x120) seen at this url:

https://www.amazon.com/gp/product/B01J76ZGMY/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

The hookup I used is this:
TFT: MKR1000:


GND - GND
VCC - VCC
SCL - PIN 12
SDA - PIN 11
RES - PIN 9
DC - PIN 8
CS - PIN 10
BL - VCC

I thought I followed correctly everything I could google, but no cigar. Any help would be greatly appreciated.

Thanks...

I have never used a MKR1000. Nor have I looked up the hardware SPI pins.

I suggest that you try the bit-bang constructor e.g.

// Option 2: use any pins but a little slower!
#define TFT_SCLK 13   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

And most importantly you must have a CS pin (Chip Select)

David.

Ooops! I had typo in the hookups. Corrected now. I didn't try that option 2 because I didn't understand it. I guess it means you only need the SCLK and MOSI pins hooked up besides power? I'll try. Thanks

For HW SPI:

// variant.h of MKR1000
//#define PIN_SPI_MISO (10u)
//#define PIN_SPI_MOSI (8u)
//#define PIN_SPI_SCK (9u)
//#define PIN_SPI_SS (24u) // should be 4?
// variant.h of MKRZERO
//#define PIN_SPI_MISO (10u)
//#define PIN_SPI_MOSI (8u)
//#define PIN_SPI_SCK (9u)
//#define PIN_SPI_SS (4u)

No. The bit-bang constructor uses all the pins in the arguments.

The hardware constructor does not need to see SCK, MOSI arguments because it knows they are fixed in hardware.

Without checking the MKR1000 docs, I don't know which are the hardware SPI pins or which SPI or alternate-functions are used by the MKR1000 variant.

The Zero and M0_Pro can use SPI on 10, 11, 12, 13 but the Arduino Core does not support it.
The MKRZERO and MKR1000 are different boards.

David.

Well from the responses I see that I haven't got the foundational knowledge under my belt yet to really be in this conversation. I am trying to read up, though, but:

...I'm finding conflicting (in my mind) information as I read different websites. For example, pin names on the display modules. Some place says MOSI is equivalent to SDA, or that SCL, SCK and CLK are equivalent designations for the clock signal. Then, I see that on the MKR1000 there are both MOSI and SDA pins, and also both SLC and SLK pins - as labeled on the board (See attached photo)(and btw, how can that be. if pin assignment is dependent on firmware or sketch?) .

Good news is that I got the ST7735 to work on my UNO by cross-referencing the pins on Adafruit's example to my module. So at least I know the module is good.

I just need to understand how to determine the correct pins on mkr1000. How do I determine from the variant.h file? The nomenclature is not clear to me: does 10u mean pin 10? But then, what does pin
26u-29u mean when there are no such pins? And what is the "SS" signal?

A-a-a-nd note that the graphicstest sketch does define CS->10, RST->9, DC->8. But, the variant.h spec shows SCK as pin 9 (if 9u means pin 9).(Ha! Confused again! :confused: )

I'm sure I'm just missing the boat here, and I hate being such a high-maintenance simpleton, but I guess I need help.

Thanks if you can get me off the ground...

With the Arduino pins are named digital# e.g. 5 and analog# e.g. A2

These pins might be connected to different ports on the actual AVR or ARM chip.
For example digital#8 on a Uno is PB2, on a Mega is PH5, on a Leonardo is PB4, on a Due is PC22, on a Zero is PA06, ...

You should just look at the labels on your MKR1000 board. If you are told to use 8, connect your wire to 8.

I suggest that you start with the software constructor. Wire your ST7735 display pins to the appropriate pins on your MKR1000.

When you have verified that your display is working, you can try the hardware constructor.

Write down your wiring scheme or post a drawing or photo with your message.

David.

OK. Sorry I can't spend more time so I can get back sooner.
Dave, your comments got me to trying harder to understand better, tho I'm not familiar with all the terms:

  • I have attached a couple wiring diagrams I tried. There have been several other variations, but I'm having second thoughts. The ONLY example of someone hooking up TFT display was different display using pins that made no sense to me (image name timestamped 09:28.10 PM). I tried it, but didn't work. The other diagram attempts to use pins called out in the graphicstest sketch.

  • Using like-named pins addressed RES, SDA and SCL - but what about CS and DC?

So, trying to Google for tutorials, other examples of successful running TFT display from MKR1000 turned up nothing. Additionally, I tried digging in to variant.h files, libraries, ports, etc. as brought up in yours and other's posts, and I wasn't able to make enough sense of it all.

  • Ports on mkr1000 apparently have several pins on port A and a few on B if I read this right:
    https://www.arduino.cc/en/uploads/Main/MKR1000-schematic.pdf
    I don't know how to relate these to firmware, libs, &/or sketch anyway.

  • Re: variants - I dug down into Arduino-1.8.5 hierarchy (not knowing where else to look) and found:
    /Arduino-1.8.5/arduino-1.8.5/hardware/arduino/avr/variants/standard/pins_arduino (the only file there)
    There were some PIN_SPI_** pins defined in there: SS(10), MOSI(11), MISO (12), SCK (13)
    I had no idea how to relate this to my situation, - didn't appear to be anything MKR1000-specific

So, it's dawning on me that I am barking up the wrong tree. Either I am really missing something very fundamental, or based on the lack of anything on the forums or web in general on hooking up a TFT Display, at least ST7735, to a MKR1000, it just isn't ready for plug-n-play guys like me. Has it been done? Is it intended to be done? I can see no indication that it has.

So, unless I find out otherwise, I'll probably just pursue the next phase of my project and get the MKR1000 to run on wifi. That seems to be it's main purpose, anyhow.

If I get some success on the display effort, I'll post it.

Thanks, all

Oh - and shame on me. :blush: I drew a blank on "use the software constructor" advice. I had no clue how to make that happen. Then after looking at it again (and again and again), it dawned on me it must be a matter of commenting out the hardware constructor and uncommenting the software constructor.

But, except for SCLK (which I presume is SCL on the display) to 13, and MOSI (which I presume to be SDA on the display) to 11 (which are defined in the sketch), I still do not understand what pins on the display go to what pins on the MKR1000.

As I said in previous post, I probably will have to wait until someone has done this, and can explain in detail how.

Aloha... :confused:

Install Adafruit_ST7735 library with te Library Manager.

Edit the example graphictest.ino for your 9:28 wiring:
Note that I have put RES on a proper GPIO pin (5)

#define TFT_CS     6
#define TFT_RST   5   // you can also connect this to the Arduino reset
                      // in which case, set this #define pin to 0!
#define TFT_DC     7
// Option 2: use any pins but a little slower!
#define TFT_SCLK 9   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

Edit the example graphictest.ino for your 9:32 wiring:
Note that I have put RES on a proper GPIO pin (5)

#define TFT_CS     10
#define TFT_RST   5   // you can also connect this to the Arduino reset
                      // in which case, set this #define pin to 0!
#define TFT_DC     8
// Option 2: use any pins but a little slower!
#define TFT_SCLK 12   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

Edit the example graphictest.ino for more sensible wiring:
Note that I have put RES on a proper GPIO pin (5)

#define TFT_CS     6   //CS
#define TFT_RST   5   //RES
                    
#define TFT_DC     7  //DC
// Option 2: use any pins but a little slower!
#define TFT_SCLK 9   // SCL
#define TFT_MOSI 8   // SDA
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

If you change to the "more sensible wiring", you could use the hardware SPI constructor:

// Option 1 (recommended): must use the hardware SPI pins
// to use the microSD card (see the image drawing example)
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);

I have every sympathy for you. The clever Chinese have chosen to use un-intuitive names for the pins. The World Convention is SCK for SPI Clock Input and MOSI for SPI Data Input

SCL, SDA normally refer to the I2C bus.

David.

BOOM! YOU HAVE DONE IT!.

I used the "more sensible wiring" approach with the defines set up as you showed, and it just took off and worked!

I'm so happy I could kiss you! Uh-h, well maybe not that happy, but thank you very much for sticking with me. Now, I'm encouraged again that the overall project could work.

I don't know if this setup would be readily apparent to most people who want to run a display with the MKR1000, but in case there are others like me, who don't (yet) understand the SPI interface, or Arduino architecture very well, I'd like to provide this setup in a prominent way somehow, not buried in this long discussion. You are an experienced forum contributor, what would you suggest? New post with a positive title, you tube... other?

Any of your wiring schemes would have worked with the Software constructor (Option 2)
Only the "sensible" scheme works with the Hardware constructor (Option 1)

Filling in the arguments for a constructor is little more than matching the "digital #" e.g. what number is printed on your pcb.

For bit-banging (Option 2) you can use any pins you like. For example place all your jumper wires in order.
For hardware SPI you must use the correct pins for MOSI, SCK.

The confusing part is that the Chinese used SDA, SCL instead of the conventional MOSI, SCK names.

I suggest that you print the MKR1000 pinout and stick it on the back of your desk. It will be very useful.

Personally, I prefer the boards with Arduino headers e.g. Uno, Zero, Due.
Ready-made shields just plug in. Yes, you have to write the constructor arguments as a one-off. But you know the wiring will always be correct in the future.
I bet you will have forgotten your wiring scheme by next week (if not by dinnertime)

David.

I struggled for several days trying to find out how to run my Qianson 1.8" SPI TFT Display with my MKR1000. I was ready to decide it couldn't be done, when I was rescued by experienced forum-poster david_prentice. I had posted my problem under the title "No Success Running ST7735 on MKR1000", then the post went on for several wordy pages before the result was posted.

Now, I am offering this post as a separate answer to what was a tough problem for me, and could be for other less-sophisticated arduino-ists. So - a positive-sounding title and the solution right at the top should be prominently available to others querying this matter.

The attachment will contain all that needs to be known. In summary:

  • Used MKR1000 and display: Qianson 1.8" SPI TFT Display, got on Amazon

  • For sketch and ST7735 lib, go to: Adafruit ST7735 Lib

  • Under "examples, see the Adafruit example sketch "graphicstest"

Good info. I will probably document this thread in my personal files for reference for when I can take the time to dwell on this interface, and try the different variations.

I was confused about the role of header (files) vs sketch having influence on what pins presented which signals. I want to play with the software method some, but other things pressing at the moment.

Dave, Thanks again.

Dennis

MOderator: merged threads