I have designed a small copter myself. In my sensor design, I used a combination of the BMI088 and SPL06, which share the same SPI bus. During testing, I noticed it is very strange in the SPL06 sensor data(The data looks completely abnormal; both the temperature and pressure readings are erratic.). However, all sensors work perfectly under the same conditions when using the ArduPilot firmware(It can fly normally.).
After thorough investigation, I found that there is no mature hardware setup for driving the SPL06 via SPI in the PX4 firmware. Therefore, I have a question: has the SPI driver code for the SPL06 actually been verified in real-world practice?
I would greatly appreciate it if anyone could help clarify this. Below is my SPI bus configuration:
Hi @NSG-666, it would be best if you open a draft pull request to the PX4 GitHub repo so we can inspect your code, make sure you share a link to a log (https://logs.px4.io), this way we can help you debug; otherwise its going to be all guesses.
Hi rroche, thanks for your reply! Below is my software version information. I’ll try to submit a code pull request later (the main work on the local code is adding support for board-level hardware definition files, with no modifications to other parts of the code). Due to the barometer issue, actual flight testing hasn’t been carried out, so no actual flight log files have been generated yet. I’ll keep researching this.
I noticed that Ardupilot can independently set the respective operating frequencies and SPI modes for different devices on the same SPI bus, and PX4 can also pass in relevant parameters via startup commands. My question is: will the parameters set in PX4 overwrite each other, or can they each take effect for every individual sensor, I also try to use “spl06 -s -b 1 -f 1000 start” to slowdown for spl06, but the problem not gone.
Hi, rroche, I think I’ve found the root cause of the problem. It lies in this file(SPL06_SPI.cpp): the data buffer filled during SPI multi-byte read operations was misaligned.
After making the following modifications, all the data from the SPL06 sensor is now functioning correctly. This issue affects all flight controller hardware that uses SPI to read data from the SPL06 sensor: