# How to enable BLSP9 for SPI usage over J7?

Source: https://forum.modalai.com/topic/911/how-to-enable-blsp9-for-spi-usage-over-j7
Category: Flight Core and Legacy VOXL (https://forum.modalai.com/category/9/flight-core-and-legacy-voxl)
Tags: voxl-flight
Posted: 2022-05-04 17:56:48 UTC by jrestifo
Replies: 2 · Views: 589

## jrestifo · 2022-05-04 17:56:48 UTC

I have modified apq8096-imu-server to add another IMU, which is going to be connected to J7, using SPI (BLSP9). However, when I try and talk to this device in my code, I can see on my scope no activity. Is there something additional I need to do? 
I've modified:
common/voxl_imu_server.h - updated N_IMUS, added my IMU as IMU4
server/src/imu_interface.c - Added my IMU to imu_ic_t , added it to switch statements, etc
server/src/config_file.c - added IMU4 config entries

And of course implemented my code as per the existing IMUs. I am passing it as bus 9, as I believe this is supposed to map to BLSP9. But I cannot see anything being clocked, chip selects changing, etc...

## Reply by Alex Kushleyev (ModalAI staff) · 2022-05-04 19:40:24 UTC

Hello @jrestifo,

apq8096-imu-server (formerly voxl-imu-server) already had support for SPI imu on J7 (SPI9). That is IMU2 (where IMU0 and IMU1 are IMUs on VOXL itself). I plugged in MPU9250 into J7 via SPI, see below output:

```
/ # voxl-imu-server -b -i 2
enabling basic read instead of FIFO
Forcing imu2 on
loading calibration file
...
...
=================================================================
loading config file
=================================================================
imu0_enable:                     1
imu0_bus:                        10
imu0_sample_rate_hz:             1000.0
imu0_lp_cutoff_freq_hz:          92.0
imu0_rotate_common_frame         1
imu0_read_every_n_samples:       10

imu1_enable:                     1
imu1_bus:                        1
imu1_sample_rate_hz:             1000.0
imu1_lp_cutoff_freq_hz:          92.0
imu1_rotate_common_frame         1
imu1_read_every_n_samples:       10

aux_imu2_enable:                 0
aux_imu2_spi_bus:                9
aux_imu2_sample_rate_hz:         1000.0
aux_imu2_lp_cutoff_freq_hz:      92.0
aux_imu2_read_every_n_samples:   10

aux_imu2_enable:                 0
aux_imu2_spi_bus:                11
aux_imu2_sample_rate_hz:         1000.0
aux_imu2_lp_cutoff_freq_hz:      92.0
aux_imu2_read_every_n_samples:   10
=================================================================
Initializing IMU0
detected ICM42688 on spi bus[id] 10
using ODR=1000.00hz which is the nearest the icm42688 can get to 1000.0
Initializing IMU1
detected ICM20948 on spi bus[id] 1
using ODR=1125.00hz which is the nearest the icm20948 can get to 1000.0
Initializing IMU2
detected MPU9250 on spi bus[id] 9
using ODR=1000.00hz which is the nearest the mpu9250 can get to 1000.0
```
By the way, it looks like aux_imu2_* is mentioned twice in the config file printout, it is a bug.. 

to print out raw imu data...
```
voxl-imu-server -b -i 2 -p | grep imu2
```

Please try it out..

## Reply by jrestifo · 2022-05-04 22:35:59 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev 

So I have a BMI088 plugged in there, so I was adding IMU4 to not lose support for MPU as well. However, I did as you suggest as a sanity check, and yes I can see it trying to clock. I must have a problem somewhere else, thank you this was very helpful.
