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

SDK TWI documentation and nrfx

Hello,

I am developing an application on the 52840 and so far find the SDK documentation quite confusing and somewhat contradictory. I need to write a simple TWI (I2c) master driver for a peripheral.

I found a simple API example in the SDK and started following that for TWI (twi_sensor). Part way through I realised that the example was apparently using a legacy driver API, so I started looking at the API documentation. This suggests that the nrf_drv drivers are legacy, but all the documentation are using the legacy drivers (see [1]). There appear to be no documentation for the newer nrfx drivers, or am I missing some resource?

nrfx appears to have 3 drivers - nrfx_twi, nrfx_twim and nrfx_twis. If nrfx_twim is the master and nrfx_twis is the slave, what is nrfx_twi for?

There is also the TWI transaction manager, which appears to be another API but again using nrf_drv prefixes to the functions (so legacy as well I presume)?

I also see some suggestions in the forum that some drivers wont work with softdevices enabled, is this true? If so, which should I use when a softdevice is enabled?

It doesn't seem much to ask for SPI master and slave examples both with and without DMA and leave it at that. The API should not need to be so different for each of the four cases (one API could easily support all four).

Could some clarity please be provided on this? I hope similar issues don't also appear with the rest of the API functions. Maybe I should switch to Zephyr or something else for cleaner APIs?

Thanks very much

[1] https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Fhardware_driver_twi.html&cp=5_1_2_0_17

Parents
  • Hi, 

    If nrfx_twim is the master and nrfx_twis is the slave, what is nrfx_twi for?

    The nrf_drv_twi is mainly a legacy layer to map the APIs to new nrfx driver implementations. Legacy driver integrates support for TWI and TWIM peripherals, while these are split into the separate drivers in nrfx (nrfx_twi and nrfx_twim). All implementation should work similar, but they have some changed APIs.

    The difference between TWI and TWIM peripherals is primarily the support for EasyDMA in TWIM (transfer/receive directly from/to RAM), for operations without CPU being involved.

    Please see this post.

     

    I also see some suggestions in the forum that some drivers wont work with softdevices enabled, is this true? If so, which should I use when a softdevice is enabled?

    Please see SoftDevice enable and disable and Application programming interface.

     

    -Amanda H. 

Reply
  • Hi, 

    If nrfx_twim is the master and nrfx_twis is the slave, what is nrfx_twi for?

    The nrf_drv_twi is mainly a legacy layer to map the APIs to new nrfx driver implementations. Legacy driver integrates support for TWI and TWIM peripherals, while these are split into the separate drivers in nrfx (nrfx_twi and nrfx_twim). All implementation should work similar, but they have some changed APIs.

    The difference between TWI and TWIM peripherals is primarily the support for EasyDMA in TWIM (transfer/receive directly from/to RAM), for operations without CPU being involved.

    Please see this post.

     

    I also see some suggestions in the forum that some drivers wont work with softdevices enabled, is this true? If so, which should I use when a softdevice is enabled?

    Please see SoftDevice enable and disable and Application programming interface.

     

    -Amanda H. 

Children
No Data
Related