Skip to content

kernel segement fault arround 07_BMP280 line 162 #18

@123zmz123

Description

@123zmz123

Hello author, thanks for you tutorial on youtube.
when I try write BMP280 i2c driver by taking you code as reference I found the code -->
bmp280_i2c_client = i2c_acpi_new_device(bmp_i2c_adapter, &bmp_i2c_board_info);

will cause kernel segment error on kernel version 6.1.21-v7+

the solution is change line 162 to -->
bmp280_i2c_client =i2c_new_client_device(bmp_i2c_adapter,&bmp_i2c_board_info);

after all, the module init process can read bmp280 ID correctly

[77924.535836] MydeviceDriver - Hello Kernel
[77924.535865] MydeviceDriver - Device Nr 250609664 were registered
[77924.536487] add i2c client driver
[77924.536499] BMP280 Driver Added
[77924.536910] ID: 0x87

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions