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

MPU6050 to nRF51 DK

New to embedded world. Trying to interface MPU6050 w/ nRF51 DK via TWI. I have included the external MPU6050 drivers and everything compiles in Keil (except for last few lines of code below). Just need gyro data for x, y, z.

I have found related questions/material here and here but these don't specifically address my problem.

I have been able to get everything to work by duplicating hardware and code from github here but it's using a different MCU and I want to move to the nRF51 for ble capability.

Any help to solving my coding issue to get gyro output is greatly appreciated. Also, it appears this can be done either hardware or software TWI? Any advantage to one vs. the other?

  main.c
'#include "stdio.h"
'#include "simple_uart.h"
'#include <stdbool.h>
'#include <stdint.h>
'#include "nrf.h"
'#include "bsp.h"
'#include "mpu6050.h"
'#include "twi_master.h"
'#include "twi_master_config.h"

'#define MPU6050_ADDRESS (0x68U) 


int fputc(int ch, FILE * p_file)

{
      simple_uart_put((uint8_t)ch);

       return ch;
}
int main(void)
{
			//set up UART for output
      simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, false);

       		
	   //Initialize TWI
	    twi_master_init();

     //initialize device
     mpu6050_init (MPU6050_ADDRESS);
					
		//verify conection
     mpu6050_verify_product_id();
	
	  			
		//Read data	& Output 		
	
	   while(1) {
		// mpu6050_register_read(MPU6050_ADDRESS,(0x68U), 156); //prototype - mpu6050_register_read(uint8_t register_address, uint8_t * destination, uint8_t number_of_bytes)
		   		
			      // printf - need gyro data only for x, y, z 
		 }
	}		
Parents Reply Children
No Data
Related