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

s120 with TWI

I'm trying to use the TWI master example with the S120 soft device. It looks like there is a known problem trying to get the S110 working with the hardware TWI. It seems the TWI doesn't play well with the S120 either. I found this thread to get it working with the S110:

devzone.nordicsemi.com/.../

I tried the fix, but it doesn't seem to work with the S120. The TWI initializes now, but when I try to perform a read, it's causing a hard fault.

Does anyone know how to get the TWI master example working with the S120?

Parents
  • The TWI master example is set up to access the PPI registers directly without checking if the SoftDevice is enabled. When the softdevice is enabled, the sd_ppi_x functions must be used, as accessing the registers directly causes a HardFault.

    The attached hal_twi library will check to see if the SoftDevice is enabled and access the registers or SoftDevice API accordingly. I've also attached a driver file that utilizes the hal_twi library to access a IMU sensor as an example of use.

    Audun

  • Hi Audun, I am using the S110 v7 using twi_sw_master with no problems. I want to change to hw so I am using your library hal_twi as suggested. I have 10k external pullups, but just to make sure I changed also your config to pullup. I am getting an NRF_ERROR_INTERNAL error on hal_twi_init().

    The params are: twi_conf.scl_pin = SCL_PIN; twi_conf.sda_pin = SDA_PIN; twi_conf.frequency = hal_twi_freq_100khz; twi_conf.ppi_chn = 0;

    I would guess that your library worked for you. What do you think could be my problem? Thanks!

Reply
  • Hi Audun, I am using the S110 v7 using twi_sw_master with no problems. I want to change to hw so I am using your library hal_twi as suggested. I have 10k external pullups, but just to make sure I changed also your config to pullup. I am getting an NRF_ERROR_INTERNAL error on hal_twi_init().

    The params are: twi_conf.scl_pin = SCL_PIN; twi_conf.sda_pin = SDA_PIN; twi_conf.frequency = hal_twi_freq_100khz; twi_conf.ppi_chn = 0;

    I would guess that your library worked for you. What do you think could be my problem? Thanks!

Children
No Data
Related