Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acc only reading changes #7

Open
ReneKaminski opened this issue Jun 30, 2017 · 1 comment
Open

Acc only reading changes #7

ReneKaminski opened this issue Jun 30, 2017 · 1 comment

Comments

@ReneKaminski
Copy link

Hi Kris,
I´m setting the sensor to those settings after reset. The accel only changes its values when I move the device. There is no recognition of earth´s G, when I let one of the axes pointing to the ground, what I would expect.. Just a bit fluctation around 0. gyro and magnetometer values seem to be reasonable.

Do you have an hint for me, please?

I2C_SetSlaveAddress(Gyro);
	I2C_WriteRegister(CTRL_REG4, 0x38); //enable all axes
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG1_G, (uint8_t) (G_ODR_238<< 5 | G_SCALE_245DPS << 3 | GBW_med));
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG3_G,HP_enable);
	__delay_cycles(10);
	I2C_WriteRegister(FIFO_CTRL,0x0);//  FIFO off... by default off
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG9,DA_timer_enable);
	__delay_cycles(10);
	return 1;
}


uint8_t configAccel()
{
	I2C_SetSlaveAddress(Accel);
	I2C_WriteRegister(CTRL_REG5_XL, 0x38); //enable all axes
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG6_XL, (uint8_t) (AODR_238Hz << 5 | AFS_2G << 3 | 0x04 |ABW_50Hz) );
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG7_XL,0xA4); //High res Mode on,LP cutofffrequ  ODR/100
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG8, 0x44);// enable block data update, allow auto-increment during multiple byte read
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG9,DA_timer_enable);
	return 1;
}

uint8_t configMagnet()
{
	I2C_SetSlaveAddress(Magneto);
	I2C_WriteRegister(CTRL_REG1_M,0xF4 );  //xy:temp compensated, ultra performance mode, 10 Hz, def +-4gauss
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG2_M, (uint8_t) (MFS_4G << 5) ); // select mag full scal
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG3_M,0x0 ); //continous conversion mode, LPM off
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG4_M, (uint8_t) MMode_UltraHighPerformance <<2);// z Axis ultra perf
	__delay_cycles(10);
	I2C_WriteRegister(CTRL_REG5_M, 0x40);  //Block Update Mode
	__delay_cycles(10);
	return 1;
@kriswiner
Copy link
Owner

kriswiner commented Jun 30, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants