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: Thu, 29 May 2014 13:15:01 +0200

Hi,

just <configure name="LISA_M_BARO" value="BARO_MS5611_SPI"/> is enough.

<define name="USE_BAROMETER" value="TRUE"/> is only needed if you want to use for altitude estimation in <subsystem name="ins" type="alt_float"/>.

<configure name="USE_BARO_BOARD" value="TRUE"/> is not really needed (since TRUE by default on boards like Lisa/M that have a baro).
Remove <define name="USE_SPI_SLAVE3"/> and the baro modules.

Cheers, Felix


On Thu, May 29, 2014 at 8:05 AM, afishindouban <address@hidden> wrote:
Hi buddy

baro_board.xml is not exist anymore ?
how can I use baro with Lisa M2 with asprin v2.2.  my altitude number get
crazy...

my airframe as below:

  <firmware name="fixedwing">

    <target name="ap"   board="lisa_m_2.0">

      <configure name="LISA_M_BARO" value="BARO_MS5611_SPI"/>
      <configure name="USE_BARO_BOARD" value="TRUE"/>
      <define name="USE_BAROMETER" value="TRUE"/>
      <define name="USE_SPI_SLAVE3"/>
      .....
    </target>

    .....

   <subsystem name="imu"           type="aspirin_v2.2"/>

    <load name="baro_ms5611_spi.xml">
      <define name="MS5611_SPI_DEV" value="spi2"/>
      <define name="MS5611_SLAVE_DEV" value="SPI_SLAVE3"/>
    </load>
    <load name="baro_board.xml">
      <define name="BARO_ABS_EVENT" value="BaroMs5611UpdatePressure"/>
    </load>



alonso acuña wrote
> This is working now. Pressure seems reasonable (I have no other sensor to
> confirm) but the altitude estimation is about 50m less than actual
> altitude.
>
> I was wondering why are there 2 files
> sw/airborne/modules/sensors/baro_ms5611_spi.c
> sw/airborne/subsystems/sensors/baro_ms5611_spi.c
>
> The first one appears to be the one running and the other one does not
> have
> the altitude calculation. I sent a pull request to add the altitude to the
> message but only changed the files in sw/airborne/modules/sensors/
>
>
>
>
> On Sat, Aug 31, 2013 at 1:01 PM, Felix Ruess &lt;

> felix.ruess@

> &gt; wrote:
>
>> Ah, and you need to enable the slave pin:
> <define name="USE_SPI_SLAVE3">
>> in the firmware section of your airframe file.
>>
>> I'm not really sure about how to provide nice defaults for this, since
>> this depends on your board, and even then you might want to connect an
>> external ms5611 on other pins...
>>
>>
>> On Sat, Aug 31, 2013 at 7:14 PM, Felix Ruess &lt;

> felix.ruess@

> &gt;wrote:
>>
>>> Hi Alonso,
>>>
>>> you seem to have removed
> <define name="MS5611_SLAVE_DEV"
>>
>> value="SPI_SLAVE3"/>, add it again.
>>> This defines the SlaveSelect line that used for the baro and it
>>> currently
>>> defaults to SPI_SLAVE0 which is not correct for the baro on
>>> LisaM/Aspirin2.2
>>>
>>> Cheers, Felix
>>>
>>>
>>> On Sat, Aug 31, 2013 at 6:59 PM, alonso acuña &lt;

> acuna007@

> &gt; wrote:
>>>
>>>> Hi. I have it like this
>>>>
> <load name="baro_ms5611_spi.xml">
>>>>
> <define name="MS5611_SPI_DEV" value="spi2"/>
>>>>
> <define name="SENSOR_SYNC_SEND"/>
>>>>
> </load>
>>>>
> <load name="baro_board.xml">
>>>>
> <define name="BARO_ABS_EVENT" value="BaroMs5611UpdatePressure"/>
>>>>
> </load>
>>>>
>>>> I am getting the BARO_RAW message but it always says 0,0
>>>> I also get BAR_MS5611 but d1 and d2 are always 16777215 , pressure is 0
>>>> and temp is 20.  Real temp was around 26 at the moment.
>>>>
>>>> baro_ms5611_alt is set to a crazy number and baro_ms5611_alt_valid is
>>>> set to TRUE. Perhaps there should be some more checks before
>>>> considering it
>>>> valid.  Also it would be nice to see this altitude in the message.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> On Fri, Aug 30, 2013 at 2:22 AM, Felix Ruess &lt;

> felix.ruess@

