Port manipulation - LCD 8bit parallel

Working libraries, libraries being ported and related hardware
User avatar
RogerClark
Posts: 5577
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby RogerClark » Wed Jun 22, 2016 9:41 pm

Hi Ray,

This confusion is my fault.

I am playing fast and loose with the Arduino Library paradigm with this.

I bent the rules a bit with the Libraries system, in the past, by making an empty library, just to put our examples in; so they can be acccessed via the menu system.

But in this case, the header does actually include some files, and the IDE does have to compile a whole loadmof files, but none of them, AFIK, are classes.

I may even remove the dummy HAL class I made, as it may not be needed at all, depending on whether any initialisation code needed to be run - and at the moment, it looks like running the default HAL_init() function screws things up, as it either messes up the clock PLLs or possibly does something strange to systick, ( I have not had time to investigate precislely what its affecting, so I am not calling HAL_init() from the library at the moment)

User avatar
iwalpola
Posts: 24
Joined: Tue Jun 21, 2016 1:08 pm
Location: Silchar, India
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby iwalpola » Sat Jul 02, 2016 3:12 pm

Working library

With your help of martinayotte, werefcat and diger67's posts in http://www.stm32duino.com/viewtopic.php?f=9&t=474 I managed to port the SPI version of ILI9341 library to work with 8 bit parallel.

http://stm32duino.com/viewtopic.php?f=44&t=637&p=15438#p15438

github:
https://github.com/iwalpola/Adafruit_ILI9341_8bit_STM/
demo:
https://www.youtube.com/watch?v=MAkMaZyZMWM

User avatar
RogerClark
Posts: 5577
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby RogerClark » Sat Jul 02, 2016 9:33 pm

Do you have the milliseconds timing debug output from the adafruit graphics demo, in your youtube video, so we can compare the speed with SPI?

User avatar
martinayotte
Posts: 1170
Joined: Mon Apr 27, 2015 1:45 pm

Re: Port manipulation - LCD 8bit parallel

Postby martinayotte » Sun Jul 03, 2016 1:55 am

Great work, @iwalpola !

In my case with Netduino2Plus pinouts as uint8_t DPINS[] = {PC7, PC6, PA3, PA2, PB12, PB8, PB9, PA1, PA0, PA6};, I don't think I could get much speed optimisation doing direct register access ...

User avatar
iwalpola
Posts: 24
Joined: Tue Jun 21, 2016 1:08 pm
Location: Silchar, India
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby iwalpola » Sun Jul 03, 2016 3:25 am

RogerClark wrote:Do you have the milliseconds timing debug output from the adafruit graphics demo, in your youtube video, so we can compare the speed with SPI?


Code: Select all

Benchmark                Time (microseconds)
Screen fill              1777678
Text                     52910
Lines                    460552
Horiz/Vert Lines         125679
Rectangles (outline)     80273
Rectangles (filled)      3690938
Circles (filled)         511284
Circles (outline)        350519
Triangles (outline)      109878
Triangles (filled)       892313
Rounded rects (outline)  161878
Rounded rects (filled)   4014366
Done!


I'm also curious to know the performance as compared to SPI.

One weird problem I'm having is the color565 function, which breaks the program. It works fine when I pass the defined values like ILI9341_BLACK, but if I use color565 to generate the color, it crashes.

User avatar
mrburnette
Posts: 1779
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby mrburnette » Sun Jul 03, 2016 2:39 pm

iwalpola wrote:I'm also curious to know the performance as compared to SPI.



Bunches of trials in and around this thread area:
http://forum.arduino.cc/index.php?topic=181679.msg1896208#msg1896208

Ray

User avatar
iwalpola
Posts: 24
Joined: Tue Jun 21, 2016 1:08 pm
Location: Silchar, India
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby iwalpola » Sun Jul 03, 2016 5:16 pm

New benchmark after replacing regs->ODR with regs->BSRR and regs->BRR

Code: Select all

Benchmark                Time (microseconds)
Screen fill              1478774
Text                     43997
Lines                    376454
Horiz/Vert Lines         101883
Rectangles (outline)     65100
Rectangles (filled)      3070377
Circles (filled)         419900
Circles (outline)        285285
Triangles (outline)      90139
Triangles (filled)       713698
Rounded rects (outline)  131807
Rounded rects (filled)   3324904
Done!

User avatar
ahull
Posts: 1467
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby ahull » Sun Jul 03, 2016 7:54 pm

iwalpola wrote:New benchmark after replacing regs->ODR with regs->BSRR and regs->BRR

Code: Select all

Benchmark                Time (microseconds)
Screen fill              1478774
Text                     43997
Lines                    376454
Horiz/Vert Lines         101883
Rectangles (outline)     65100
Rectangles (filled)      3070377
Circles (filled)         419900
Circles (outline)        285285
Triangles (outline)      90139
Triangles (filled)       713698
Rounded rects (outline)  131807
Rounded rects (filled)   3324904
Done!


Not bad, but I think you might be able to do better... :D
Using the library modified by Kurt:

http://forum.arduino.cc/index.php?topic ... msg1936155

Since you are running parallel, in theory at least, it should be faster than serial (SPI). Not sure if it will go 8x faster, but at least theoretically it should be faster.
- Andy Hull -

User avatar
martinayotte
Posts: 1170
Joined: Mon Apr 27, 2015 1:45 pm

Re: Port manipulation - LCD 8bit parallel

Postby martinayotte » Sun Jul 03, 2016 8:10 pm

Andy, even if LCD is parallel, if code has to assign GPIOs one by one, especially in the case of a shield with D2-D9, where those GPIOs are not consecutive (especially on Netduino2Plus), I/O performance is hard to achieve.

User avatar
iwalpola
Posts: 24
Joined: Tue Jun 21, 2016 1:08 pm
Location: Silchar, India
Contact:

Re: Port manipulation - LCD 8bit parallel

Postby iwalpola » Sun Jul 03, 2016 8:36 pm

@Andy, Kurt's library seems quite fast in some operations, and I'm curious to see why. I'll git diff and report back.
@Martin Perhaps it comes down to the GFX library functions?
Very curious indeed


Return to “Libraries & Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest