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

Migrating a design from Raspberry pi Zero to nRF9160 DK - Need I2C and SPI interfaces

Hi,

I have developed a simple system based around a Raspberry Pi Zero. The system uses a couple of sensors to measure temperature and water pressure using a ADS51115 A/D and a MAX 31865 RTD to digital convertor. These connect to the Pi zero via the !2C bus and the SPI interface. I would like to replace the Pi zero with the nRF9160 dev board, can some one point me to some example hw and sw that will enable me to quickly convert. Thanks, Rod

Parents Reply Children
  • Hi,

    It means that a maximum of 4 of these serial instances can be used at the same time. However, the nrfx drivers have a feature called PRS (Peripheral Resource Sharing) that allows you to switch instances on and off runtime as you need them.

    Disclaimer: I have not used the PRS recently myself, and the below information is based on documentation. I'll update this comment when I get the chance to do a proper test and confim that the below information is correct.

    If you use nrfx drivers directly, this is achieved by enabling NRFX_PRS on the serial boxes where you want them, and then calling init()/uninit() functions beore and after transactions. Here's the API docs:
    https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/group__nrfx__prs.html

    ---

    Update: There is a mechanism in the device tree parsing that prevents multiple instances for the same serial box from being enabled at the same time, leaving the suggested workaround below unusable. I will check more in this and comment here when I have more information.


    If you are using NCS, and don't want to use nrfx drivers directly, but rather Zephyr's drivers, you will have to use the device power management features to switch an instance on and off (euivalent to calling init()/uninit()). I am not sure about the implications using PRS might have on device tree configuration, and how driver initialization in Zephyr works. I have not tested this myself.

    Here's documentation for the related Kconfigs:
    CONFIG_NRFX_PRS

    CONFIG_NRFX_PRS_BOX_0

    CONFIG_DEVICE_POWER_MANAGEMENT

    Docs on device power management is found here.

    To enable a peripheral, use DEVICE_PM_ACTIVE_STATE.

    To disable it, use on of these three states: DEVICE_PM_LOW_POWER_STATE, DEVICE_PM_SUSPEND_STATE or DEVICE_PM_OFF_STATE.

    Let us know if you run into any issues. 
    Best regards,
    Jan Tore
Related