Connect MPU6050 on linux board

Hi,

I have MPU6050 module and I tested that it works via different scripts and I got get the Gyro and Acc measurements. it really works fine.

I connected MPU6050 (with address 0x68) via I2C to my Pi_4 board.

I tried to modify the code for OBAL board in : libraries/AP_HAL/board/linux.h

#define HAL_INS_PROBE_LIST PROBE_IMU_I2C(Invensense, 0, 0x68, ROTATION_NONE)`

I used mission planner to check the MAV link inspector for IMU RAW data but it was empty. I also checked the HW ID and it was also empty.


I also modified “libraries/AP_HAL_Linux/SPIDevice.cpp” by commenting the following lines:

//#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OBAL_V1 && \
//    defined (HAL_BOARD_SUBTYPE_LINUX_OBAL_V1_MPU_9250_SPI)
//SPIDesc SPIDeviceManager::_device[] = {
//    SPIDesc("mpu9250",    0, 0, SPI_MODE_3, 8, SPI_CS_KERNEL,  1*MHZ, 10*MHZ),
//};
//#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OBAL_V1 && \
//    defined (HAL_BOARD_SUBTYPE_LINUX_OBAL_V1_GY_91_SPI)
//SPIDesc SPIDeviceManager::_device[] = {
//    SPIDesc("mpu9250",    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),
//};

your help is highly appreciated.

what is the output when you run ardupilot in command prompt ?

compass not found ??

here it is :

 $ sudo /home/pi/arducopter -A udp:192.168.0.232:14550:bcast
RPI 4
WARNING: deprecated option --uartA/-A will be removed in a future release. Use --serial0 instead.
Config Error: Baro: unable to initialise driver
Config Error: Baro: unable to initialise driver
Config Error: Baro: unable to initialise driver
Config Error: Baro: unable to initialise driver
Config Error: Baro: unable to initialise driver

try:
#define ALLOW_ARM_NO_COMPASS
#define HAL_BARO_ALLOW_INIT_NO_BARO

Many thanks. It works now. Wowww.

I added in libraries/AP_HAL/board/linux.h:

#define ALLOW_ARM_NO_COMPASS
#define HAL_BARO_ALLOW_INIT_NO_BARO

and modified this line to use I2C bus “1”

#define HAL_INS_PROBE_LIST PROBE_IMU_I2C(Invensense, 1, 0x68, ROTATION_NONE)`
1 Like