7 years, 11 months ago.

Newbie with Mbed, and having issues working with ILI9341 LCD screen from adafruit

Hello,

I'm a complete newbie to mbed so please excuse me if I am missing something big. I am trying to connect the ILI9341 LCD screen and use the libraries that this person has ported, here: https://developer.mbed.org/users/infotech1/code/ili9341_test/ I imported the project, and when I imported it, it kept saying "Error: Identifier "SPI_MISO" is undefined in "Adafruit_ILI9341/Adafruit_ILI9341.cpp", Line: 27, Col: 19" and the error also occured for the pins: MISO, MOSI, and SCK. These are important because I am connecting the pins over SPI, which uses these pins. Is the error within PinNames.h (which I can't seem to find, for whatever reason...) or is there some other issue?

Any help is greatly appreciated! Thanks.

1 Answer

7 years, 11 months ago.

That library seems to have some pins hardcoded for Nucleo boards. Quick search showed this one: https://developer.mbed.org/users/dreschpe/code/TFT_Test_ILI9341/file/414a960bd52e/main.cpp. That guy generally has good libs, so I would first try that one (change the pins you see there to match the pins you use).

Thanks for the response! I read his description, and it requires utilizing the IM pins. Do you know where I should connect the IM pins that are on the LCD screen to the MBED? I have an LPC1768, the pinout is here: https://developer.mbed.org/media/img/boardlogos/lpc1768/400xNxpinout.png.pagespeed.ic.SXf15haHY6.jpg , any advice would be great, thanks!!

posted by Lyova W 23 Apr 2016

You shouldn't. Those pins determine the mode that the LCD screen works at. You want to use SPI mode, and then apparently you need to use those settings for those pins. So the '1's need to be connected to supply, the '0's to ground. If you bought the ILI board advertised as an SPI controller you probably can ignore it since it is already correct. Otherwise there are most likely somewhere a bunch of resistors which set these values, but that depends on your board.

posted by Erik - 23 Apr 2016

Hello again,

Apologies for all of the dumb questions. I can't believe I forgot to attach the LCD display I'm using, but here's a link: https://www.adafruit.com/products/1770 . Just to be clear, I don't need to set anything programmatically (when it comes ot the IM display), and I should be able to simply run off of the 6 pins that are in the code (MOSI, MISO, SCK, DC, RST, and CS)? Looking at the adafruit link for the LCD display I see that it says it should be fine with a few pins, but there's no explicit mention that I don't need IM (me being a noob again, sorry), so I should be fine without those pins being connected to anything, right? Thanks again for the help! I hope I can get this to work.

posted by Lyova W 24 Apr 2016

Adafruit managed to hide it quite well, but how to handle those pins is described here: https://learn.adafruit.com/adafruit-2-dot-8-color-tft-touchscreen-breakout-v2/spi-wiring (You don't need to do anything in software for it).

posted by Erik - 24 Apr 2016

Hello again, I got a friend to help me with the soldering but he said because my professor probably wants to reuse the board I should just wire it. It's been wired like so: http://imgur.com/a/xeJMM

am I doing this correctly? Or should I just solder it? I have tried to put the program onto the libraries but it doesn't seem to work :(. I'm sorry again for these questions.

posted by Lyova W 24 Apr 2016

It seems correct. Removing soldering is quite easy, but this should work too. I would check with a multimeter if you get the correct voltage on those pins and other pins. Maybe a logic analyzer to check the SPI traffic.

posted by Erik - 24 Apr 2016

I unfortunately don't have access to those, is there some way I can check programmatically (over serial or something?) I have basically given up hope on using these graphics libraries, so the advice from my professor was to basically rewrite what I need from the libraries from this API: https://developer.mbed.org/handbook/SPI , my apologies again for asking all of these questions. However, I am not sure how to write any graphics related stuff using this. Do you have any tips/advice? I can get the screen working/on however: https://imgur.com/vSPAxXQ do you have any tips for a student in dire need? :( Thank you for all of the patience and explanations, however.

EDIT: Getting this now from the serial port? http://imgur.com/dMUx5xT Not sure what it means. This is for the library that you suggested I use.

posted by Lyova W 24 Apr 2016

Your LCD is getting power apparantly, but not much else I guess. Although only one signal needs to be wrong of course.

First of all, I cannot imagine you don't have a multimeter there. Logic analyzers might not be available (won't help you for now, but if you need to do this more often, buy one. You can get good ones for 10 euro from ebay).

According to the Adafruit page you do not need to have the reset connected, so disconnect that one (if you have it to the wrong value it might be permanently in reset). Then the problem you have with these things is that they are basically one-way communication. Still I believe they have a WHO_AM_I register (maybe the libraries use that too, if not, look for it in the datasheet). Then using the datasheet you can see what you need to do over SPI to read this register. This allows you to check if communication is happening properly.

But first I would try with a multimeter to check the voltages are correct. Besides that I can't help you much remotely, especially since I have never used these LCDs.

posted by Erik - 24 Apr 2016