when config 'CONFIG_BMA280=y' in 'prj.conf' file,but Solution 'build' not compiled,the code 'bma280.c' also not included in the project,why???
when config 'CONFIG_BMA280=y' in 'prj.conf' file,but Solution 'build' not compiled,the code 'bma280.c' also not included in the project,why???
explain:
CONFIG_SENSOR=y
CONFIG_ACCEL_USE_SIM=n
CONFIG_ACCEL_USE_EXTERNAL=y
Hi meqyj,
Please follow the tutorial: https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-3-temporary#h79sk0f70607qwcyitkx2xn61bmh9mo
The configurations are explained here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/CONFIG_SENSOR.html#cmdoption-arg-config-sensor
Hi sir:
Can you provide a sample programs about I2C?
static int i2c_nrfx_twim_transfer(struct device *dev, struct i2c_msg *msgs,
u8_t num_msgs, u16_t addr)
{
int ret = 0;
k_sem_take(&(get_dev_data(dev)->transfer_sync), K_FOREVER);
nrfx_twim_enable(&get_dev_config(dev)->twim);
for (size_t i = 0; i < num_msgs; i++) {
if (I2C_MSG_ADDR_10_BITS & msgs[i].flags) {
ret = -ENOTSUP;
break;
}
nrfx_twim_xfer_desc_t cur_xfer = {
.p_primary_buf = msgs[i].buf,
.primary_length = msgs[i].len,
.address = addr,
.type = (msgs[i].flags & I2C_MSG_READ) ?
NRFX_TWIM_XFER_RX : NRFX_TWIM_XFER_TX
};
LOG_INF("i2c device transfer: %x,%x", *msgs[i].buf, addr);
nrfx_err_t res = nrfx_twim_xfer(&get_dev_config(dev)->twim,
&cur_xfer,
(msgs[i].flags & I2C_MSG_STOP) ?
0 : NRFX_TWIM_FLAG_TX_NO_STOP);
LOG_INF("i2c device ret: %d", res);
if (res != NRFX_SUCCESS) {
if (res == NRFX_ERROR_BUSY) {
ret = -EBUSY;
break;
} else {
ret = -EIO;
break;
}
}
k_sem_take(&(get_dev_data(dev)->completion_sync), K_FOREVER);
res = get_dev_data(dev)->res;
if (res != NRFX_SUCCESS) {
LOG_ERR("Error %d occurred for message %d", res, i);
ret = -EIO;
break;
}
}
nrfx_twim_disable(&get_dev_config(dev)->twim);
k_sem_give(&(get_dev_data(dev)->transfer_sync));
return ret;
}
=======================================
look at here pls:
LOG_INF("i2c device transfer: %x,%x", *msgs[i].buf, addr);
It show that reg & addr is ok,but the result is that:
LOG_ERR("Error %d occurred for message %d", res, i);
https://github.com/sigurdnev/fw-nrfconnect-nrf/tree/master/samples/nrf9160/i2c_scanner
here is a sample for a I2C scanner