Abdelatif,
Thank you for your advice.

I enabled I2C tool in menuconfig.
Then I added some lines to initialize I2C in stm32_appinitialize.c refering to the link you shared.
https://github.com/apache/incubator-nuttx/blob/master/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_bringup.c#L89-L111

stm32_appinitialize.c seems to be executed before launching NuttShell and I can see some other stuff such as GPIO, MMCSD, QENCODER,... is initialized there.(I assume that this file has the similar role as stm32_bringup.)

I added lines below in stm32_appinitialize.c.
```
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_MPU9250)
  printf("appinitialize config i2c\n");
  stm32_mpu9250initialize("/dev/i2c1");
#endif
```
In stm32_mpu9250initialize("/dev/i2c1") which I made, do almost the same things as  the code in your link.
- call stm32_i2cbus_initialize()
- call i2c_register()

I can see /dev/i2c1 when I type ls /dev on NuttShell.
Also I can see that i2c bus1 is enabled when I tried `i2c bus` on NuttShell.
However, `i2c dev -b 1 0x03 0x77` did not detect any i2c device. (the device I'm trying to use has 0x68 slave address. so It should be detected.)

On 2021/04/30 21:50, Abdelatif Guettouche wrote:
If you want to use the I2C tool, you'll also have to register the i2c
driver from your board logic.

See:
https://github.com/apache/incubator-nuttx/blob/master/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_bringup.c#L89-L111
https://github.com/apache/incubator-nuttx/blob/master/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_i2c.c

On Fri, Apr 30, 2021 at 1:47 PM Alan Carvalho de Assis
<acas...@gmail.com> wrote:
Hi Yuta,

Yes, you forgot to select the I2C Character driver support.

Please try to follow this tutorial:

https://www.youtube.com/watch?v=RzrDa4Sm1rU

BR,

Alan

On 4/30/21, yuta <yutr...@gmail.com> wrote:
Hi all,
I'm trying to use I2C.
I configured below in menuconfig.
- System Type > STM32 Peripheral Support > [*] I2C1
- Device Drivers > [*] I2C Driver Support
then compilation was done successfully.
But no I2C device( like /dev/i2c1 ) showed up when I tried ls /dev
Do I forget something to do?

I'm using Nucleo-F767ZI board.

Thank you.
Yuta Ide


Reply via email to