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

TWI scanner and sensors

Hello,

I am working with an nRF52 and two sensors using TWI. My code is based on the TWI_sensor example from SDK 12.2. I made an interesting discovery today when trying to get my HRMI board working over TWI.

When I load and run the TWI_scanner example, both of my sensors appear as they should, but only when I switched the SCL and SDA pins around. So far, my accelerometer has been giving me data when the SCL line is connected to pin 26 and SDA on pin 27. However, the TWI_scanner will only read the I2C address of the accelerometer when the SCL line is on pin 27 and SDA on pin 26 with nothing else changed in the circuitry.

The code I wrote defines SCL to pin 26 and SDA to pin 27, and when I reverse these in my code the sensor data will not display. I am doing all of this to try and read heart rate monitor data from my HRMI board (open devzone question here). I am trying to understand TWI better now to fix my problem. Am I on to something here?

Edit: Here is a zip file for my Levi Project.zip updated.

Related