FunGuy
Posts: 3
Joined: Sat Jan 06, 2018 10:11 am

Move ili9341 TFT display to SPI1

Sun Jan 07, 2018 11:51 pm

I was hoping somebody could help me. I am quite a new user to RPI and experimenting a lot. I have a sensor which communicates using SPI to the Pi 3 Model B+ and it works great. I also have TFT screen running an ili9341 driver display also using SPI. Here is my problem: The sensor can only operate on SPI mode 3 and consumes a lot of bandwidth. The TFT screen operates in SPI mode 0 and consume reasonable amount of bandwidth on the bus. I decided to use 2 SPI buses, namely /dev/spi0 and /dev/spi1. I have read on some blogs that the primary SPI (/dev/spi0) support all modes of SPI. I have confirmed this as both devices operate correctly on SPI0. I have also read that the aux SPI (/dev/spi1) does not support all modes of SPI. I have confirmed this that the sensor operating on SPI0 does not work on SPI1 unless I change the mode (but then I receive garbage data which was expected). So the sensor which consumes a lot of bandwidth is stuck on the primary SPI bus. I see there a lot of pre-made images for the TFT displays, but they all use SPI0 to drive the screen. I have tried to hack the code (with very little success) to move the TFT to aux SPI (/dev/spi1). Is there an easy way to do it?

Thanks in advance for any assistance.

HermannSW
Posts: 454
Joined: Fri Jul 22, 2016 9:09 pm

Re: Move ili9341 TFT display to SPI1

Wed Jan 10, 2018 2:31 pm

Yes, please follow the link in this posting:
viewtopic.php?t=193722#p1217930
Image
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

FunGuy
Posts: 3
Joined: Sat Jan 06, 2018 10:11 am

Re: Move ili9341 TFT display to SPI1

Thu Jan 25, 2018 11:51 am

Thank you! This really did the trick! You saved me a lot of effort

FunGuy
Posts: 3
Joined: Sat Jan 06, 2018 10:11 am

Re: Move ili9341 TFT display to SPI1

Sun Feb 25, 2018 11:27 am

I have another question. I can send the image giraffe.565 to the tft using your recommendation of

sudo tail --bytes 153600 /home/pi/giraffe.565 > / dev/fb1

It works beautifully! I am also learning Qt (tying to expand my horizons a bit), and I do the following:

QFile file("/home/pi/giraffe.565");
file.open(QIODevice::ReadOnly);
QByteArray qb = file.readAll();
qb.remove(0,54);
printf("qb size %d\n",qb.size());
QFile tft("/dev/fb1");
tft.open(QIODevice::WriteOnly);
tft.write((char*)qb.data());

This works, but the image is displayed with a slight offset (I can see mixture of blocks). It seems it is having trouble synching the new lines to the tft screen. So my question is what is the difference between? What am I doing wrong?

Thanks in advance!

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 9 guests