Jump to content

How to configure script.bin/custom.fex for SPI LCD?


rezaee
 Share

Recommended Posts

I have nanopi-m1 and use Armbian-5.30(Ubuntu server 16.04/ Linux nanopim1 3.4.113-sun8i). I did make these to .conf files :

Add to file /etc/modules-load.d/fbtft.conf

spi-bcm2835

fbtft_device

and
 

Add to file /etc/modprobe.d/fbtft.conf

options fbtft_device custom name=fb_ili9341 gpios=reset:1,dc:201,led:6 speed=16000000 rotate=90 bgr=1

Then I tried to make another file by this content:
 

Add to file: /usr/share/X11/xorg.conf.d/99-fbdev.conf

Section "Device" Identifier "myfb" Driver "fbdev" Option "fbdev" "/dev/fb1" EndSection

 

But, After reboot, I think only this command will execute automatically:

sudo modprobe fbtft_device custom name=fb_ili9341 gpios=reset:1,dc:201,led:6 speed=16000000 rotate=90 bgr=1

 

Because my LCD turns on and has blank screen(like when I run that command manually), but I should execute

startx

command to have my xwindow (a gray screen with a black mouse and right-click ability).

 

But I like this done automatically(like HDMI monitor).

 

So I searched a lot for it and I think found the soulution here:  I did convert my "/boot.script.bin" to "custom.fex" file with this content:

GNU nano 2.5.3              File: custom.fex                                  
 
[product]
version = "100"
machine = "FriendlyARM NanoPi M1"
 
[platform]
debug_mode = 1
eraseflag = 1
next_work = 2
 
[target]
boot_clock = 1008
storage_type = -1
 
[key_detect_en]
keyen_flag = 0
 
[fel_key]
fel_key_max = 7
fel_key_min = 2

And I think I must add something like this for my LCD:
 

script.bin/fex file
 
The settings in the [disp_init] section of the script.bin/fex file define the display output enabled at boot.

An example configuration for HDMI:
 
[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 3
screen0_output_mode = 4
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 0
 
    disp_mode selects single-screen output or different dual screen modes. Generally this is 0, which means use screen0 with fb0 (one screen).
    screen0_output_type = 3 means HDMI output.
    screen0_output_mode selects the video/monitor mode to use (resolution and refresh rate). See the table in the Fex guide.
    fb0_framebuffer_num selects the number of buffers for fb0, generally you need 2 or more for video acceleration or Mali (3D), 3 is better.
    fb0_format and fb0_pixel_sequence determine the pixel format in the framebuffer. The above example (values of 10 and 0) selects the most common variant of 32bpp truecolor (ARGB).
    fb0_scaler_mode_enable selects whether the scaler should be enabled. Enabling it does not really scale pixels, it configures the scaler to scale pixels 1-to-1 which can fix screen refresh-related problems at 1080p resolution. See the section below.
 
Similar parameter are defined for screen1 (which is usually disabled in practice).

 

But, as I know my LCD uses " fb8 " , I dont know how should I change this code?

 

And can this code solve my problem and gives me my LCD running automatically at startup or I must compile my kernel for this purpose?

Link to comment
Share on other sites

Open source development is fun. Join Armbian Linux development team today!

42 minutes ago, martinayotte said:

Did you configured the SPI itself in FEX using FEX Guide ?

 

http://linux-sunxi.org/Fex_Guide#spi_configuration

 

 

No, I didn't do it, but I did create two .conf files as I said above and after boot my display turns on and I think it means SPI works.

BTW, I am very thankful for your participation in my topic.

I tried to add "startx" to my "etc/rc.local" and it worked and saved 200EUR for me :)

 

But I have two questions if you can help me:

1- what is difference between changing "script.bin" or "rc.local" ? Is first one faster?

2- If I want to write a C++ program, and want it runs just after boot (kiosk linux), should I put my program inside "rc.local"?  How?

Link to comment
Share on other sites

 

25 minutes ago, rezaee said:

I tried to add "startx" to my "etc/rc.local" and it worked and saved 200EUR for me


You don't understand, do you? Forwarding not answered topics to my/our private communication addresses is recognized as abuse. Perhaps a ban would be better? We/I do answer if possible, but you are (nobody is) not in a position to add pressure on support or demand help.

 

SPI based display video drivers are not our work - better seek help in general forum or ask driver author.

Link to comment
Share on other sites

2 minutes ago, Igor said:

 


You don't understand, do you? Forwarding not answered topics to my/our private communication addresses is recognized as abuse. We/I do answer if possible, but you are not in a position to add pressure on support or demand help.

 

SPI based display video drivers are not our work - better seek help in general forum or ask driver author.

 

Calm down Igor! That was just kidding!
I appreciate your works and can understand you, and for that reason tried other site and found the solution!

Be happy!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...