Page 6 of 6

Re: HY28A-LCDB, ili9320 (working)

Posted: Thu Dec 26, 2013 4:09 pm
by notro
What SPI speed are you using?
How many pixels do you include in each SPI transfer? If you send one pixel per transfer, it will be slow (the start byte is included in each transfer + the SPI transfer setup time).
In my kernel drivers, I send ~2048 pixels in each SPI transfer (using a 4k buffer).

Re: HY28A-LCDB, ili9320 (working)

Posted: Thu Dec 26, 2013 9:48 pm
by BrendonShaw
This is my BCM SPI setup and I have just set one pixel then written to complete & update the display. It works but just takes about 1 second to update the display

Code: Select all

int main(void)
{
unsigned int i, j;
   if (!bcm2835_init())
      return 1;

   // Set the RESET pin to be an output
   bcm2835_gpio_fsel(RESET, BCM2835_GPIO_FSEL_OUTP);
   bcm2835_gpio_write(RESET, HIGH);   //reset is low active
   bcm2835_gpio_write(RESET, LOW);   //reset is low active
delay(5);
  bcm2835_gpio_write(RESET, HIGH);   //reset is low active
delay(100);

   bcm2835_gpio_fsel(BACKLIGHT, BCM2835_GPIO_FSEL_OUTP);
   bcm2835_gpio_write(BACKLIGHT, HIGH);   //HIGH=on, LOW = off;
   
   bcm2835_spi_begin();
   bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST);      // The default
   bcm2835_spi_setDataMode(BCM2835_SPI_MODE3);                   
   bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_8); 

   bcm2835_spi_chipSelect(BCM2835_SPI_CS0);                      // The default
   bcm2835_spi_setChipSelectPolarity(BCM2835_SPI_CS0, LOW);      // the default

   //LCD_Initializtion();   
LCD_Init2();
   TP_DrawPoint(0,0, 0x00ff);

for(i=0; i<=(MAX_X * MAX_Y); i++)
{

   char tbuf[] = { SPI_START | SPI_WR | SPI_DATA, (0xff88 >> 8), (0xff88 & 
0xFF)}; // Data to send
   char rbuf[] = {0,0,0};
   bcm2835_spi_transfernb(tbuf, rbuf, sizeof(tbuf));}


Re: HY28A-LCDB, ili9320 (working)

Posted: Fri Dec 27, 2013 3:21 pm
by notro
You can try and update the entire display in one transfer.
Make a buffer that holds a start byte and the entire video memory, and send it in one go.
This will give you at least a 30% boost for a full display update.
If this is fast enough, you can let all your pixel functions write to this buffer, and then do a update when needed.
It is also possible to just do a partial update of the display, if a full update is not needed.

This is how a Linux framebuffer works: The application writes to a buffer and the driver scans this out to the display at regular intervals or in the case of FBTFT; when the memory is altered.

Re: HY28A-LCDB, ili9320 (working)

Posted: Fri Jan 03, 2014 10:04 am
by BrendonShaw
I still getting my head into the code to support a frame buffer on the RPi, I have installed the fbtft driver and see the response to the various SPI commands. I was just wondering if anyone has used the https://github.com/notro/fbtft_test on the hy28a display, I tried to use it but it did not like the driver /dev/spidev0.0 and then could not see how to confirm it for the hy28a display.

Re: HY28A-LCDB, ili9320 (working)

Posted: Fri Jan 03, 2014 4:38 pm
by notro
I was just wondering if anyone has used the https://github.com/notro/fbtft_test on the hy28a display
That is where I keep the scripts I use for testing my displays with FBTFT.
It started with test_fb.py which writes some patterns directly to the Linux framebuffer. In the case of FBTFT, it will be run like this:

Code: Select all

python test_fb.py --device=/dev/fb1
It does not contain scripts that talk directly with the displays through SPI.

The hy28a_test script matches a setup I have, and is used to test the fb_ili9320 kernel driver when I have made changes.

Talking about drivers can be a bit confusing without context. There are two main categories of drivers: kernel drivers and userspace drivers (ordinary applications).
A kernel driver can talk directly to the Linux SPI subsystem (spi_write()).
A userspace driver has to go through the spidev module (/dev/spidev0.0)
A third option is also available on the Pi: writing directly to the hardware registers from userspace, as the bcm2835 library does.

So when it comes to these SPI displays there are two ways to get something displayed:
* Use a Linux kernel framebuffer driver that sets up videomemory at /dev/fbX and takes care of keeping the display in sync with this video memory (framebuffer).
* Use an application (or library) that talks directly to the display through /dev/spidevX.X. Such a library can also be modelled like the Linux kernel framebuffer subsystem fbdev. But the usual way is to write each pixel directly to the display.

https://github.com/topogigio/HY28A-LCDB-Drivers for instance, writes one pixel at a time using the bcm2835 library, which talks directly to the hardware registers on the Pi. Completly bypassing the Linux SPI subsystem

Re: HY28A-LCDB, ili9320 (working)

Posted: Sat Jan 04, 2014 10:09 am
by BrendonShaw
Notro, I cannot thank you enough for the reply and the information it's big help. May I should add want I am trying to do, we have a demo with a local school with the RPi and the idea is the children clap and the screen will change a different colour, so it's nothing complex and felt driving the display directly via SPI would be the easiest & quickest way.

Using your demo code and a few tweets to my code, I have the display up and running. My only problem is the time to update the display, it's still slightly on the slow side, the last 20% of the display can be seen to be updated and I really want it to be instanstances response. The display will change colour on the clap immediately and no lag on the updates.

Therefore, not sure if this is just a general issue with the RPi running the display update via SPI, I should work out the maths but I would have thought it would be possible to get immediate display update using the direct SPI interface. There is a couple of posts on the max SPI bus speed for the RPI, running at a max of 1Mhz so this could be quick enough. I did read there are some built in delay into the BCM driver which could cause addition delays, but I have used another method and seeing the same results.

The only other item was the SD card performance, I am not using a very quick SD card at the moment and wondering if using a faster access SD card would improve the performance.

Once again many thanks for all the support and amazing work on the display, I am very impressed with all the work you have put into this and support you provide.,

Re: HY28A-LCDB, ili9320 (working)

Posted: Sun Jan 26, 2014 7:54 am
by vahidnoori
i have inanbo t2-9320-v11 datasheet in :www.inanbo.com/downfile/tft/28/INANBO-T ... 20-V11.pdf
and i am going to config it by raspberry .but i have some problem. this display is parallel an i decide to use spi to parallel converter(circuit is attached) and the controller is ili9320 .
can u help me about a driver of this display ???