so that was the issue and I am able to get the example compiled correctly. I am still however unable to get the example code to work. I am using a sparkfun icm20948 breakout which I assume shouldnt be an issue. I can definitely see that it is responding through a spidevtest
root@orin:~/spidev-test# ./spidev_test /dev/spidev0.0 -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@....�..................�.
RX | 20 08 02 00 01 00 00 81 00 01 00 00 01 00 06 80 44 80 A0 90 20 00 00 00 08 90 3F FF FF FF FF FF | .......�.......�D���.....�?.....
root@orin:~/spidev-test# exit
exit
alex@orin:~$ cd ardupilot/build/nxflight/examples/
alex@orin:~/ardupilot/build/nxflight/examples$ ls
INS_generic
alex@orin:~/ardupilot/build/nxflight/examples$ sudo ./INS_generic
AP_InertialSensor startup...
INS: unable to initialise driver
TOGCS: INS: unable to initialise driver
And here is how the device is configured in the code
alex@orin:~/ardupilot$ git diff
diff --git a/libraries/AP_HAL/board/linux.h b/libraries/AP_HAL/board/linux.h
index 9ff5d25485..f01419346d 100644
--- a/libraries/AP_HAL/board/linux.h
+++ b/libraries/AP_HAL/board/linux.h
@@ -330,9 +330,10 @@
#define HAL_BOARD_TERRAIN_DIRECTORY "/home/alex/ardupilot/terrain"
#define HAL_BOARD_STORAGE_DIRECTORY "/home/alex/ardupilot"
#define HAL_PARAM_DEFAULTS_PATH "/home/alex/ardupilot.parm"
- #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
- #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
- #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(BMP280, "bmp280")
+ #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensensev2, "icm20948", ROTATION_NONE)
+ #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK09916, ICM20948, 0, ROTATION_NONE)
+ #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(BMP085, 1, 0x77)
+ //#define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(BMP280, "bmp280")
#define HAL_PROBE_EXTERNAL_I2C_COMPASSES
#else
diff --git a/libraries/AP_HAL_Linux/SPIDevice.cpp b/libraries/AP_HAL_Linux/SPIDevice.cpp
index a7a8c564c9..5d5587f760 100644
--- a/libraries/AP_HAL_Linux/SPIDevice.cpp
+++ b/libraries/AP_HAL_Linux/SPIDevice.cpp
@@ -152,7 +152,7 @@ SPIDesc SPIDeviceManager::_device[] = {
};
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NXFLIGHT
SPIDesc SPIDeviceManager::_device[] = {
- SPIDesc("mpu9250", 0, 0, SPI_MODE_3, 8, SPI_CS_KERNEL, 1*MHZ, 11*MHZ),
+ SPIDesc("icm20948", 0, 0, SPI_MODE_3, 8, SPI_CS_KERNEL, 1*MHZ, 11*MHZ),
SPIDesc("bmp280", 0, 1, SPI_MODE_3, 8, SPI_CS_KERNEL, 10*MHZ,10*MHZ),
};
#else
Not sure if I would be having these issues if I built a pcb with the modules so I wanted to test things with breakout boards first.