Hi,
I've been searching the devzone for TWI examples, and preferably an example with MPU6050. Here are a conclusion of stuff that I found, but as some of them were for 2013/2014 wanted to check first that no updated versions are available:
-
It seems the TWI example has been removed after SDK 6, but the drivers are still there. I'm using SDK 9 for PCA20006 (Beacon module).
-
There are twi_hw_master.c and twi_sw_master.c in drivers_nrf folder, which it seems the hw one doesn't work with Softdevice, but sw one works. Don't know what are the pro and cons of hw and sw.
-
In devzone.nordicsemi.com/.../ Alseth has provided a file named sd_twi_hw_master.c which seems will solve the issue with Softdevice. This was originally posted 2 years ago and re-uploaded one year ago. Don't know if the problem has been solved in future releases.
-
I can see a file named nrf_drv_twi.c in the twi_master folder, which was not mentioned in any of the posts that I looked at. Is this a new addition?
-
There are drivers specifically for MPU6050 as explained in devzone.nordicsemi.com/.../ that provide init, write, read, and verify product id.
My goal is read data every 50msec from the sensor and then advertise them whenever they fill a full packet.
Considering those functions provided in MPU6050 drivers, should I just go through the registers of MPU6050 and write the correct values to them by using the WRITE function, and then just read with READ function and save data? Meaning that I do not need to face writing any code for TWI and...?
Any other setting required?
Thanks, FA