> &gt;wrote:
>>>>
>>>>> Hi Alonso,
>>>>>
>>>>> Sorry, forgot to update the new SPI version as well when we fixed the
>>>>> baro update event handlers.
>>>>> Should be fixed in master.
>>>>> Also the ms5611 is on spi2 on lisa/m, so
> <define name="MS5611_SPI_DEV"
>>
>>>> value="spi2"/>
>>>>>
>>>>> Cheers, Felix
>>>>>
>>>>>
>>>>> On Fri, Aug 30, 2013 at 2:20 AM, alonso acuña &lt;

> acuna007@

> &gt;wrote:
>>>>>
>>>>>> The error I get is
>>>>>>
>>>>>> firmwares/fixedwing/main_ap.c:653:49: error: macro
>>>>>> "BaroMs5611UpdatePressure" passed 2 arguments, but takes just 1
>>>>>>
>>>>>>
>>>>>> On Thu, Aug 29, 2013 at 6:13 PM, alonso acuña &lt;

> acuna007@

> &gt;wrote:
>>>>>>
>>>>>>> Hi. I am trying with
>>>>>>>
> <load name="baro_ms5611_spi.xml">
>>>>>>>
> <define name="MS5611_SPI_DEV" value="spi3"/>
>>>>>>>
> <define name="MS5611_SLAVE_DEV" value="SPI_SLAVE3"/>
>>>>>>>
> </load>
>>>>>>>
> <load name="baro_board.xml">
>>>>>>>
> <define name="BARO_ABS_EVENT" value="BaroMs5611UpdatePressure"/>
>>>>>>>
> </load>
>>>>>>>
>>>>>>> But I get :
>>>>>>>  arm-none-eabi-gcc: error: boards/lisa_m/baro_ms5611_spi.c: No such
>>>>>>> file or directory
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 28, 2013 at 8:26 AM, Felix Ruess &lt;

> felix.ruess@

> &gt;wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> the cleaned/improved code is merged into master now.
>>>>>>>> https://github.com/paparazzi/paparazzi/pull/515
>>>>>>>>
>>>>>>>> Cheers, Felix
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Aug 27, 2013 at 10:06 PM, Felix Ruess &lt;

> felix.ruess@

> &gt;>>>>>> > wrote:
>>>>>>>>
>>>>>>>>> Hi all, Rolf,
>>>>>>>>>
>>>>>>>>> I refactored the ms5611 code and made a proper reusable peripheral
>>>>>>>>> (and added a SPI version module).
>>>>>>>>> While already there I added a check for d1/d2 being zero,
>>>>>>>>> discarding the measurement if it's the case.
>>>>>>>>> So this problem should not occur anymore.
>>>>>>>>>
>>>>>>>>> This stuff is currently in the baro_peripherals branch.
>>>>>>>>>   git remote update
>>>>>>>>>   git checkout baro_peripherals
>>>>>>>>> Some tests of this would be very much appreciated since I don't
>>>>>>>>> actually have the sensor...
>>>>>>>>>
>>>>>>>>> Cheers, Felix
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thu, Apr 18, 2013 at 8:12 AM, "Rolf Nöllenburg" <
>>>>>>>>>

> sha_maniac@

>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Felix,
>>>>>>>>>>
>>>>>>>>>> I still have the problem of broken d2s from time to time, but I'm
>>>>>>>>>> flying with the dirty workaround I described a few mails ago. It
>>>>>>>>>> works ok
>>>>>>>>>> for the moment as it takes a look at the current value of d2 and
>>>>>>>>>> replaces
>>>>>>>>>> it with the previous one, if it seems to be broken. In case of a
>>>>>>>>>> replacement, a counter increases by one so I'm able to track the
>>>>>>>>>> events. It
>>>>>>>>>> occures randomly but I have often flights with at least one event
>>>>>>>>>> and in
>>>>>>>>>> one flight of about 25 minutes I saw 12 events in the log.
>>>>>>>>>>
>>>>>>>>>> As you see, I don't have a solution which is pushable and I
>>>>>>>>>> didn't
>>>>>>>>>> have taken the time to search the cause of the problem so far. I
>>>>>>>>>> also never
>>>>>>>>>> tried it on master branch.
>>>>>>>>>>
>>>>>>>>>> As no one else seems to have this problem, it could be a hard-
>>>>>>>>>> and
>>>>>>>>>> software specific problem of my setup. Anyway, I'll give an
>>>>>>>>>> update when I
>>>>>>>>>> have found the source of the problem.
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Rolf
>>>>>>>>>>
>>>>>>>>>> *Gesendet:* Mittwoch, 17. April 2013 um 11:02 Uhr
>>>>>>>>>> *Von:* "Felix Ruess" &lt;

> felix.ruess@

