This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Migrating from nrf5_SDK to nrf connect sdk

Hello,

I am migrating code from nrf5_SDK_17.0.2 to nrf connect sdk v1.6.1. The board i am using is nrf52dk(nrf52832) connected with adafruit LSM6DSO.

Everything works fine on nrf5_SDK which based on modified example twi_sensor. But when I run lsm6dso example from zephyr\samples\sensor\lsm6dso, it says

Cannot set sampling frequency for accelerometer. -134

I have tried manually write register to i2c address like what I does on nrf5_SDK but hard fault occurs.

    //uint8_t buf[2] = {0x10, 0x10};
    //int ret = i2c_write(dev, buf, 1, 0x10);
    int ret = i2c_reg_write_byte(dev, 0x6a, 0x10, 0x10);
    if (ret < 0){
        printf("cannot i2c_burst_write");
    }else {
        printf("custom i2c_burst_write");
    }

Any help would be appreciated.

prj.conf

CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_LSM6DSO=y
CONFIG_LSM6DSO_TRIGGER_NONE=y
CONFIG_CBPRINTF_FP_SUPPORT=y

modified part of nrf52dk_nrf52832.dts

arduino_i2c: &i2c0 {
	compatible = "nordic,nrf-twi";
	status = "okay";
	sda-pin = <26>;
	scl-pin = <27>;

	lsm6dso@6a {
		compatible = "st,lsm6dso";
		label = "LSM6DSO";
		reg = <0x6a>;
	};
};

Parents
  • Hello,

    kclauah said:
    I still cannot understand why I2C driver does not try to write on SDA pin and directly jump to error code.

    This is really hard to tell without any more input from your application. But normally Zephyr throws an EIO if the devicetree configuration is not completely correct.

    Unfortunately, I’m not able to test this on my side, since I do not have a DPS310 available. But I have tested the BME680 sample with my Thingy:91 and that works fine. Now, the sample does not use exactly the same I2C API as for the DPS310, so I can not exclude that their might be an issue with the sample itself.

    kclauah said:
    Can you give me a suggestion on how to create a new sensor driver? Because everything works fine on nRF5_SDK.

    My approach would have been to get the provided Zephyr sample to work with your board and sensor first, before taking any further steps.

    Regards,

    Markus

Reply
  • Hello,

    kclauah said:
    I still cannot understand why I2C driver does not try to write on SDA pin and directly jump to error code.

    This is really hard to tell without any more input from your application. But normally Zephyr throws an EIO if the devicetree configuration is not completely correct.

    Unfortunately, I’m not able to test this on my side, since I do not have a DPS310 available. But I have tested the BME680 sample with my Thingy:91 and that works fine. Now, the sample does not use exactly the same I2C API as for the DPS310, so I can not exclude that their might be an issue with the sample itself.

    kclauah said:
    Can you give me a suggestion on how to create a new sensor driver? Because everything works fine on nRF5_SDK.

    My approach would have been to get the provided Zephyr sample to work with your board and sensor first, before taking any further steps.

    Regards,

    Markus

Children
Related