-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add support for SPL07_003 barometer - based on DPS310 #13427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SPL07_003 barometer - based on DPS310 #13427
Conversation
Do you want to test this code? You can flash it directly from Betaflight Configurator:
WARNING: It may be unstable. Use only for testing! |
8a19f75
to
9f22036
Compare
SPA006_003 uses longer polynom for calibration, c21 and c40 must be added. And used in calculation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coefs are still missing in calculation
if (!busReadBuf(dev, DPS310_REG_COEF, coef, READ_LENGTH)) { | ||
return false; | ||
} | ||
if (!busReadBuf(dev, DPS310_REG_COEF + READ_LENGTH, coef + READ_LENGTH, COEFFICIENT_LENGTH - READ_LENGTH)) { | ||
if (!busReadBuf(dev, DPS310_REG_COEF + READ_LENGTH, coef + READ_LENGTH, COEFFICIENT_LENGTH - READ_LENGTH)) { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (unsigned i = 0; i < sizeof(coef); ) {
int chunk = MIN(9, sizeof(coef) - i);
if (!busReadBuf(dev, DPS310_REG_COEF + i, coef + i, chunk) {
return false;
}
i += chunk;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of 9 we need READ_LENGTH (COEFFICIENT_LENGTH / 2) ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It seems someone decided reading all 18 bytes is too much. So it was split into 2 chunks.
IMO it is pretty arbitrary and reading all bytes shall work, but it is safer to keep tested readout mechanism.
c31 and c40 only applies to the new chip ID. |
baroState.pressure = c00 + Praw_sc * (c10 + Praw_sc * (c20 + Praw_sc * c30)) + Traw_sc * c01 + Traw_sc * Praw_sc * (c11 + Praw_sc * c21); SPA006_003 uses polynomials with higher order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor style comments
These were some notes I made previously: The SLP06-007 reports Product and Revision ID of 0x10, which exactly is the same as the DPS310, and has the same number of registers for the calibration coefficients. This is why it often is reported as the DPS310 in our code when we check status. I wonder if the reason we have issues with the temperature values reported by SPL06's is because their coefficients are not being retrieved correctly, when considered as being DPS310's? The SPL07 reports Product and Revision ID of 0x11, different from the DPS310. Compared to the SPL06 it has similar accuracy at a higher sample rate (200Hz). The SPL06 hasn't been a great performer. We specifically need to know if the SPL07 reports temperature more accurately, to improve pressure accuracy with temperature change. SPL06 is awful in that respect. I'm a big fan of the newer Infineon DPS368. |
ad SPL06-007: You can try dumping coefficients, maybe there is some inconsistency ... |
@haslinghuis was the temperature of the board likely to be 41.27 degrees when tested? PS: if the altitude was just being lifted up and down in relation to when powered up, it's a VERY clean altitude trace - far better than the BMP280 in terms of noise! |
@ctzsnooze Yes had lifted the board up and down 3 times in a row :) Did some bench testing. Room temp is 19 °C. Temp of the speedybee f405mini was around 65 °C. Using a fan it comes down.
|
d6ee352
to
218b342
Compare
Did some more intensive testing over time. Rebased on master and added a commit to be more explicit on the new chip added. Original DPS310 is now not affected by this change in any way as altitude reading on DPS310 was affected (where altitude keeps rising with temperature) - so Goertek added coef calculation seems wrong for DPS310!!! This is now solved. |
218b342
to
06ac241
Compare
that's strange. the new coefs were set to 0, so the calculation should not change for DPS310.. |
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving -- i'll leave the testing and technicalities to ya'll, but the code looks fair to me.
I've explained the temperature compensation issue with these Goertek Baro's many times. The 'real' Infineon-branded DPS310 chips have individualised calibration factors - for every individual chip they produce - for both pressure and temperature they flash individual cal values to the chip. As a result, the absolute temperature recorded by the chip is exceedingly accurate. Every single 'real' Infineon DPS310 will record room temperature very accurately. It is likely that the delta coefficient is also individualised, sine the real Infineon version does not drift with temperature. Hence it is essential that if the chip really is an Infineon DPS310 then we need to use the coefficients provided by the chip. The 'clone' Goertek chips do not individualise their temperature sensor coefficients during manufacturing. That's why we see bizarre absolute room temperature readings, eg -9C, or +40C, in your case, 11 deg C when at room temperature. It is likely that the delta coefficient is also not individualised because we often see significant drift with temperature with these devices.q That's why I strongly advocate that manufacturers should use the real Infineon product. OK sure the DPS310 is out of production, but it has been superseded by an even better DPS368 with identical pinouts and coding - it's a drop-in replacement with about twice the resolution and half the noise. I'm not certain we should approve this PR until it is checked against boards with real Infineon DPS310's, to ensure that their temperature measurements are accurate and that thermal stability is good. And we should ensure that a real Infineon DPS360 will work. |
The SPA06-003 driver is now supported in the master. Do you have a plan for when it will be released in Tag version? |
We will have a final release candidate first. |
@amaygoermicro final release is here: https://github.com/betaflight/betaflight/releases/tag/4.5.0 |
Uh oh!
There was an error while loading. Please reload this page.