FBTFT driver for ST7789V not working on SAMA5D42

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

FBTFT driver for ST7789V not working on SAMA5D42

Fri Jul 07, 2017 3:40 pm

Hi All,

I am trying to run a sample Qt widgets based app from a custom board with SAMA5D42 SoC on ST7789V LCD screen. My aim is to get Linux framebuffer working and observe the screen refresh performance of the app. I have got /dev/fb0 up using fbtft driver available in the 4.4.46 version of the kernel. I have modified the dts files to achieve the same.

However when I run the app I am not seeing anything on the screen even though dmesg log looks correct and the debug messages from the kernel indicate that something is being written to the framebuffer.

Below is the dmesg log:

Code: Select all

[    1.060000] fbtft_of_value: buswidth = 8
[    1.060000] fbtft_of_value: debug = 5
[    1.070000] fbtft_of_value: rotate = 270
[    1.070000] fbtft_of_value: fps = 50
[    1.070000] mmc0: MAN_BKOPS_EN bit is not set
[    1.080000] fb_st7789v spi32764.0: fbtft_gamma_parse_str() str=
[    1.080000] fb_st7789v spi32764.0: 70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25
[    1.080000] 70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25
[    1.100000] fb_st7789v spi32764.0: fbtft_request_one_gpio: 'reset-gpios' = GPIO104
[    1.100000] fb_st7789v spi32764.0: fbtft_request_one_gpio: 'dc-gpios' = GPIO151
[    1.110000] fb_st7789v spi32764.0: fbtft_verify_gpios()
[    1.360000] mmc0: new MMC card at address 0001
[    1.360000] mmcblk0: mmc0:0001 SEM32G 29.1 GiB
[    1.370000] mmcblk0boot0: mmc0:0001 SEM32G partition 1 4.00 MiB
[    1.370000] mmcblk0boot1: mmc0:0001 SEM32G partition 2 4.00 MiB
[    1.380000] fb_st7789v spi32764.0: fbtft_update_display(start_line=0, end_line=239)
[    1.400000]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    1.540000] fb_st7789v spi32764.0: Display update: 950 kB/s, fps=0
[    1.540000] graphics fb0: fb_st7789v frame buffer, 320x240, 150 KiB video memory, 4 KiB DMA buffer memory, fps=50, spi32764.0 at 10 MHz
Below is the dts snippets:
custom.dts :

Code: Select all

/ {
    ...
    ahb {
        ...
         apb {
             ...
             spi2: spi@fc01c000 { /* LCD */
                 cs-gpios = <&pioB 28 0>;
                 status = "okay";			
            };
        };
    };
};
sama5d4.dtsi :

Code: Select all

	
/{
    ...
    ahb {
        ...
        apb {
            ...
            spi2: spi@fc01c000 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "atmel,at91rm9200-spi";
                reg = <0xfc01c000 0x100>;
                interrupts = <39 IRQ_TYPE_LEVEL_HIGH 3>;
                dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | 
                                           AT91_XDMAC_DT_PER_IF(1) | 
                                           AT91_XDMAC_DT_PERID(14))>,
                            <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | 
                                           AT91_XDMAC_DT_PER_IF(1)  | 
                                           AT91_XDMAC_DT_PERID(15))>;
                dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_spi2>;
                clocks = <&spi2_clk>;
                clock-names = "spi_clk";
                status = "disabled";

                lcd_custom@0 {
                    compatible = "sitronix,st7789v";
                    reg = <0>;
                    pinctrl-names = "default";
                    pinctrl-0 = <&pinctrl_lcd_custom>;
                    spi-max-frequency = <10000000>;
                    rotate = <270>;
                    bgr;
                    fps = <50>;
                    buswidth = <8>;
                    reset-gpios = <&pioD 8 0>;
                    dc-gpios = <&pioE 23 0>;
                    debug = <5>;
                };												
            };
            ...
            pinctrl@fc06a000 {
                    #address-cells = <1>;
                    #size-cells = <1>;
                    compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", 
                                         "simple-bus";
                    ranges = <0xfc068000 0xfc068000 0x100
                    0xfc06a000 0xfc06a000 0x4000>;
                    atmel,mux-mask = <...>;
                    pioA: gpio@fc06a000 {...};
                    ...
                    pioE: gpio@fc06d000 {...};
                    ...
                    lcd_custom {
                        pinctrl_lcd_custom: lcd-0 {
                            atmel,pins = <AT91_PIOD  8 AT91_PERIPH_GPIO 
                                                      AT91_PINCTRL_OUTPUT	
                                                 AT91_PIOE 23 AT91_PERIPH_GPIO 
                                                 AT91_PINCTRL_OUTPUT 			
                                                >;
                    };															
                };
            };
        };
    };
};
I have checked SPI lines and LCD data/cmd lines in the probe and they all show some activity when I run the app.
However I am not able to notice any activity on the LCD reset gpio pin during the loading of the driver and also during running of the app.

