cancel
Showing results for 
Search instead for 
Did you mean: 

How to add sd card to lvgl zephyr project for stm32f746g_disco?

OU
Associate II

I have an existing project on an STM32F746g_disco board. The project uses lvgl under zephyr rtos. 
When I build and flash the zephyr/subsys/fs/fs_sample for this board, The terminal does read the sd card and return a listing of the root contents.
I tried to apply the devicetree overlay, kconfig, and code to my lvgl based project, but it now shows an error of the mount point is unknown.

I did more digging and with the help of claude came up with these changes.

Error:

1. At one point I could get it to compile but the error reported was that the mount point didn't exist.

2. With this code I have a " undefined reference to `__device_dts_ord_208'" error, which seems to be associated wih the ".rodata.sdmmc_config_" file.


Questions:

Is this the correct approach to adding an sdcard to an lvgl project in zephyr? 

1 REPLY 1
OU
Associate II

Overlay file.

#include <zephyr/dt-bindings/pinctrl/stm32-pinctrl.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/i2c/i2c.h>

&i2c1 {
//compatible="st,stm32f401";
status = "okay";
clock-frequency = < I2C_BITRATE_STANDARD >;
dac0: mcp4725@60{
compatible = "microchip,mcp4725";
status = "okay";
reg = < 0x60 >;
#io-channel-cells = < 1 >;
};
};

&sdmmc1{
status="okay";
power-domain = <&pd_core>;
bus-width=<4>;
slot {
compatible="st,stm32-sdmmc-slot";
status="okay";
cap-sd-highspeed;
cap-mmc-highspeed;
bus-width=<4>;
sd-uhs-sdr12;
sd-uhs-sdr25;
mmc{
compatible="zephyr,sdmmc-disk";
status="okay";
disk-name="SD";
};
};
};
&dma2 {
status = "okay";
};

/ {
power-domains {
pd_core: pd-core {
compatible = "power-domain";
#power-domain-cells = <0>;
};
};

leds{
compatible="gpio-leds";
outputenable: output_enable {
gpios=<&gpioa 8 GPIO_ACTIVE_HIGH>;
label="Output Enable";
};
rs485txenable: rs485Tx_enable {
gpios=<&gpiog 6 GPIO_ACTIVE_HIGH>;
label="485 tx Enable";
};
};

buttons{
compatible="gpio-keys";
inputdooropen: input_dooropen {
gpios=<&gpioi 3 GPIO_ACTIVE_HIGH>;
label="Input Door Open";
zephyr,code = <INPUT_KEY_0>;
};
inputhomesw: input_homesw {
gpios=<&gpiob 4 GPIO_ACTIVE_HIGH>;
label="Input Home Sw";
zephyr,code = <INPUT_KEY_0>;
};
inputcyclecount: input_cyclecount{
gpios=<&gpiog 7 GPIO_ACTIVE_HIGH>;
label="Input Cycle Count";
zephyr,code = <INPUT_KEY_0>;
};
inputdownswitch: input_downsw{
gpios=<&gpioh 6 GPIO_ACTIVE_HIGH>;
label="Input Arm Down Sw";
zephyr,code = <INPUT_KEY_0>;
};
};

aliases{
outputenable=&outputenable;
rs485txenable=&rs485txenable;
inputdooropen = &inputdooropen;
inputhomesw = &inputhomesw;
inputcyclecount=&inputcyclecount;
inputdownswitch=&inputdownswitch;
// dac0 = &dac0;
// sdcard = &sdmmc1;
// disk0 = "/dev/mmcblk0"; // Linux-style alias
};

};