This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 i2c bit-bang driver gives no output

Hello,

I want to implement an SMbus read block function. As this function seems to be not supported by hardware I want to try by modifying the i2c bit bang driver.

Unfortunately the stock bitbang driver seems to be unable to output any waveform. The code execution reaches i2c_gpio_set_scl and i2c_gpio_set_sda function from i2c_gpio.c

Is this driver supported by nrf9160? Did I miss any config option?

prj.conf:

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y

CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_I2C_GPIO=y
CONFIG_I2C_GPIO_2=y
CONFIG_I2C_GPIO_2_SCL_PIN=31
CONFIG_I2C_GPIO_2_SDA_PIN=30
CONFIG_I2C_GPIO_2_NAME="I2C_2"
CONFIG_I2C_GPIO_2_GPIO="GPIO_0"

The project is based on i2c_fujitsu_fram sample from zephyr repo. My goal is to get a WR+ACK using the bitbang driver.

Best regards,

Vlad

Parents Reply Children
  • Hi 

    This is not a driver that is tested to work with Nordic devices, and since most people use the I2C hardware driver providing a working bit banged driver hasn't really been a priority. 

    I would suggest following Simon's workaround. If that doesn't work for some reason please open a new ticket and we can have a look at it. 

    Best regards
    Torbjørn

  • On an nRF9160 I did this to get output on the pins

    nrf_gpio_cfg(30/*SDA*/,
        NRF_GPIO_PIN_DIR_OUTPUT/*1*/,
        NRF_GPIO_PIN_INPUT_CONNECT/*0*/,
        NRF_GPIO_PIN_NOPULL/*0*/,
        NRF_GPIO_PIN_S0D1/*0x600*/,
        NRF_GPIO_PIN_NOSENSE/*0*/);


    nrf_gpio_cfg(31/*SCL*/,
        NRF_GPIO_PIN_DIR_OUTPUT/*1*/,
        NRF_GPIO_PIN_INPUT_DISCONNECT/*2*/,
        NRF_GPIO_PIN_NOPULL/*0*/,
        NRF_GPIO_PIN_S0D1/*0x600*/,
        NRF_GPIO_PIN_NOSENSE/*0*/);

Related