apache / mynewt-core

An OS to build, deploy and securely manage billions of devices
https://mynewt.apache.org/
Apache License 2.0
824 stars 369 forks source link

NRF52 Thingy:52 board does not report sensors on I2C bus #1 #1697

Open flyingbepi opened 5 years ago

flyingbepi commented 5 years ago

I'm having some I2C issues while running the sensors_test application on a Thingy:52 (pca20020) board. Although scanning the I2C #0 bus does report the proper number of devices at the correct address (one single device @0x19), scanning the I2C #1 bus does not report any connected devices, despite that there are few of them (pressure, humidity,..). I do believe that there is a mistake in the hw/bsp/nordic_pca20020/syscfg.yml since I2C_1_PIN_SCL and I2C_PINSDA values seems to be inverted according the the Thingy:52 user's guide. But applying the fix below did not solve my issue:

I2C_1 is SCL/SDA (MPU-9250, LPS22HB, HTS221, BH1745NUC, CCS811)

The I2C scan on bus #1 still reports no device after cleaning, rebuilding and running the new image.

flyingbepi commented 5 years ago

The devices connected on the "second" IC2 bus are not powered on by default. So, the user needs to turn the Thingy:52 VDD power rail to enable I2C Sensors (Pressure, Humidity,..). This can be done this way:

#define VDD_PWR_CTRL_GPIO_PIN 30 .... / / Turn on Sensors Power Rail (VDD) hal_gpio_init_out(VDD_PWR_CTRL_GPIO_PIN, 1);