FAQ_MA35D1_Enable I2C in U-Boot by Yocto

Post Reply
ytliu6
Posts: 80
Joined: 08 Nov 2022, 10:28

05 May 2023, 16:56

1. Add I2C device tree description to U-Boot dts
The following description is using i2c1 and PB10, PB11

Code: Select all

Path: 
/home/user/shared/yocto/build/tmp-glibc/work/numaker_som_ma35d16a81-poky-linux/u-boot-ma35d1/2020.07-r0/git/arch/arm/dts/ma35d1-sdcard0.dts

&i2c1 {
    status = "okay";
};

&pinctrl {
    i2c1 {
        pinctrl_i2c1: i2c1grp{
            nuvoton,pins =
<SYS_GPB_MFPH_PB10MFP_I2C1_SDA    &pcfg_default>,
<SYS_GPB_MFPH_PB11MFP_I2C1_SCL    &pcfg_default>;
        };
    };
};
2. Enable I2C driver in U-Boot menuconfig
Please ensure that you have confirmed the type of flash you are using to boot. In this example, we are using an SD card to boot

Code: Select all

Path:
/home/user/shared/yocto/build/tmp-glibc/work/numaker_som_ma35d16a81-poky-linux/u-boot-ma35d1/2020.07-r0/build/ma35d1_sdcard0_defconfig

Device Drivers  --->
I2C support  --->
[*] Enable Driver Model for I2C drivers
[*] MA35D1 I2C driver
Command line interface  --->
Device access commands  --->
[*] i2c
3. Use I2C command in U-Boot
Execute the following command to set the I2C bus to 0

Code: Select all

MA35D1 > i2c bus
MA35D1 > i2c dev 0

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests