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

TWI on nRF51 DK (nRf51422) with s110

image descriptionHi all,

I'm trying to get TWI working on the nRF51 DK but it's not working. I used the twi_hw_master_sd.c file so softdevice use should not be a problem. When I debug the code it gets stuck at the twi_master_transfer(0x58,dataW,2,true); line

I'm using pin 18 and 19 as specified in the config file ( 24U and 25U). I checked the pins with an oscilloscope but it seems no clock or data signal is found. Both pins do stay 'high' all the time tho. Also the device stays advertising all the time so thats not the problem. Furthermore the TWI device which i'm trying to communicatie with does send ACK according to the datasheet(see picture)

Maybe i'm doing something wrong or should I add some code about using the softdevice? I really need to get this working asap as with an arduino it only took 1 hour..

Thanks!

Parents
  • I finally got it to work. I was very confused by another topic answer stating that 24U and 25U was hexadecimal for pin P18 and P19. So i was using the wrong pins :). Can anyone clarify why the 'U' in the twi pin declaration has been added ( and thus my confusion). E.g: with spi there is no 'U' in the pin declaration. But in both cases there is just refered to the physical pin number for example P0.01,P0.24,..?

    Thanks!

Reply
  • I finally got it to work. I was very confused by another topic answer stating that 24U and 25U was hexadecimal for pin P18 and P19. So i was using the wrong pins :). Can anyone clarify why the 'U' in the twi pin declaration has been added ( and thus my confusion). E.g: with spi there is no 'U' in the pin declaration. But in both cases there is just refered to the physical pin number for example P0.01,P0.24,..?

    Thanks!

Children
Related