paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] Critical behaviour of baro_ms5611_i2c


From: Felix Ruess
Subject: Re: [Paparazzi-devel] Critical behaviour of baro_ms5611_i2c
Date: Tue, 24 Jun 2014 23:31:06 +0200

Nevermind, quickly did that: https://github.com/paparazzi/paparazzi/pull/758
Would be great if you could test that again (although I don't see a reason why it should not work).
Wondering if we should add an error counter for this so we can find out how often this happens (and maybe get to the core of the problem).


On Tue, Jun 24, 2014 at 11:16 PM, Felix Ruess <address@hidden> wrote:
Hi,

we add bounds like that, but we should probably discard the measurement if this happens and not simply leave the old value...
Could you plz make a pull request for this?

Cheers, Felix


On Mon, Jun 23, 2014 at 5:13 AM, afishindouban <address@hidden> wrote:
Hi Felix

I can not find the reason, I think it is the bug of MS5611, maybe its read
when the data is not ready. Anyway simple add a checker in the  ms5611.c
<https://github.com/paparazzi/paparazzi/blob/master/sw/airborne/peripherals/ms5611.c>
solve the problem.  the checker is reasonable and works in any case, the
range is from  MS5611 document
<http://www.meas-spec.com/downloads/MS5611-01BA03.pdf>  .

So would you like to include it into master?
here is the modified ms5611_calc()

void ms5611_calc(struct Ms5611Data* ms) {
  int64_t dt, tempms, off, sens, t2, off2, sens2, p;

  /* difference between actual and ref temperature */
  dt = ms->d2 - (int64_t)ms->c[5] * (1<<8);
  /* actual temperature */
  tempms = 2000 + ((int64_t)dt * ms->c[6]) / (1<<23);
  /* offset at actual temperature */
  off = ((int64_t)ms->c[2] * (1<<16)) + ((int64_t)ms->c[4] * dt) / (1<<7);
  /* sensitivity at actual temperature */
  sens = ((int64_t)ms->c[1] * (1<<15)) + ((int64_t)ms->c[3] * dt) / (1<<8);
  /* second order temperature compensation */
  if (tempms < 2000) {
    t2 = (dt*dt) / (1<<31);
    off2 = 5 * ((int64_t)(tempms-2000)*(tempms-2000)) / (1<<1);
    sens2 = 5 * ((int64_t)(tempms-2000)*(tempms-2000)) / (1<<2);
    if (tempms < -1500) {
      off2 = off2 + 7 * (int64_t)(tempms+1500)*(tempms+1500);
      sens2 = sens2 + 11 * ((int64_t)(tempms+1500)*(tempms+1500)) / (1<<1);
    }
    tempms = tempms - t2;
    off = off - off2;
    sens = sens - sens2;
  }

  p = (((int64_t)ms->d1 * sens) / (1<<21) - off) / (1<<15);
  if ((tempms > -4000) && (tempms < 8500) && (p > 1000 ) && (p < 120000)) {
    /* temperature in deg Celsius with 0.01 degC resolultion */
    ms->temperature = (int32_t)tempms;
    /* temperature compensated pressure in Pascal (0.01mbar) */
    ms->pressure = (uint32_t)p;
  }
}

And here is the test result.

<http://lists.paparazziuav.org/file/n15720/47.png>



flixr wrote
> Hi,
>
> Would be great if you could dig a bit further! Add
> <define name="DEBUG"
> value="TRUE"/>
>  to your firmware section and have a look at the BARO_MS5611
> message that is sent with every measurement from the baro board wrapper
> &lt;https://github.com/paparazzi/paparazzi/blob/master/sw/airborne/boards/baro_board_ms5611_spi.c&gt;.
> That should help to narrow down the problem, e.g. if D1 or D2 is suddenly
> very large.
>
> If you want to add additional checks to the ms5611 peripheral, add them in
> sw/airborne/peripherals/ms5611_spi.c
> &lt;https://github.com/paparazzi/paparazzi/blob/master/sw/airborne/peripherals/ms5611_spi.c&gt;
>
> Cheers, Felix





--
View this message in context: http://lists.paparazziuav.org/Critical-behaviour-of-baro-ms5611-i2c-tp11592p15720.html
Sent from the paparazzi-devel mailing list archive at Nabble.com.

_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]