I manually pulsed the reset gpio from user space and then tried running the app but still no luck.
Can someone please guide me in getting the framebuffer working?

Thanks and regards,
Shreesha
Last edited by svit19 on Sat Jul 08, 2017 5:30 pm, edited 2 times in total.
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Sat Jul 08, 2017 1:01 am

svit19 wrote:I am trying to run a sample Qt widgets based app from a custom board with SAMA5D42 processor on ST7789V LCD screen.
The SAMA5D42 is an SoC, not a processor.
The processor in that SoC is an ARM Cortex-A5.
svit19 wrote:I have modified the dts files to achieve the same.
...
Below is the dts snippets:
at91-sama5d4_xplained.dts :
...
sama5d4.dtsi :
...
If you have a custom board, then why are you showing us the .dts file for the Xplained board?
Where is the .dts file for your custom board?
You do not have a custom SoC, so do not modify the sama5d4.dtsi file, which is for the generic SAMA5D4 SoCs.
Make your configuration changes in the .dts file for your custom board.

BTW your DT snippets as posted are unreadable.
Use the 'code' tags (on the same menu bar that you found the bold button) to maintain formatting.
svit19 wrote:However when I run the app I am not seeing anything on the screen even though dmesg log looks correct and the debug messages from the kernel indicate that something is being written to the framebuffer.
...
Can someone please guide me in getting the framebuffer working?
Is that the extent of your testing, i.e. you're using a Qt application (of questionable quality) to test the hardware?
You've neglected to mention numerous salient configuration details that exist between a framebuffer and a Qt application.

Since you claim to have a /dev/fb0 device node, have you even tried to test with a basic/proven utility such as the fb-test-app? (Buildroot has a package for that utility, but the Yocto Atmel demo doesn't AFAIK.)

Regards
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Sat Jul 08, 2017 5:27 pm

blue_z wrote: If you have a custom board, then why are you showing us the .dts file for the Xplained board?
Where is the .dts file for your custom board?
I have renamed in the original post now to avoid confusion. Initial development had started with Xplained board and hence the name.
blue_z wrote: BTW your DT snippets as posted are unreadable.
Hope it is more readable now.
blue_z wrote: Is that the extent of your testing, i.e. you're using a Qt application (of questionable quality) to test the hardware?
It is just a Qt 4.8 hello world application with just one .ui file with a QLabel reading "hello world!". I run the code from shell I can see messages which goes something like this:

Code: Select all

# ./helloworld -qws
...fb_st7789v spi32764.0: ... start...=115, end...=239)
blue_z wrote: You've neglected to mention numerous salient configuration details that exist between a framebuffer and a Qt application.
I am using the FBTFT staging driver from linux kernel source tree as it is. Does the last line of dmesg log provide the details? I will try to post any further information if specified.
blue_z wrote: Since you claim to have a /dev/fb0 device node, have you even tried to test with a basic/proven utility such as the fb-test-app?
No I have not tried. I will do it once I go back to office and post the results.
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Mon Jul 10, 2017 3:08 pm

I ran a few fb test apps provided by Buildroot. Below are the outputs pasted as is:

fb-test

Code: Select all

# fb-test
fb-test 1.1.0 (rosetta)
fb res 320x240 virtual 320x240, line_len 640, bpp 16
# [   47.740000] fb_st7789v spi32764.0: fbtft_update_display(start_line=0, end_line=239)
fb-test-rect

Code: Select all

# fb-test-rect
rect 1.1.0 (rosetta)
[   69.620000] fb_st7789v spi32764.0: fbtft_update_display(start_line=0, end_line=159)
[   69.740000] fb_st7789v spi32764.0: fbtft_update_display(start_line=38, end_line=239)
[   69.890000] fb_st7789v spi32764.0: fbtft_update_display(start_line=25, end_line=239)
...
...

