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

twi_mngr migration from SDK14.2 to SDK15.3

Hi guys,

sorry but first of all I have to admit that the migration is a mess. And really do not understand why you entered nrfx and did not make a clear cut. Because saving legacy stuff and new stuff in the same SDK will always be a mess... sorry but at least my experience. And as I experience it right now it is a mess. But now my problems:

1. Why there is a nrfx_config.h and a sdk_config and a apply_old_config.h to confuse everybody? And there is no or at least I've did not find it explanation on how they interact.

2. My recent problem is how to get TWI_MNGR running. There I've used the following config:

// Initate TWI

nrf_drv_twi_config_t const twi_bmx_config = {

   .scl                = BMX_TWI_SCL_PIN,

   .sda                = BMX_TWI_SDA_PIN,

   .frequency          = NRF_DRV_TWI_FREQ_400K,

   .interrupt_priority = APP_IRQ_PRIORITY_MID,

   .clear_bus_init     = false

};

To get this compiling I had to enable 

// <e> NRFX_TWIM_ENABLED - nrfx_twim - TWIM peripheral driver

//==========================================================

#ifndef NRFX_TWIM_ENABLED

#define NRFX_TWIM_ENABLED 0

#endif

// <q> NRFX_TWIM0_ENABLED  - Enable TWIM0 instance

#ifndef NRFX_TWIM0_ENABLED

#define NRFX_TWIM0_ENABLED 0

#endif

// <q> NRFX_TWIM1_ENABLED  - Enable TWIM1 instance

#ifndef NRFX_TWIM1_ENABLED

#define NRFX_TWIM1_ENABLED 0

#endif

and

// <e> TWI0_ENABLED - Enable TWI0 instance

//==========================================================

#ifndef TWI0_ENABLED

#define TWI0_ENABLED 1

#endif

// <q> TWI0_USE_EASY_DMA  - Use EasyDMA (if present)

#ifndef TWI0_USE_EASY_DMA

#define TWI0_USE_EASY_DMA 1

#endif

// <e> TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver - legacy layer

//==========================================================

#ifndef TWI_ENABLED

#define TWI_ENABLED 1

#endif

Why and how can I switch to the new driver. In the guide you write I have to exchange all nrf_twi.... to nrfx_twim. But this is not possible since

all your headers are full of old nrf_twi. And sorry I do not want to change your headers.

So please any hint on this.

Thanks

  • Welcome,
    First of all, we apologize for this mess and we are aware of its existence.
    Our problem is that migrating our SDK libraries to nrfx in most cases would require rewriting them from sratch. Hence the "glue layer" solution that allows you to use nrfx without having to make major changes in libraries.

    For example, this twi mngr to be moved to nrfx only would require one of two solutions:
    1. implement separately the twi_mngr library for TWI and TWIM
    2. rewriting the twi mngr with two twi backends: TWI & TWIM - similar to the solution that we have in nrf_crypto (facade pattern)

    We are currently trying to devote a lot of time so that nrfx is of the highest possible quality and can be independent from the operating system or SDK. Additionally, due to the great commitment to Zephyr OS development, we do not have much time left to rewrite libraries.

  • Then my suggestions is that next time I would wait for the big release for some more month until it is a stable and easy followable migration.

    I've just managed it by uncommenting all old TWI_ stuff in the sdk_config.

Related