> &gt;
>>>>>>>>>> *An:* "Paparazzi devel list" &lt;

> paparazzi-devel@

> &gt;
>>>>>>>>>>
>>>>>>>>>> *Betreff:* Re: [Paparazzi-devel] Critical behaviour of
>>>>>>>>>> baro_ms5611_i2c
>>>>>>>>>>    Hi Rolf,
>>>>>>>>>>
>>>>>>>>>> what is the status on this?
>>>>>>>>>> If this needs to be fixed in v4.2 please let us know, or even
>>>>>>>>>> better make a pull request with the fix on github ;-)
>>>>>>>>>> Did you also run long tests for the code in master?
>>>>>>>>>>
>>>>>>>>>> It's really important that problems like this get properly fixed
>>>>>>>>>> in the main Paparazzi repository.
>>>>>>>>>> But for that to become a reality we need the help from all of you
>>>>>>>>>> to get the fixes back (not enough if you have them locally fixed
>>>>>>>>>> for you).
>>>>>>>>>> There are so many drivers and combinations supported that not
>>>>>>>>>> everything can be tested by the few core committers we have.
>>>>>>>>>>
>>>>>>>>>> Cheers, Felix
>>>>>>>>>>
>>>>>>>>>> On Mon, Feb 4, 2013 at 1:21 PM, "Rolf Nöllenburg" <
>>>>>>>>>>

> R.Noellenburg@

>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> My observations:
>>>>>>>>>>> I made a static 200 minute test yesterday and no glitches of d2
>>>>>>>>>>> occurred.
>>>>>>>>>>> Last friday I had seven glitches in 170 minutes on the bench.
>>>>>>>>>>> Some randomly chosen flightlogs of the last four months revealed
>>>>>>>>>>> 3 glitches in 355 minutes.
>>>>>>>>>>>
>>>>>>>>>>> The flights were carried out with an old height calculation
>>>>>>>>>>> where
>>>>>>>>>>> estimator_z recovered (peaks: ground_alt+2500m ->
>>>>>>>>>>> ground_alt-380m -> normal
>>>>>>>>>>> height within 2 seconds) and only led to a short but intense
>>>>>>>>>>> "bow". I don't
>>>>>>>>>>> want to know what the plane would have done with
>>>>>>>>>>> estimator_z=nan.
>>>>>>>>>>>
>>>>>>>>>>> My conclusion so far: these glitches do occur but at rare
>>>>>>>>>>> intervals - at least with my setup. My previously mentioned
>>>>>>>>>>> interval of
>>>>>>>>>>> once in 20 minutes was way to pessimistic, sorry for that.
>>>>>>>>>>>
>>>>>>>>>>> @michal: I'll have a closer look to your code, thank you for
>>>>>>>>>>> that
>>>>>>>>>>> hint.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -------- Original-Nachricht --------
>>>>>>>>>>> > Datum: Sat, 2 Feb 2013 18:53:59 -0200
>>>>>>>>>>> > Von: Eduardo lavratti &lt;

> agressiva@

> &gt;
>>>>>>>>>>> > An: Paparazzi developer forum &lt;

> paparazzi-devel@

> &gt;
>>>>>>>>>>> > Betreff: Re: [Paparazzi-devel] Critical behaviour of
>>>>>>>>>>> baro_ms5611_i2c
>>>>>>>>>>>
>>>>>>>>>>> >
>>>>>>>>>>> > HUmmmm i am using ppz v4.2 +yapa + ms5611.
>>>>>>>>>>> > I made 5x 45~55min flight this week without any problem with
>>>>>>>>>>> baro.
>>>>>>>>>>>  > Date: Sat, 2 Feb 2013 09:28:17 -0700
>>>>>>>>>>> > From:

> address@hidden

>>>>>>>>>>> > To:

> paparazzi-devel@

