Thanks to visit codestin.com
Credit goes to github.com

Skip to content

I2C Crashes Kernel on Raspberry Pi Pico #21187

@tanneberger

Description

@tanneberger

Description

I want to use the veml7700 brightness sensor in combination with the Raspberry Pi PICO. Sadly, RIOT crashes after calling i2c_init (see the code below).

I tested the same code on the feather-nrf52840-sense there it works flawlessly.

int main(void) {
    i2c_t dev = I2C_DEV(0);
    i2c_init(dev); // crashes here

    uint16_t reg_value = 0;
    uint16_t device_addr = 0x10;

    i2c_acquire(dev);

    uint16_t conf_val1 = 6144;
    printf("writing value: %i", conf_val1);

    i2c_write_byte(dev, device_addr, 0, I2C_NOSTOP);
    i2c_write_bytes(dev, device_addr, &conf_val1, 2, 0);


    while (true) {
        i2c_read_regs(dev, device_addr, 0x04, &reg_value, 2, 0);
        printf("%i\n", reg_value);
    }

    i2c_release(dev);
    return 0;
}

Output I get by connecting a logic analyzer:

Image

Steps to reproduce the issue

In the Makefile, I add the line USEMODULE += periph_i2c in order to use i2c. Just compile this program for the BOARD=rpi-pico

Expected results

Don't crash.

Versions

I run this on RIOT version 2024.10 (b51f093a395bdd575cff94b7d26be415fa46771d)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions