miniDisplay Cape - Looking for sample code

I just got a miniDisplay Cape from CircuitCo[1]. It’s a slick looking 128x128 color display, but I can find drivers for it.

Does anyone have sample code for the miniDisplay Cape?

–Mark

[1] http://elinux.org/CircuitCo:MiniDisplay_Cape

Mark,

hmm thought we had the spidev example code on the wiki, but it appears that we do not. we’ll get that posted today. in the mean time, you can look at Matt Porters presentation on using SPI display devices as a linux kernel framebuffer:

http://elinux.org/images/1/19/Passing_Time_With_SPI_Framebuffer_Driver.pdf

the video is available here:

http://free-electrons.com/pub/video/2012/elc/elc-2012-porter-spi-framebuffer-driver-450p.webm

Dave

I just got a miniDisplay Cape from CircuitCo[1]. It's a slick looking
128x128 color display, but I can find drivers for it.

Does anyone have sample code for the miniDisplay Cape?

I thought the display is the same st7735 as used in Matt Porter's
post[2], but it turns out to be a Crystalfontz CFAF128128B[3]. It
turns out it uses the same controller[4].

You should be able to use the already built driver at
/lib/modules/(uname -r)/kernel/drivers/video/st7735fb.ko

It doesn't seem the source is upstream, but you can find it in our
patched directory tree[5], though that tree isn't always kept
up-to-date with the actual kernel tree[6]. It'll take a bit of reading
to figure out how best to load it, ie. config-pin+modprobe with some
parameters, a device tree overlay or some patches to the kernel to add
the additional display parameters.

Hopefully the developer will respond.

[1] http://elinux.org/CircuitCo:MiniDisplay_Cape

[2] http://engineersofthecorn.blogspot.com/2012/06/beaglebone-and-adafruit-18-spi-lcd.html
[3] https://www.youtube.com/watch?v=29wFQE9xDe4
[4] https://www.crystalfontz.com/product/CFAF128128B0145T
[5] https://github.com/beagleboard/linux/blob/3.8/drivers/video/st7735fb.c
[6] GitHub - beagleboard/kernel: Kernel for the beagleboard.org boards

"Hopefully the developer will respond. "

already did…

David:
Thanks for updating [1] so quickly.

Do you have any out-if-the-box demos that show how to use the miniDisplay Cape?

–Mark

[1] http://elinux.org/CircuitCo:MiniDisplay_Cape

Mark,

the stock BB-SPIDEV0-00A0 device tree entry will enable the SPIDEV device driver. once that is done, you can talk directly to the lcd from userspace. we have a small C demo program that allows you to read an image file and display it on the lcd. this should be easy enough to do from any of the other scripting languages as well. i’ll get that pushed to the wiki page later today.

there are a number of existing examples of people using similar lcd panels with arduino and other dev boards:

http://engineersofthecorn.blogspot.com/2012/06/beaglebone-and-adafruit-18-spi-lcd.html
http://blog.inbedded.net/blog/2013/06/02/beaglebone-black-and-lcd-equals-fun/
http://guy.carpenter.id.au/gaugette/2014/01/28/controlling-an-adafruit-spi-oled-with-a-beaglebone-black/

Dave

David:
I’m looking forward to seeing your example. A simple working example goes a long to way to understanding the device.

–Mark

Mark,

sample code and basic info has been updated:

http://elinux.org/CircuitCo:MiniDisplay_Cape#Software_Support_.26_Compatibility

Dave

It works! Thanks. Though the background on Boris is greenish.

There is a typo on the wiki. The tar command produces a directory called Minidisplay-example with a capital M.

I also had to run echo -10 > /sys/devices/bone_capemgr./slots before echo BB-SPIDEV0 > /sys/devices/bone_capemgr./slots to disable a pwm that was in conflict.

Thanks again…

–Mark

Mark,

It works! Thanks. Though the background on Boris is greenish.

that is odd! we’ve not had any reports of that issue during our testing. it is possible that the SPI timing could be off giving you a slightly shifted color spectrum, or possible the display is damaged. please email support@boardzoo.com and we’ll get another minidisplay cape out to you to test…

There is a typo on the wiki. The tar command produces a directory called Minidisplay-example with a capital M.

sorry about that, the elinux.org wiki automatically makes the first letter of file uploads a capital. the original file was not capital…

I also had to run echo -10 > /sys/devices/bone_capemgr./slots before echo BB-SPIDEV0 > /sys/devices/bone_capemgr./slots to disable a pwm that was in conflict.

had you previously loaded another device tree entry with PWM?

Thanks again…

i did not get a chance yesterday to document it, but the header file for the boris image was generated using GIMP’s export feature. it would be easy enough to add a parser to decode bmp or png files…

Dave

Dave:
I found the color problem. There were some incorrect indices on pixel[]. I’ve alse changed the code a bit so Boris will render much faster. Rather than sending one RGB pixel at a time I’m seen 768/3. I got the idea from fillScreenBards(). Here’s my displayimage().

void displayimage(){
char pixel[5], data = header_data;
int i = width * height;
Transfer tbuffer[128
128*3+1];
void *buff_ptr = tbuffer;

LCDSendCommand(1, 0x2C);
int j = 0;
while(i-- > 0) {
HEADER_PIXEL(data,pixel);

tbuffer[j+0].data=(pixel[2] & 0xff);
tbuffer[j+0].type=1;

tbuffer[j+1].data=(pixel[1] & 0xff);
tbuffer[j+1].type=1;

tbuffer[j+2].data=(pixel[0] & 0xff);
tbuffer[j+2].type=1;
j +=3;
}
// SPIWriteChunk(buff_ptr, 1281283);
for(i=0;i<128;i++){
SPIWriteChunk(buff_ptr, 768);
buff_ptr += 768;
}
}

Why do you only write 768 bytes at a time to the SPI?

With only small changes the code here[1] drives the miniDisplay and sends a bmp file to it.

–Mark

[1] https://github.com/jeidon/cfa_bmp_loader.git

Video of the green issue on my BBB: https://www.youtube.com/watch?v=ZukemWkvmJM

Sounds like Mark fixed it though!

Video with Mark’s “void displayimage()” fix

https://www.youtube.com/watch?v=FNYv-0yKBsQ

Mark,

ahh right that was already fixed, i am not sure how i uploaded an older version where it wasn’t fixed…

i’ll update the tarball and add links to your code as well…

Dave

Mark,

Hmmm… I tried sending 1024 and the display didn’t show anything. Maybe you can only send one line at a time.

–Mark

Mark,

i wont have time to do any testing until late next week, but iirc, we had been able to write an entire frame at once…

Dave