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

NRF/NRFX TWI manager configurations & NRFX_TWI0_INST_IDX undeclared

Cheers!

I've been working to enable TWI0 for our current project, but I've been getting stuck on this compile error:

../SDK/modules/nrfx/drivers/include/nrfx_twi.h:73:35: error: 'NRFX_TWI0_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TWIM0_INST_IDX'?
     .drv_inst_idx = NRFX_CONCAT_3(NRFX_TWI, id, _INST_IDX), \

I've updated my sdk_config to enable NRFX_TWI0, and I've attempted both to enable the legacy TWI/TWI0 as well as remove them from the sdk_config completely (per a suggestion for SPI posted here devzone.nordicsemi.com/.../142936 )

Additionally I've tossed in an if else in my main.c that'll tell me at compile time if TWI0 is enabled or not (Doesn't compile with this on, but I'll uncomment it and compile to check what it can see) and so far, regardless of what I do, I end up with NRFX_TWI0_ENABLED FALSE

SDK Config settings got NRFX TWI

And if/else check that tells me True or False after verifying NRFX_TWI0_ENABLE

Parents
  • Have you tried to set TWI0_ENABLED and TWI_ENABLED to 1 (not NRFX_TWI..), I think that will solve your problem.

    The reason for this is that NRFX_TWI0_ENABLED is defined as follows (in the file apply_old_config.h):

    #undef NRFX_TWI0_ENABLED
    #define NRFX_TWI0_ENABLED   (TWI0_ENABLED && !TWI0_USE_EASY_DMA)

    Best regards, Simon

  • UPDATE
    I get TRUE finally when I do the opposite, actually. I took another shot at purging every non-nrfx mention of TWI from the sdk_config and now it gives me both true and compiles as intended! I must have left something behind last I tried this. THANK YA'LL for the help :D !!
     

    Gave it a shot with
    TWI0_ENABLED 1
    TWI0_USE_EASY_DMA 1
    with the nrfx_twi definitions both present and completely striped from the sdk_config. Seems like it simply overwrites if it's already present/defined, but at this point I'm trying everything. Neither method fixes this unfortunately.

    so nrfx_twi.c is definitely being brought in and compiled; Added  a few tests in here as well to see what's going on...
     

    #if NRFX_CHECK(NRFX_TWI_ENABLED)
        #error "NRFX_TWI_ENABLED TRUE"
    #else
        #error "NRFX_TWI_ENABLED FALSE"
    #endif


    With the above I'm getting NRFX_TWI_ENABLED FALSE on compile.
    Also tried massaging that into


    #if NRFX_TWI_ENABLED==0
        #error "NRFX_TWI_ENABLED FALSE"
    #else
        #error "NRFX_TWI_ENABLED TRUE"
    #endif


    And still, FALSE.

    The result's the same
    No matter what I change, add, or remove, NRFX_TWI_ENABLED is 0

Reply
  • UPDATE
    I get TRUE finally when I do the opposite, actually. I took another shot at purging every non-nrfx mention of TWI from the sdk_config and now it gives me both true and compiles as intended! I must have left something behind last I tried this. THANK YA'LL for the help :D !!
     

    Gave it a shot with
    TWI0_ENABLED 1
    TWI0_USE_EASY_DMA 1
    with the nrfx_twi definitions both present and completely striped from the sdk_config. Seems like it simply overwrites if it's already present/defined, but at this point I'm trying everything. Neither method fixes this unfortunately.

    so nrfx_twi.c is definitely being brought in and compiled; Added  a few tests in here as well to see what's going on...
     

    #if NRFX_CHECK(NRFX_TWI_ENABLED)
        #error "NRFX_TWI_ENABLED TRUE"
    #else
        #error "NRFX_TWI_ENABLED FALSE"
    #endif


    With the above I'm getting NRFX_TWI_ENABLED FALSE on compile.
    Also tried massaging that into


    #if NRFX_TWI_ENABLED==0
        #error "NRFX_TWI_ENABLED FALSE"
    #else
        #error "NRFX_TWI_ENABLED TRUE"
    #endif


    And still, FALSE.

    The result's the same
    No matter what I change, add, or remove, NRFX_TWI_ENABLED is 0

Children
Related