>>>>>>>>>>> > Subject: Re: [Paparazzi-devel] Critical behaviour of
>>>>>>>>>>> baro_ms5611_i2c
>>>>>>>>>>> >
>>>>>>>>>>> > Hi Rolf,
>>>>>>>>>>> >
>>>>>>>>>>> > i think this glitch can occur when you are asking for D2 value
>>>>>>>>>>> before the
>>>>>>>>>>> > conversion is done. I ran to it when I was writing ms5611
>>>>>>>>>>> drivers for
>>>>>>>>>>> > master branch. It helped to slightly rearrange the periodic
>>>>>>>>>>> and
>>>>>>>>>>> event functions
>>>>>>>>>>> > (see
>>>>>>>>>>> >
>>>>>>>>>>> https://github.com/paparazzi/paparazzi/blob/master/sw/airborne/boards/lisa_m/baro_board_i2c.c).
>>>>>>>>>>> It was written for Lisa M 2.0, but might be
>>>>>>>>>>> > useful for yapa too.
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > The longest I ran barometer continuously was for like 35
>>>>>>>>>>> minutes and no
>>>>>>>>>>> > glitch occurred.
>>>>>>>>>>> >
>>>>>>>>>>> > Btw if the estimator cannot handle NaN values, probably the
>>>>>>>>>>> estimator code
>>>>>>>>>>> > should be fixed, rather than "outlier removal" in baro code -
>>>>>>>>>>> what if the
>>>>>>>>>>> > sensor stops working during the flight etc...
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > Hope it helps.
>>>>>>>>>>> >
>>>>>>>>>>> > M
>>>>>>>>>>> >
>>>>>>>>>>> > On Sat, Feb 2, 2013 at 6:08 AM, "Rolf Nöllenburg" <
>>>>>>>>>>>

> sha_maniac@

>>
>>>>>>>>>>> > wrote:
>>>>>>>>>>> >
>>>>>>>>>>> > Hi
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > I just discovered a severe problem (luckily on the desk) with
>>>>>>>>>>> the module
>>>>>>>>>>> > baro_ms5611_i2c: the communication via i2c can get faulty
>>>>>>>>>>> which
>>>>>>>>>>> leeds to
>>>>>>>>>>> > estimator_z = nan and it DOES NOT RECOVER!!!
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > This happens not very often, approx. once in 20 min.
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > I think that the problem is starts with a zero in D2. This
>>>>>>>>>>> leads to
>>>>>>>>>>> > messages in the log-file like the following:
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.155 11 ESTIMATOR 1.195065 0.513844
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.174 11 BARO_MS5611 7803588 8440836 1001.38 38.9
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.269 11 BARO_MS5611 7803430 0 -2230.73 -242.71
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.369 11 BARO_MS5611 7803606 8440764 1001.38 38.89
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.397 11 ESTIMATOR nan nan
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.465 11 BARO_MS5611 7803424 8440874 1001.34 38.9
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.566 11 BARO_MS5611 7803488 8440640 1001.34 38.89
>>>>>>>>>>> >
>>>>>>>>>>> > 2174.684 11 ESTIMATOR nan nan
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > A pressure of -2230.73 is obviously too much (or little) for
>>>>>>>>>>> the hight
>>>>>>>>>>> > calculation...
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > My system:
>>>>>>>>>>> >
>>>>>>>>>>> > - Paparazzi version v4.2.0_stable-5-gc3a1496-dirty
>>>>>>>>>>> >
>>>>>>>>>>> > - YAPA 2
>>>>>>>>>>> >
>>>>>>>>>>> > - Drotek IMU (mpu6050, hms5883, ms5611) on i2c1
>>>>>>>>>>> >
>>>>>>>>>>> > -
>>>>>>>>>>> PERIODIC_FREQUENCY=AHRS_PROPAGATE_FREQUENCY=AHRS_CORRECT_FREQUENCY=60Hz
>>>>>>>>>>> >
>>>>>>>>>>> > - baro_ms5611_periodic=baro_ms5611_d1=baro_ms5611_d2=10Hz
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > I am working on a fix via something like this starting in line
>>>>>>>>>>> 211 of
>>>>>>>>>>> > baro_ms5611_i2c.c:
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >       /* avoid glitches in d2
>>>>>>>>>>> >
>>>>>>>>>>> >       if (ms5611_d2 < 1000000) {
>>>>>>>>>>> >
>>>>>>>>>>> >         ms5611_d2 = ms5611_d2_prev;
>>>>>>>>>>> >
>>>>>>>>>>> >       } else {
>>>>>>>>>>> >
>>>>>>>>>>> >         ms5611_d2_prev = ms5611_d2;
>>>>>>>>>>> >
>>>>>>>>>>> >       }
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > I tried this with a fixed replacement-value of 7000000 instead
>>>>>>>>>>> of
>>>>>>>>>>> > ms5611_d2_prev and it looks promising (estimator_z jumps to
>>>>>>>>>>> about 200m and recovers
>>>>>>>>>>> > within 1 second). I just need some testing ...
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> > _______________________________________________
>>>>>>>>>>> >
>>>>>>>>>>> > Paparazzi-devel mailing list
>>>>>>>>>>> >
>>>>>>>>>>> >

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

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

> Paparazzi-devel@

> https://lists.nongnu.org/mailman/listinfo/paparazzi-devel





--
View this message in context: http://lists.paparazziuav.org/Critical-behaviour-of-baro-ms5611-i2c-tp11592p15559.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]