Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Pi multiple ILI9341 circuitPython_RGB_Display
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Pi multiple ILI9341 circuitPython_RGB_Display

by nanren888 on Sat Jul 25, 2020 10:22 pm

No idea where to post this to get help. Welcome any pointers, either to where to post or solutions.
Sorry, totally new to these components.

adafruit_rgb_display.ili9341 - does not allow multiple instances?

Raspberry PI 3B
Trying to run five ILI9341 displays.
Code based on
https://learn.adafruit.com/adafruit-2-8 ... -and-setup
and subsequent
https://learn.adafruit.com/adafruit-2-8 ... thon-usage
Altered to include five displays

rgb_display_pillow_image3.py - uploaded


import digitalio
import board
from PIL import Image, ImageDraw
import adafruit_rgb_display.ili9341 as ili9341
....
cs0_pin = digitalio.DigitalInOut(board.CE0)
cs1_pin = digitalio.DigitalInOut(board.CE1)
cs2_pin = digitalio.DigitalInOut(board.D12)
cs3_pin = digitalio.DigitalInOut(board.D16)
cs4_pin = digitalio.DigitalInOut(board.D20)
dc_pin = digitalio.DigitalInOut(board.D25)
reset_pin = digitalio.DigitalInOut(board.D24)

disp0 = ili9341.ILI9341(
spi,
rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
cs=cs0_pin,
dc=dc_pin,
rst=reset_pin,
baudrate=BAUDRATE,
)

disp1 = ili9341.ILI9341(
spi,
rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
cs=cs0_pin,
dc=dc_pin,
rst=reset_pin,
baudrate=BAUDRATE,
)
....
dispList = [disp0,disp1,disp2,disp3,disp4]
...
for dsp in dispList:
dsp.image(image)
...
In the uploaded version, I instantiate in this order disp0,disp2,disp3,disp4,disp1, hence disp0 & disp1 function. First & last instantiated working rule is true for all combinations that I have tried, without changes in wiring.

In each case the first and the last display work, determined by the order in which I instantiate them as ili9341.ILI9341 objects
I have changed the order of calls to disp.image(image), but always the first and last in the order instantiated work.
.
ili9341.ILI9341 seems simple enough, but not familiar with it nor with digitalio.
Can someone point out the problem? I presume it is something obvious to those experienced in these things.
For additional points another way to go about it?
.
Many thanks in advance for any pointers.
Attachments
rgb_display_pillow_image3.py
(3.28 KiB) Downloaded 1 time

nanren888
 
Posts: 15
Joined: Mon Apr 20, 2015 2:38 pm

Re: Pi multiple ILI9341 circuitPython_RGB_Display

by adafruit_support_mike on Wed Jul 29, 2020 12:43 am

You may need to use separate reset pins for each display. The .begin() function for most displays does a reset to put the display controller into a known state before trying to do any more configuration. If you hit the reset again (for another display), it undoes the config of the display you just set up.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Pi multiple ILI9341 circuitPython_RGB_Display

by nanren888 on Wed Jul 29, 2020 2:32 am

adafruit_support_mike wrote:You may need to use separate reset pins for each display. The .begin() function for most displays does a reset to put the display controller into a known state before trying to do any more configuration. If you hit the reset again (for another display), it undoes the config of the display you just set up.

.
Curious that this would not affect the first one.
You are however completely right.
At least as far as I have tested. Shifted reset pins to the cs pins for disp3 & disp4, as in retaskked those pins to allow three displays with separate pins for cs & reset.
Three displays work.
Seems to indicate that this is the answer.
.
Will look into the driver code for explanations.
.
Many thanks.

nanren888
 
Posts: 15
Joined: Mon Apr 20, 2015 2:38 pm

Re: Pi multiple ILI9341 circuitPython_RGB_Display

by adafruit_support_mike on Wed Jul 29, 2020 4:15 am

It's probably a timing thing. Reset collisions can produce all kinds of wierd behavior.

Glad to hear things are working in general though. Happy hacking!

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Pi multiple ILI9341 circuitPython_RGB_Display

by nanren888 on Fri Jul 31, 2020 4:15 am

As an addendum for anyone that finds this thread useful in the future:
ili9341.ILI9341 has an option to not pass the rst reset pin parameter.
In my setup, I combined all reset pins.
Provided rst to only the first instantiated ili9341, which reset them all.
Then instantiated the others without providing the rst parameter, so reset was not repeated.
Result five ili9341 displays, sharing rst, c/d and SPI. Only separate CS.
.
Likely obvious to some. If you too had this issue, hope this helped.

nanren888
 
Posts: 15
Joined: Mon Apr 20, 2015 2:38 pm

Re: Pi multiple ILI9341 circuitPython_RGB_Display

by adafruit_support_mike on Fri Jul 31, 2020 4:46 am

That's not an obvious one. The only reason I suspected it was that I've had to debug similar issues before.

Glad to hear it's working for you. Happy hacking!

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.