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

nRF51822 Dongle - TWI (I2C) driver compile error - NRF_TWIM

I am trying to add I2C/TWI bus to nrf51822 device. I have used the SDK example code (12.3.0) and keep getting the following errors:

sdk/drivers/nrf_twim.h:69:38: error: unknown type name 'NRF_TWIM_Type'
NRF_TWIM_TASK_STARTRX = offsetof(NRF_TWIM_Type, TASKS_STARTRX), ///< Start TWI receive sequence.
^
sdk/drivers/nrf_twim.h:70:38: error: unknown type name 'NRF_TWIM_Type'
NRF_TWIM_TASK_STARTTX = offsetof(NRF_TWIM_Type, TASKS_STARTTX), ///< Start TWI transmit sequence.
^
sdk/drivers/nrf_twim.h:71:38: error: unknown type name 'NRF_TWIM_Type'
NRF_TWIM_TASK_STOP = offsetof(NRF_TWIM_Type, TASKS_STOP), ///< Stop TWI transaction.
^
sdk/drivers/nrf_twim.h:72:38: error: unknown type name 'NRF_TWIM_Type'
NRF_TWIM_TASK_SUSPEND = offsetof(NRF_TWIM_Type, TASKS_SUSPEND), ///< Suspend TWI transaction.

etc.....

I have tried going through the code docs but can't seem to find the definition of NRF_TWIM_Type and it doesn't appear to be part of the nRF51 libraries that I can find.

Any ideas?

Thanks

William

  • Hi,

    The nRF51 series ICs does not have the TWIM peripheral (TWI with EasyDMA feature), this is only available on nRF52 series.

    NRF_TWIM_Type is defined in components\device\nrf52.h.

    If you get this errors, there is most likely some wrong symbols or defines set in your project. The file nrf_twim.h is included in nrf_drv_twi.h if the symbol TWIM_PRESENT is defined. TWIM_PRESENT is defined in files nrf52810_peripherals.h\nrf52832_peripherals.h\nrf52840_peripherals.h, which is included by the file nrf_peripherals.h, if one of the following symbol are defined: NRF52810_XXAA/NRF52832_XXAA/NRF52840_XXAA.

    Please check in your project settings if any of these are set. For nRF51822 IC, you should use the symbol NRF51822.

    Best regards,
    Jørgen

Related