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

How do I program the nrf9160 to communicate with a peripheral using SPI, I2C, other serial protocol, etc?

Are there example scripts to take readings or communicate with other devices over serial? Like, if I attach a temperature sensor, distance sensor, etc, I want to read from it and then communicate the reading up using LTE network. Ideally I wouldn't have to use the 528xx chip and would do it all on the 9160 module but I will take any solutions at this point of the project.

Parents
  • Hi Duser,

    If you want to add a peripheral to use with your nrf91DK: 

    One option is to:

    You add an .overlay file in the application folder (where the applications CMakeLists.txt is located). And when using the nrf91DK you call this file "nrf9160_pca10090.overlay".

    In this file you add what pins you would like to use for the peripherals.

    ex. to activate TWI

    - add this to the .overlay file

    &i2c2 {
    	status = "ok";
    	sda-pin = <11>;
    	scl-pin = <12>;
    	clock-frequency = <I2C_BITRATE_STANDARD>; 
    };

    - Activate the TWI in the prj.conf file (same as ninja menuconfig or the settings in SES)

    # Enable I2C
    CONFIG_I2C=y
    CONFIG_I2C_NRFX=y
    CONFIG_I2C_2=y
    CONFIG_I2C_2_NRF_TWIM=y

Reply
  • Hi Duser,

    If you want to add a peripheral to use with your nrf91DK: 

    One option is to:

    You add an .overlay file in the application folder (where the applications CMakeLists.txt is located). And when using the nrf91DK you call this file "nrf9160_pca10090.overlay".

    In this file you add what pins you would like to use for the peripherals.

    ex. to activate TWI

    - add this to the .overlay file

    &i2c2 {
    	status = "ok";
    	sda-pin = <11>;
    	scl-pin = <12>;
    	clock-frequency = <I2C_BITRATE_STANDARD>; 
    };

    - Activate the TWI in the prj.conf file (same as ninja menuconfig or the settings in SES)

    # Enable I2C
    CONFIG_I2C=y
    CONFIG_I2C_NRFX=y
    CONFIG_I2C_2=y
    CONFIG_I2C_2_NRF_TWIM=y

Children
Related