[  185.880000] fb_st7789v spi32764.0: fbtft_update_display(start_line=6, end_line=236)
^C
# [  186.040000] fb_st7789v spi32764.0: fbtft_update_display(start_line=96, end_line=102)
fbgrab out.png

Code: Select all

# fbgrab out.png
Resolution: 320x240 depth 16
Converting image from 16
Now writing PNG file (compression -1)
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Mon Jul 10, 2017 3:42 pm

I am unable to attach the output image of fbgrab. I am getting "Sorry, the board attachment quota has been reached." Hence I have put it in dropbox with below link:
https://www.dropbox.com/s/feq0d8d2170qf ... b.png?dl=0
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Mon Jul 10, 2017 9:15 pm

Your follow-up posts are ambiguous. You only state that you ran tests, and didn't state what was visible on the LCD.
A frame-grab is just the data that is supposed to be displayed; I don't automatically assume that is what is actually viewable.

Regards
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Tue Jul 11, 2017 5:14 am

Nothing is being displayed on the LCD when I run these tests.

The LCD panel as such is in working condition since I was able to display a Qt app using QScreenDriverPlugin before.
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Tue Jul 11, 2017 8:19 am

One more test

Code: Select all

# fbset -i

mode "320x240"
    geometry 320 240 320 240 16
    timings 0 0 0 0 0 0 0
    nonstd 1
    rgba 5/11,6/5,5/0,0/0
endmode

Frame buffer device information:
    Name        : fb_st7789v
    Address     : (nil)
    Size        : 153600
    Type        : PACKED PIXELS
    Visual      : TRUECOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 640
    Accelerator : No
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Wed Jul 12, 2017 2:05 am

svit19 wrote:The LCD panel as such is in working condition ...
Using what definition and criteria for "working"?
Does "as such" mean still connected to the SAMA5D4?
svit19 wrote:... since I was able to display a Qt app using QScreenDriverPlugin before.
Before what?
What about now, today?
Previously you (only) wrote that you were "trying to run a sample Qt widgets based app" and "when I run the app I am not seeing anything on the screen".
Your title declares "... driver ... not working".

What are you claiming now?
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Wed Jul 12, 2017 1:03 pm

"LCD panel as such is working" means there is no problem with the physical LCD panel and its physical connections. I could say that because I could display on the LCD using the QScreen based plugin.

Now I don't want to use the plugin and use the framebuffer instead to run the app.
But nothing is displayed now when I am trying to do that. This is what I am trying to say in the title "FBTFT not working". So I am looking for help in this forum to get some directions and getting the framebuffer to work and get my app displayed on the LCD.
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Thu Jul 13, 2017 10:50 pm

svit19 wrote:"LCD panel as such is working" means there is no problem with the physical LCD panel and its physical connections. I could say that because I could display on the LCD using the QScreen based plugin.
So you think this is not salient or relevant to mention in your original post, and you are only willing to mention this when pressed to explain (another) ambiguous comment?
svit19 wrote:This is what I am trying to say in the title "FBTFT not working".
"X does not work" implies nothing about whether "Y works", especially since there is no mention of Y whatsoever (until your most recent post).
Clearly you overestimate the information conveyed (and/or inferred) by what you actually write.
svit19 wrote:Nothing is being displayed on the LCD when I run these tests.
You need to only report what was visible on the LCD, rather than guess at what is happening at the HW level.
IOW do not conflate what the system does (or might be doing) with what is actually observable.

Based on what you've provided, there seems to be no provision for a backlight.
If there is no active backlighting, you probably would not be able to see whatever is being displayed.on the LCD.
So what have you done to configure and confirm that a backlight is functional?
svit19
Posts: 8
Joined: Fri Jul 07, 2017 2:58 pm

Re: FBTFT driver for ST7789V not working on SAMA5D42

Mon Jul 17, 2017 9:22 am

Yes, backlight is turned on.

Below is how it is done (but I am not sure if it is required).

The LCD is housed in a front panel board which is connected to the main board (which has the SAMA5D42) via a flex cable.
The front panel board has a Cortex M3 based controller which controls the LEDs and buttons on it and also the backlight pin of the LCD.
The Cortex M3 based controller does not control the SPI lines, Data/Command and reset pins of the LCD.
This control remains with the SAMA5D42.
SAMA5D42 communicates with the Cortex M3 based controller over UART through some predefined commands.
Turning backlight on and off is also done through one such command.
I am sending this command with help of a standalone program to turn backlight on before running the Qt app.

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 1 guest