I posted the same issues in PX4 Autopilot>Drivers but didn’t receive any reply and still have the problem. Hope somebody can help.
I have successfully build the PX4 code for Raspberry Pi 3 but have problem with IMU (MPU9250) connected to SPI.
First, I wanted to verify the SPI interface only and for that commented out sensors, GPS and telemetry other than the IMU startup in the config file…
mpu9250 start -s -R 2
~/px4 $ sudo ./bin/px4 -s px4_rpi.config
INFO [px4] assuming working directory is rootfs, no symlinks needed.
| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /| |
| | / /^\ \ ___ |
| / / |/
px4 starting.
INFO [px4] Calling startup script: /bin/sh px4_rpi.config 0
INFO [dataman] Unknown restart, data manager file ‘./dataman’ size is 11798680 bytes
WARN [SPI_I2C] UnknownApp: no instance started (no device on bus?)
INFO [commander] LED: open /dev/led0 failed (22)
INFO [mavlink] mode: Normal, data rate: 1000000 B/s on udp port 14556 remote port 14550
INFO [logger] logger started (mode=all)
INFO [px4] Startup script returned successfully
pxh> INFO [mavlink] using network interface wlan0, IP: 192.168.100.18
INFO [mavlink] with netmask: 255.255.255.0
INFO [mavlink] and broadcast IP: 192.168.100.255
pxh>
The MPU9250 on SPI failed to start and even manually starting it doesn’t work…
pxh> mpu9250 start -s -R 2
WARN [SPI_I2C] UnknownApp: no instance started (no device on bus?)
Command ‘mpu9250’ failed, returned -1.
pxh> mpu9250 status
INFO [SPI_I2C] Not running
Command ‘mpu9250’ failed, returned -1.
pxh>
I also tested the SPI with an example…
~ $ wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-3.10.y/Documentation/spi/spidev_test.c
~ $ gcc -o spidev_test spidev_test.c
~ $ ./spidev_test -D /dev/spidev0.0
spi mode: 4
bits per word: 8
max speed: 500000 Hz (500 KHz)
00 00 C2 CD E4 FB
AC 1D E9 C3 F8 F0
0F FC 00 6A 65 78
D7 D5 03 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00
This seems to detect at least something connected to SPI.
The wiring looks like this…
BTW the MPU9250 module has 5V to 3.3V regulator.