Hi there,
i have built a custom board in devicetree. I have based it off the nrf52840DK dts but added in a magnetometer:
s3_mini_v1.dts
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2017 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "s3_mini_v1-pinctrl.dtsi"
/ {
model = "Nordic nRF52840 DK NRF52840";
compatible = "nordic,nrf52840-dk-nrf52840";
chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0;
zephyr,bt-c2h-uart = &uart0;
zephyr,sram = &sram0;
i am attempting to configure the magnetometer, however when ever i try to get the device instance for the magnetometer, i receive the following error at compilation.
Fullscreen
1
\lsm303agr_m\src\main.c:120: undefined reference to `__device_dts_ord_127'
This only happens when i call any functions that require me to pass a device instance. I have tried referencing the magnetometer with different macros, but this has not fixed the issue. i can also return parameters such as 'label' or 'status' from the magnetometer but i cannot get the device instance. if i comment out the line:
if (!device_is_ready(m_lsm_dev))
and also:
i2c_reg_read_byte(m_lsm_dev, LSM_TWI_ADDR, 0X1E, &data);
then it will compile.
main.c:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/devicetree.h>
#include <zephyr/kernel.h>
#include "lsm303agr_reg.h"
#include <zephyr/logging/log.h>
#include <zephyr/device.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/util.h>
#include <inttypes.h>
#include <stdlib.h>
LOG_MODULE_REGISTER(foo, CONFIG_LOG_DEFAULT_LEVEL);
#define DT_DRV_COMPAT nordic_nrf_twi
#define DT_I2C0_N DT_PATH(soc, i2c_40003000)
//#define gpio DT_PROP(DT_CHILD(LABEL, lsm303agr), label)
thank you in advance.