On 4/30/2021 6:34 AM, yuta 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
Did you enable an I2C device? STM32 I2C peripheral support is not an
I2C device. It an I2C "lower half" and will not create a character
device. You also have to (1) enable an "upper half" device that uses
I2C, (2) create an instance of the I2C "lower half", and (3) bind the
"lower half" to the "upper half" and register the driver.
Remember, I2C is not a device. I2C is a bus that provides the physical
transport to devices on the bus. You should not normally do direct bus
access from applications .. although you can with
drivers/i2c/i2c_driver.c. i2c_driver.c can be used by your
board-initialization logic to create a character device that will allow
appliations to access the bus directly. So you can create some kind of
very limited user-space driver. It is limited because it cannot
integrate simply with other aspects of the device such as GPIO controls
or interrupts.