Adafruit 2.8" TFT With Sparkfun Redboard

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
D4rkKnight
 
Posts: 2
Joined: Fri Apr 08, 2022 3:40 am

Adafruit 2.8" TFT With Sparkfun Redboard

Post by D4rkKnight »

Referencing this issue: viewtopic.php?f=22&p=859880 & this thread: https://forum.sparkfun.com/viewtopic.php?t=53381

I was able to get the Adafruit LCD graphics test to run, but it's extremely slow. Approx 10 times slower than running on an UNO (run times below). I believe the issue may be related to the different build environment that was being used at the time the second thread was made (July 2020), vs what is available now. I am unable to resolve the issue. Using an older apollo3 board definition that would have been available around July 2020, results in Adafruit_BusIO error. Using older (circa July 2020) Adafruit BusIO and ILI9341 libraries does not resolve the issue.

Compile error: C:\Users\Tony\Documents\Arduino\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp: In constructor 'Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t, int8_t, int8_t, int8_t, uint32_t, BitOrder, uint8_t)':
C:\Users\Tony\Documents\Arduino\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:51:48: error: 'digitalPinToPort' was not declared in this scope
csPort = (BusIO_PortReg *)portOutputRegister(digitalPinToPort(cspin));

Several permutations of the above error happen with board definitions pre v2.0. Does anyone have any suggestions on how to resolve this, or at least achieve usable performance with this LCD and the redboard/apollo3 ?


Sparkfun Artemis

02:29:30.348 -> Image Format: 0xC0
02:29:30.348 -> Self Diagnostic: 0xE0
02:29:30.348 -> Benchmark Time (microseconds)
02:29:30.348 -> Screen fill 23129328
02:29:54.112 -> Text 1193651
02:30:02.957 -> Lines 11468135
02:31:07.764 -> Horiz/Vert Lines 1893860
02:31:14.809 -> Rectangles (outline) 1207512
02:31:21.172 -> Rectangles (filled) 48005297
02:32:15.827 -> Circles (filled) 5538829
02:32:26.027 -> Circles (outline) 5013224
02:32:31.549 -> Triangles (outline) 2602378
02:32:39.340 -> Triangles (filled) 15679052
02:33:03.018 -> Rounded rects (outline) 2348387
02:33:10.528 -> Rounded rects (filled) 47762824
02:34:03.687 -> Done!

Arduino Uno

02:35:46.628 -> Image Format: 0x0
02:35:46.628 -> Self Diagnostic: 0x0
02:35:46.628 -> Benchmark Time (microseconds)
02:35:46.675 -> Screen fill 1496888
02:35:48.638 -> Text 175020
02:35:52.137 -> Lines 1435584
02:35:59.494 -> Horiz/Vert Lines 127044
02:36:00.426 -> Rectangles (outline) 83792
02:36:01.309 -> Rectangles (filled) 3107152
02:36:05.332 -> Circles (filled) 498780
02:36:06.122 -> Circles (outline) 613904
02:36:07.242 -> Triangles (outline) 316496
02:36:08.363 -> Triangles (filled) 1358164
02:36:10.824 -> Rounded rects (outline) 242988
02:36:11.894 -> Rounded rects (filled) 3134828
02:36:15.823 -> Done!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit 2.8" TFT With Sparkfun Redboard

Post by adafruit_support_mike »

Without diving too deep into the code, the name 'digitalPinToPort' looks like something from code for the ATmega family of microcontrollers (possibly also the SAM family, but less likely). As the name suggests, the function/macro maps digital GPIO pin numbers to the PORT registers in the microcontroller that control the given pin.

The fact that you're hitting such code probably means you're falling through a set of device-specific #ifdefs, failing to find one for the device you're using, and landing in the ATmega section by default.

From the Sparkfun link you posted, it looks like they developed a separate version of the library. Based on that, I'd suggest making sure you have the correct build target selected and are in fact using the version of the library in that board support package. Assuming you are, look through the code for #ifdefs that look like they select specific microcontrollers, and make sure there's a section that matches the ID of the board you're using.

User avatar
D4rkKnight
 
Posts: 2
Joined: Fri Apr 08, 2022 3:40 am

Re: Adafruit 2.8" TFT With Sparkfun Redboard

Post by D4rkKnight »

Thanks for the help. Just to follow up I was able to get it running at the expected speed by using a very particular combination of old library versions. I documented this in the Sparkfun thread. Seems like the bottleneck is really in the SPI transfers. Each full screen update is about 37 transfers, and it's not clear to me yet how I can update very specific parts of the screen. It's easy enough to update areas coming from the top/left for example. The Adafruit library does not however provide examples for a GFXCanvas16 buffer draw function that will update just the bottom right 64x64 pixels, for instance. Rather, that is to say you can update those pixels in the buffer, but transferring only those changes and not refreshing the entire screen isn't documented. I understand that this is the key to solving the performance issue, but I do not yet know how to implement this in practice.

Thank you for your suggestions though.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit 2.8" TFT With Sparkfun Redboard

Post by adafruit_support_mike »

Partial screen updates only work for displays that have their own RAM to hold the raster, and every display has its own way of doing partial updates. You'll have to dig through the datasheet for the display driver to see if it has a RAM buffer, and if so, what commands it uses for partial writes.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”