Shop OBEX P1 Docs P2 Docs Learn Events
Read bmp image from SD to Display ili9341. Done in spin but very slow — Parallax Forums

Read bmp image from SD to Display ili9341. Done in spin but very slow

sebastian1989sebastian1989 Posts: 14
edited 2014-12-09 22:51 in Propeller 1
Hi, I wrote a little code to read a image in bmp format and show in a display with ili9341, the code works but take about 12 seconds to show a image in 320x240, when I saw the clk pin with an oscilloscope, I saw a huge delay between the data for each pixel, I think it is because spin run very slow so maybe I need to use C compiler.
I know C but I dont know how use the library for the ili9341 in C, any help??.

I upload a video: https://mega.co.nz/#!poZwiDYI!JlAX6CAXtFvCBZQNPHau3NjwQV-MKZEQRHWEMBDC-0w

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2014-03-15 17:40
    Read through this *very* long thread http://forums.parallax.com/showthread.php/137266-Propeller-GUI-touchscreen-and-full-color-display

    post #20 shows a video - show a full image in about 1 second. If you read through the thread we started with the same problem - the displays are all too slow. Moving the code from spin to pasm made it faster. But the most improvement was when we added external memory. Then it is possible to play movies (you can see a bit of a movie playing at the last few seconds of a video - that is refreshing that smaller part of the screen about 10x a second).

    C is certainly an option. One thing you can do with C that you can't do with Spin is to add external memory so you can write huge programs.
  • sebastian1989sebastian1989 Posts: 14
    edited 2014-03-16 07:18
    thanks for the link, now I am reading. I make a few test, read a image bmp 100x100 pixels from SD, transform each pixel to RGB565 and make few operations (no data transfer to diplay) takes 15357536 clocks (cnt counts), the other test is transfer 10000 pixels data (100x100 pixels) to display, only transfer 0, no math, no read from SD, nothing more, takes 99597168 clocks so I dont know if the library for ili9341 is slow or the call from spin to this library is slow.
  • CelticLordCelticLord Posts: 50
    edited 2014-09-04 05:51
    Your code dosn't seem to work for mine http://www.dealsmachine.com/best_185...HADRoCZ2Xw_wcB and I know it is ILI9341 GPU..
    Banging my head against the wall with it as i've also written code to just get it to light up a pixel or anything.
    Followed the ILI9341 data sheet page 33.
    Turn CSx High initialize state.
    1. Turn CSx low telling it to get ready for code.
    2. Turn DC Pin (Low = command High = Data)
    3. Put Data onto Mosi pin starting with MSb7
    4. Turn SCL Pin Low then High tto move bit to ILI9341
    4b. Repeat 3 and 4 for each bit of the Byte
    5. Turn CSx High to signify end of Transfer.
    Repeat 1 - 5

    Nothing......................................................
    PLEASE HELP ANYONE CODE ect
  • CelticLordCelticLord Posts: 50
    edited 2014-09-06 04:50
    My problem was the hardwires used, I am now using jumper wires from parallax and the display is up and running.
    Sebastian, or anyone for that matter, how do I use the command DrawStringSmall ().
    I need to draw the string "Date Time Core Amb Core Amb Wgt# Freq Lght"
  • CelticLordCelticLord Posts: 50
    edited 2014-09-09 03:02
    This forum is unhelpful to say the most! I thought that was what it was for.
    Anyway forget it I figured it out without your help Thanks!
  • sebastian1989sebastian1989 Posts: 14
    edited 2014-12-09 22:51
    Hi, I'm sorry CelticLord, I don't see your question.
    I had some time to learn PASM, I made a few change, now convert from 24bits BMP to RGB565 and send each pixel from buffer to display is done in PASM, the spi is done with counters, with those change I can see the same picture of the first post in 570 [ms] at 100MHz.

    Video: https://mega.co.nz/#!o4BkjD7K!2Gvb7sxEnR5erCWppLvsCUln3Ye4jIYZQqEEyXtKP4U

    This part convert from 24bits BMP to RGB565.

    rdbyte foreground, punt
    add punt, #1

    rdbyte g, punt
    add punt, #1

    rdbyte r, punt
    add punt, #1

    shr foreground,#3
    shr g,#2
    shr r,#3

    shl g,#5
    shl r,#11

    or foreground, g
    or foreground, r

    Probably can be optimized. Did anyone see how?, maybe reading a long instead of 3 byte.
    If somebody can make it faster without a external RAM I would be very grateful.

    I compare the old and the new library in this video: https://mega.co.nz/#!RtwliCrS!ltutmBmbnh86FU5TgklPrh2pzQDhTpfgeB7p9aY5jxk

    Conclusion, the new library is 3 times faster and load a BMP file is 21 times faster.

    This post has nothing to do with Propeller GCC, Can anyone change of location?
Sign In or Register to comment.