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

nrf52832 I2C easyDMA

Hello!

I want to use easyDMA. The SDK version  I use is  SDK15.0.I want to know how to config easyDMA.For example , If I only need to config TWI0_USE_EASY_DMA==1  ?

  • Yes, correct. Let me explain.

    When using one of the provided examples in SDK 15 (for example twi_sensor), you have two choices when using I2C: TWIM (also TWIS) or TWI, where the first uses easyDMA and the second does not. When you enable easyDMA through either TWI0_USE_EASY_DMA or TWI1_USE_EASY_DMA, the example will use the functions in the TWIM driver (not the TWI driver).

    Best regards, Simon

  • how to enable twim0...i changed in sdk_config.h still not working..

    it was no problem in twi_sensor example...now i am integrating twi_sensor in ble_eddystone...and on built it give an error of "'NRF_DRV_TWI_INSTANCE_0' undeclared here (not in a function); did you mean 'NRF_DRV_TWI_INSTANCE_'?"

    what is the reason and can you tell me how to enable twim0..

    below is nrf_drv_twi.h file ...which shows that twim0 is not enabled..can you solve yhis problem..it would be great help..thank you.

      

  • If you look at the file nRF5_SDK_15.3.0\integration\nrfx\legacy\nrf_drv_twi.h, you will see that NRF_DRV_TWI_INSTANCE_0 depends on either NRFX_TWIM0_ENABLED or NRFX_TWI0_ENABLED.

    #if NRFX_CHECK(NRFX_TWIM0_ENABLED)
        #define NRF_DRV_TWI_INSTANCE_0 \
            { 0, { .twim = NRFX_TWIM_INSTANCE(0) }, true }
    #elif NRFX_CHECK(NRFX_TWI0_ENABLED)
        #define NRF_DRV_TWI_INSTANCE_0 \
            { 0, { .twi = NRFX_TWI_INSTANCE(0) }, false }
    #endif
    #if NRFX_CHECK(NRFX_TWIM1_ENABLED)
        #define NRF_DRV_TWI_INSTANCE_1 \
            { 1, { .twim = NRFX_TWIM_INSTANCE(1) }, true }
    #elif NRFX_CHECK(NRFX_TWI1_ENABLED)
        #define NRF_DRV_TWI_INSTANCE_1 \
            { 1, { .twi = NRFX_TWI_INSTANCE(1) }, false }
    #endif

    Take a look at nRF5_SDK_15.3.0\integration\nrfx\legacy\apply_old_config.h to see how to enable these two configs. E.g. if you set TWI0_ENABLED and TWI0_USE_EASY_DMA to 1 in the sdk_config.h, then NRFX_TWIM0_ENABLED will be set to 1.

    #if defined(TWI_PRESENT) && !defined(TWIM_PRESENT)
    
    #undef NRFX_TWI0_ENABLED
    #define NRFX_TWI0_ENABLED   TWI0_ENABLED
    #undef NRFX_TWIM0_ENABLED
    #define NRFX_TWIM0_ENABLED  0
    
    #undef NRFX_TWI1_ENABLED
    #define NRFX_TWI1_ENABLED   TWI1_ENABLED
    #undef NRFX_TWIM1_ENABLED
    #define NRFX_TWIM1_ENABLED  0
    
    #elif !defined(TWI_PRESENT) && defined(TWIM_PRESENT)
    
    #undef NRFX_TWI0_ENABLED
    #define NRFX_TWI0_ENABLED   0
    #undef NRFX_TWIM0_ENABLED
    #define NRFX_TWIM0_ENABLED  TWI0_ENABLED
    
    #undef NRFX_TWI1_ENABLED
    #define NRFX_TWI1_ENABLED   0
    #undef NRFX_TWIM1_ENABLED
    #define NRFX_TWIM1_ENABLED  TWI1_ENABLED
    
    #else // -> defined(TWI_PRESENT) && defined(TWIM_PRESENT)
    
    #undef NRFX_TWI0_ENABLED
    #define NRFX_TWI0_ENABLED   (TWI0_ENABLED && !TWI0_USE_EASY_DMA)
    #undef NRFX_TWIM0_ENABLED
    #define NRFX_TWIM0_ENABLED  (TWI0_ENABLED && TWI0_USE_EASY_DMA)

    Best regards,

    Simon

Related