Skip to content

HMC5883L driver config error #1381

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

Closed
longcongduoi opened this issue Sep 6, 2017 · 2 comments
Closed

HMC5883L driver config error #1381

longcongduoi opened this issue Sep 6, 2017 · 2 comments
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@longcongduoi
Copy link

Data unchanged after read

/* configure device */
chip_cfg[0] = idx << HMC5883L_ODR_SHIFT;
chip_cfg[1] = drv_data->gain_idx << HMC5883L_GAIN_SHIFT;
chip_cfg[2] = HMC5883L_MODE_CONTINUOUS;

if (i2c_burst_write(drv_data->i2c, HMC5883L_I2C_ADDR,
		    HMC5883L_REG_CONFIG_A, chip_cfg, 3) < 0) {
	SYS_LOG_ERR("Failed to configure chip.");
	return -EIO;
}

I' ve changed to

/* configure device - FIXME */  
chip_cfg[0] = idx << HMC5883L_ODR_SHIFT;
chip_cfg[1] = drv_data->gain_idx << HMC5883L_GAIN_SHIFT;
chip_cfg[2] = HMC5883L_MODE_CONTINUOUS;

if (i2c_burst_write(drv_data->i2c, HMC5883L_I2C_ADDR,
		    HMC5883L_REG_CONFIG_A, &chip_cfg[0], 1) < 0) {
	SYS_LOG_ERR("Failed to configure chip.");
	return -EIO;
}

if (i2c_burst_write(drv_data->i2c, HMC5883L_I2C_ADDR,
		    HMC5883L_REG_CONFIG_B, &chip_cfg[1], 1) < 0) {
	SYS_LOG_ERR("Failed to configure chip.");
	return -EIO;
}

if (i2c_burst_write(drv_data->i2c, HMC5883L_I2C_ADDR,
		    HMC5883L_REG_MODE, &chip_cfg[2], 1) < 0) {
	SYS_LOG_ERR("Failed to configure chip.");
	return -EIO;
}

It's ok

@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Sep 7, 2017
@nashif
Copy link
Member

nashif commented Sep 7, 2017

can you submit a PR?

@MaureenHelm MaureenHelm added the area: Sensors Sensors label Oct 20, 2017
@linkmeyer linkmeyer added the priority: low Low impact/importance bug label Oct 23, 2017
nagineni pushed a commit to nagineni/zephyr that referenced this issue Nov 20, 2017
@nashif
Copy link
Member

nashif commented Feb 19, 2019

old issue, closing.

@nashif nashif closed this as completed Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants