Read bmp image from SD to Display ili9341. Done in spin but very slow
sebastian1989
Posts: 14
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
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
rar
23K
Comments
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.
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
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"
Anyway forget it I figured it out without your help Thanks!
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?