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

How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?

I need to connect VL53Xl to NRF51 DK> I am using latest 12.2 SDK with Keil MDK.I cannot find any I2C(TWI) example. I can find examples for NRF52 based devices. but not for NRF51.

I tried using Hal functions but ended up with missing definitions which are only available with NRF52 devices.

Pls help

Parents
  • @Bjorn, after I declare nrf_drv_twi_t twi_instance = NRF_DRV_TWI_INSTANCE(0); on main.c the following error appeared.

    ..\..\..\main.c(92): error:  #20: identifier "TWI0_USE_EASY_DMA" is undefined
    

    Then I added nrf_drv_twi_dox_config.h and then the below error comes

    ..\..\..\..\..\..\components\drivers_nrf\twi_master\nrf_drv_twi_dox_config.h(13): warning:  #47-D: incompatible redefinition of macro "TWI_ENABLED" (declared at line 2530 of "..\config\sdk_config.h")
      #define TWI_ENABLED
    ..\..\..\main.c(92): error:  #29: expected an expression
      nrf_drv_twi_t twi_instance = 
    RF_DRV_TWI_INSTANCE(0);
    

    Do you have any idea. Pls help. I can compile peripheral example separately. I wonder why this happen.

Reply
  • @Bjorn, after I declare nrf_drv_twi_t twi_instance = NRF_DRV_TWI_INSTANCE(0); on main.c the following error appeared.

    ..\..\..\main.c(92): error:  #20: identifier "TWI0_USE_EASY_DMA" is undefined
    

    Then I added nrf_drv_twi_dox_config.h and then the below error comes

    ..\..\..\..\..\..\components\drivers_nrf\twi_master\nrf_drv_twi_dox_config.h(13): warning:  #47-D: incompatible redefinition of macro "TWI_ENABLED" (declared at line 2530 of "..\config\sdk_config.h")
      #define TWI_ENABLED
    ..\..\..\main.c(92): error:  #29: expected an expression
      nrf_drv_twi_t twi_instance = 
    RF_DRV_TWI_INSTANCE(0);
    

    Do you have any idea. Pls help. I can compile peripheral example separately. I wonder why this happen.

Children
No Data
Related