2021-10-07 08:07 AM
I have attached an Adafruit LCD (https://www.adafruit.com/product/1770) to my STM32MP157D-DK1 on SPI5 (on the RPi header). I am working with Yocto and the STM32MP1 BSP (but not OpenSTLinux). I am attempting to modify core-image-minimal to enable the SPI5 port and display a console (e.g. framebuffer) to the LCD. Thus far, I have been unsuccessful in getting anything to show up on the LCD (and the SPI lines remain silent when probed with a logic analyzer).
I added the following node to the device tree source (.dts):
&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi1_pins_a>;
pinctrl-1 = <&spi1_sleep_pins_a>;
cs-gpios = <&gpiof 6 GPIO_ACTIVE_HIGH>;
status = "okay";
display@0{
compatible = "adafruit,yx240qv29", "ilitek,ili9341";
reg = <0>;
spi-max-frequency = <32000000>;
dc-gpios = <&gpiof 4 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpiof 0 GPIO_ACTIVE_HIGH>;
rotation = <270>;
/* backlight = <&backlight>; */
};
};
I enabled the following modules (`bitbake -c menuconfig virtual/kernel`). I am using the TinyDRM driver, as the fbtft driver seems to be outdated. The backlight driver does not seem to be needed, as the Adafruit board has the backlight tied to maximum brightness by default.
I made the following Yocto variable changes:
# Add kernel module for LCD driver
IMAGE_INSTALL += "kernel-module-ili9341"
# Autoload ILI9341 SPI driver on boot
KERNEL_MODULE_AUTOLOAD += "ili9341"
When I boot my image, I notice that the module does not autoload (first problem). I can remedy that with `modprobe` (I have the rtl8188eu driver also enabled):
root@stm32mp1:~# modprobe ili9341
root@stm32mp1:~# lsmod
Tainted: G
ili9341 16384 0 - Live 0xbf0f5000
drm_mipi_dbi 20480 1 ili9341, Live 0xbf0eb000
r8188eu 331776 0 - Live 0xbf099000 (C)
cfg80211 602112 1 r8188eu, Live 0xbf005000
lib80211 16384 1 r8188eu, Live 0xbf000000
There seems to be a "display@0" device attached to the SPI5 port (at least in the filesystem):
root@stm32mp1:~# ls /proc/device-tree/soc/spi@44009000/display@0/
compatible name reset-gpios spi-max-frequency
dc-gpios reg rotation
However, I do not have a /dev/fb0 device that should let me write data to (second problem):
root@stm32mp1:~# ls /dev/fb*
ls: /dev/fb*: No such file or directory
I'm not sure where to go from here to get a console out (or anything displayed) on the SPI LCD. Any help would be appreciated!
2021-10-08 12:12 AM
Hello @ShawnHymel ,
Just a quick reply to know if you made on purpose, the choice to use the pinctrl spi1 for your node spi5?
Because it is normally already used by your dk1 except if you adapted your pinmux.
Regards,
Kevin
2021-10-08 02:03 PM
@Kevin HUBER Good catch, thank you! I changed the dts node to the following and re-built my image:
&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_a>;
pinctrl-1 = <&spi5_sleep_pins_a>;
cs-gpios = <&gpiof 6 GPIO_ACTIVE_HIGH>;
status = "okay";
display@0{
compatible = "adafruit,yx240qv29", "ilitek,ili9341";
reg = <0>;
spi-max-frequency = <32000000>;
dc-gpios = <&gpiof 4 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpiof 0 GPIO_ACTIVE_HIGH>;
rotation = <270>;
/* backlight = <&backlight>; */
};
};
Still no luck with activity on the SPI lines (after `modprobe ili9341`), though.
2021-10-11 07:35 AM
Hello @ShawnHymel ,
I have no idea why nothing is happening on your SPI lines, but we noticed that you are trying to modify the recipe "core-image-minimal".
As specified in the yocto manual: https://docs.yoctoproject.org/ref-manual/images.html
The "core-image-minimal" is
core-image-minimal: A small image just capable of allowing a device to boot.
In this image all the things related to graphic are disabled, why are you trying to modify this recipe? This is the hardest to adapt to use a graphic display?
Please, can you use the recipe "core-image-weston" instead?
core-image-weston: A very basic Wayland image with a terminal. This image provides the Wayland protocol libraries and the reference Weston compositor. For more information, see the “Using Wayland and Weston�? section in the Yocto Project Development Tasks Manual.
This one is especially made to support graphic display.
Regards,
Kévin
*edit a typo
2021-10-11 06:40 PM
Hi @Kevin HUBER ,
Thank you for the reply! I'm working on a video series that shows people how to create a custom Linux image by slowly adding features/modules to core-image-minimal (rather than starting with a large, pre-built image like Weston). Because of that, I'd prefer to avoid Weston for the series.
Just to see if it would work, I tried building Weston. I added these lines to local.conf (as per this guide https://wiki.yoctoproject.org/wiki/Wayland):
CORE_IMAGE_EXTRA_INSTALL += "wayland weston"
DISTRO_FEATURES_append = " wayland x11"
However, when I run `bitbake core-image-weston`, I get the following error message:
| from ../../cairo-1.16.0/src/cairo-gl-gradient-private.h:61,
| from ../../cairo-1.16.0/src/cairo-gl-private.h:52,
| from ../../cairo-1.16.0/src/cairo-gl-device.c:46:
| /home/sgmustadio/yocto/build_mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/cairo/1.16.0-r0/recipe-sysroot/usr/include/GL/glext.h:56:10: fatal error: KHR/khrplatform.h: No such file or directory
| 56 | #include <KHR/khrplatform.h>
| | ^~~~~~~~~~~~~~~~~~~
| compilation terminated.
| In file included from /home/sgmustadio/yocto/build_mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/cairo/1.16.0-r0/recipe-sysroot/usr/include/GL/gl.h:2050,
| from ../../cairo-1.16.0/src/cairo-gl-gradient-private.h:61,
| from ../../cairo-1.16.0/src/cairo-gl-private.h:52,
| from ../../cairo-1.16.0/src/cairo-gl-composite.c:48:
| /home/sgmustadio/yocto/build_mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/cairo/1.16.0-r0/recipe-sysroot/usr/include/GL/glext.h:56:10: fatal error: KHR/khrplatform.h: No such file or directory
| 56 | #include <KHR/khrplatform.h>
| | ^~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[3]: *** [Makefile:2535: cairo-gl-device.lo] Error 1
| make[3]: *** Waiting for unfinished jobs....
| make[3]: *** [Makefile:2535: cairo-gl-composite.lo] Error 1
| make[3]: Leaving directory '/home/sgmustadio/yocto/build_mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/cairo/1.16.0-r0/build/src'
| make[2]: *** [Makefile:2126: all] Error 2
| make[2]: Leaving directory '/home/sgmustadio/yocto/build_mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/cairo/1.16.0-r0/build/src'
| make[1]: *** [Makefile:899: all-recursive] Error 1
| make[1]: Leaving directory '/home/sgmustadio/yocto/build_mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/cairo/1.16.0-r0/build'
| make: *** [Makefile:750: all] Error 2
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/sgmustadio/yocto/poky/meta/recipes-graphics/cairo/cairo_1.16.0.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1448 tasks of which 1446 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/sgmustadio/yocto/poky/meta/recipes-graphics/cairo/cairo_1.16.0.bb:do_compile
Summary: There were 3 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
2021-10-14 03:30 AM
Hello @ShawnHymel
Thanks for the explanation, now I understand why you want to use the "core-image-minimal".
To be sure that what you try to make can works, the easiest way is to use the official image of ST with basic wayland: st-image-weston
The procedure is explained on the wiki: https://wiki.st.com/stm32mpu/wiki/STM32MP1_Distribution_Package#Initializing_the_OpenEmbedded_build_environment
To build it, you have to specify your distro and your board by running this command:
PC $> DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh
Then choose the image to build:
PC $> bitbake st-image-weston
Please can you try with this one and see if you are able to use your SPI LCD?
On this image, you have some tools like "modetest" to help you investigate and perform basic tests. More details on the Wiki: https://wiki.st.com/stm32mpu/wiki/DRM_KMS_overview#modetest_-28DRM-2FKMS_test_tool-29
About your second problem:
For information, even if I'm not an expert on this topic. I do not have frame buffer in /dev on my DK2, but the displays works.
Even if Framebuffer Console support is enabled in my menuconfig.
root@stm32mp1-disco:~# ls /dev/fb*
ls: cannot access '/dev/fb*': No such file or directory
Something else must be required. I inquire and I will come back to you if I find more information.
Hope it helps,
Regards,
Kévin
2021-10-14 05:42 AM
Hi @ShawnHymel,
I found how to see some framebuffer information by using debugfs. It is described in the same wiki page of the "modetest": https://wiki.st.com/stm32mpu/wiki/DRM_KMS_overview#How_to_monitor_with_debugfs
You can cat the file "framebuffer" of the debug with the line:
cat /sys/kernel/debug/dri/0/framebuffer
On my board, the result looks like that:
framebuffer[41]:
allocated by = weston
refcount=1
format=XR24 little-endian (0x34325258)
modifier=0x0
size=480x800
layers:
size[0]=480x800
pitch[0]=1920
offset[0]=0
obj[0]:
name=0
refcount=2
start=00010177
size=1536000
imported=yes
paddr=0xc8000000
vaddr=00000000
framebuffer[40]:
allocated by = weston
refcount=2
format=XR24 little-endian (0x34325258)
modifier=0x0
size=480x800
layers:
size[0]=480x800
pitch[0]=1920
offset[0]=0
obj[0]:
name=0
refcount=2
start=00010000
size=1536000
imported=yes
paddr=0xc6600000
vaddr=00000000
Regards,
Kévin
2021-11-17 07:57 AM
Hi @ShawnHymel ,
Did you succeed to make your SPI LCD works on the DK2 with the st-image-weston?
Or even better, did it works with your adaptation of the core-image-minimal?
Regards,
Kévin