patterned sensor resets with last 3 dev releases

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
cass3825
Posts: 14
Joined: Thu Mar 31, 2011 3:09 am

patterned sensor resets with last 3 dev releases

Post by cass3825 »

I'm experiencing a patterned response from the FFIMU sensors, seen here: http://www.rcgroups.com/forums/attachment.php?attachmentid=4035022 This was not the case with V1_7, so I incorporated parts of the dev0519 sketch into V1_7 to make it compatible with the 0519 GUI. Sensor response is normal, as can be seen here: http://www.rcgroups.com/forums/attachment.php?attachmentid=4035023

Is anyone else seeing this type of sensor response with the dev code?

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: patterned sensor resets with last 3 dev releases

Post by ziss_dm »

Hi,
I think, same isuue was reported Here.

Can you try to put debug output to the checkStatusI2C() procedure, something like this:

Code: Select all

void checkStatusI2C() {
  if ( TW_STATUS  == 0xF8) { //TW_NO_INFO : this I2C error status indicates a wrong I2C communication.
    // WMP does not respond anymore => we do a hard reset. I did not find another way to solve it. It takes only 13ms to reset and init to WMP or WMP+NK
    TWCR = 0;
    POWERPIN_OFF //switch OFF WMP
    delay(1); 
    POWERPIN_ON  //switch ON WMP
    delay(10);
    Serial.println("Reset..");
    #if defined(GYRO)
    #else
      WMP_init(0);
    #endif
    neutralizeTime = micros(); //we take a timestamp here to neutralize the WMP or WMP+NK values during a short delay after the hard reset
  }
}


And how your sensors are powered up?

regards,
ziss_dm

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: patterned sensor resets with last 3 dev releases

Post by ziss_dm »

Hi Alex,
I have noticed, that re-initialization of the sensors after hard resed was removed from the dev version. Does that mean what we are not powering up i2c devices from D12? Do we need checkStatusI2C() at all, in case we do not have WMP attached?

regards,
ziss_dm

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: patterned sensor resets with last 3 dev releases

Post by Alexinparis »

Hi,

The re-initialization was limited only to the WMP, even in the previous versions.
checkStatusI2C() is still important because it allows TWCR = 0; which could help to re stabilize the bus.

I checked what could be wrong regarding I2C after the 1.7 version, and didn't find it yet.
But it's possible something is wrong somewhere as I reorganized a consequent code part.

cass3825
Posts: 14
Joined: Thu Mar 31, 2011 3:09 am

Re: patterned sensor resets with last 3 dev releases

Post by cass3825 »

ziss, my sensor board is powered from the Seeeduino Mega 5V pin.

Alex, thanks for looking into this! I will continue to integrate the dev code improvements into my 1_7mag test sketch, and will let you know if/when I find the offending section.

Billy

Centurian
Posts: 44
Joined: Sat Jan 22, 2011 10:55 am

Re: patterned sensor resets with last 3 dev releases

Post by Centurian »

Anyone figured this out yet?? Obviously will have to be fixed in the next full release

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: patterned sensor resets with last 3 dev releases

Post by Alexinparis »

Hi,
is it still the case with the release of yesterday ?

cass3825
Posts: 14
Joined: Thu Mar 31, 2011 3:09 am

Re: patterned sensor resets with last 3 dev releases

Post by cass3825 »

I'll download the latest revision this evening and report back.

Thank you Alex for your continued efforts. Your dedication is outstanding!

Billy

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: patterned sensor resets with last 3 dev releases

Post by KeesvR »

Look for yourself.
I am using:
-WM+ original
-BMA020
-HmC5883L
-BMP085
Attachments
Gui Dev 0526.jpg

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: patterned sensor resets with last 3 dev releases

Post by PatrikE »

I Have same problem with.
NK Acc.
Wmp
Baro
mag

cykelTime is only 4000 now.
Used to be 6000.

cass3825
Posts: 14
Joined: Thu Mar 31, 2011 3:09 am

Re: patterned sensor resets with last 3 dev releases

Post by cass3825 »

Unfortunately, no luck with dev0526. No response from sensors. Screenshot here: http://www.rcgroups.com/forums/attachment.php?attachmentid=4043189

Centurian
Posts: 44
Joined: Sat Jan 22, 2011 10:55 am

Re: patterned sensor resets with last 3 dev releases

Post by Centurian »

Alexinparis wrote:Hi,
is it still the case with the release of yesterday ?


Dev 5 26 appears to be much better. The frequency is down ~70-90%. I had to wait about 3 minutes to get 2 spikes on one gui screen as shown below. Previously almost every screen cycle had at least 1 and often as many as 3 spikes.

Note: to monitor cycle time altitudesmooth as been replaced with: serialize16((cycleTime-3500)/5);//dea was : serialize16(altitudeSmooth);
Note: LPF filter commented: //#define ACC_LPF_FACTOR 8 //dea

Configuration:
ProMini 326 5v
Original WMP
BMA020
gui.JPG

Config.h as tested:

Code: Select all

/*******************************/
/****CONFIGURABLE PARAMETERS****/
/*******************************/

/* Set the minimum throttle command sent to the ESC (Electronic Speed Controller)
   This is the minimum value that allow motors to run at a idle speed  */
//#define MINTHROTTLE 1300 // for Turnigy Plush ESCs 10A
#define MINTHROTTLE 1120 // for Super Simple ESCs 10A
//#define MINTHROTTLE 1190

/* The type of multicopter */
//#define GIMBAL
//#define BI
//#define TRI
//#define QUADP
#define QUADX
//#define Y4
//#define Y6
//#define HEX6
//#define HEX6X
//#define OCTOX8 //beta
//#define OCTOFLATP //beta
//#define OCTOFLATX //beta
//#define FLYING_WING //experimental

#define YAW_DIRECTION 1 // if you want to reverse the yaw correction direction
//#define YAW_DIRECTION -1

#define I2C_SPEED 100000L     //100kHz normal mode, this value must be used for a genuine WMP
//#define I2C_SPEED 400000L   //400kHz fast mode, it works only with some WMP clones

#define PROMINI  //Arduino type
//#define MEGA

//enable internal I2C pull ups
#define INTERNAL_I2C_PULLUPS

//****** advanced users settings   *************

/* Failsave settings - added by MIS
   Failsafe check pulse on THROTTLE channel. If the pulse is OFF (on only THROTTLE or on all channels) the failsafe procedure is initiated.
   After FAILSAVE_DELAY time of pulse absence, the level mode is on (if ACC or nunchuk is avaliable), PITCH, ROLL and YAW is centered
   and THROTTLE is set to FAILSAVE_THR0TTLE value. You must set this value to descending about 1m/s or so for best results.
   This value is depended from your configuration, AUW and some other params.
   Next, afrer FAILSAVE_OFF_DELAY the copter is disarmed, and motors is stopped.
   If RC pulse coming back before reached FAILSAVE_OFF_DELAY time, after the small quard time the RC control is returned to normal.
   If you use serial sum PPM, the sum converter must completly turn off the PPM SUM pusles for this FailSafe functionality.*/
//#define FAILSAFE                                  // Alex: comment this line if you want to deactivate the failsafe function
#define FAILSAVE_DELAY     10                     // Guard time for failsafe activation after signal lost. 1 step = 0.1sec - 1sec in example
#define FAILSAVE_OFF_DELAY 200                    // Time for Landing before motors stop in 0.1sec. 1 step = 0.1sec - 20sec in example
#define FAILSAVE_THR0TTLE  (MINTHROTTLE + 200)    // Throttle level used for landing - may be relative to MINTHROTTLE - as in this case


/* The following lines apply only for a pitch/roll tilt stabilization system
   It is not compatible with Y6 or HEX6 or HEX6X
   Uncomment the first line to activate it */
//#define SERVO_TILT
#define TILT_PITCH_MIN    1020    //servo travel min, don't set it below 1020
#define TILT_PITCH_MAX    2000    //servo travel max, max value=2000
#define TILT_PITCH_MIDDLE 1500    //servo neutral value
#define TILT_PITCH_PROP   10      //servo proportional (tied to angle) ; can be negative to invert movement
#define TILT_ROLL_MIN     1020
#define TILT_ROLL_MAX     2000
#define TILT_ROLL_MIDDLE  1500
#define TILT_ROLL_PROP    10

/* I2C gyroscope */
//#define ITG3200
//#define L3G4200D

/* I2C accelerometer */
//#define ADXL345
#define BMA020
//#define BMA180
//#define NUNCHACK  // if you want to use the nunckuk as a standalone I2C ACC without WMP

/* I2C barometer */
//#define BMP085

/* I2C magnetometer */
//#define HMC5843
//#define HMC5883

/* ADC accelerometer */ // for 5DOF from sparkfun, uses analog PIN A1/A2/A3
//#define ADCACC

/* The following lines apply only for specific receiver with only one PPM sum signal, on digital PIN 2
   IF YOUR RECEIVER IS NOT CONCERNED, DON'T UNCOMMENT ANYTHING. Note this is mandatory for a Y6 setup on a promini
   Select the right line depending on your radio brand. Feel free to modify the order in your PPM order is different */
//#define SERIAL_SUM_PPM         PITCH,YAW,THROTTLE,ROLL,AUX1,AUX2,CAMPITCH,CAMROLL //For Graupner/Spektrum
//#define SERIAL_SUM_PPM         ROLL,PITCH,THROTTLE,YAW,AUX1,AUX2,CAMPITCH,CAMROLL //For Robe/Hitec/Futaba
//#define SERIAL_SUM_PPM         PITCH,ROLL,THROTTLE,YAW,AUX1,AUX2,CAMPITCH,CAMROLL //For some Hitec/Sanwa/Others

/* The following lines apply only for Spektrum Satellite Receiver on MEGA boards only */
//#define SPEKTRUM

/* interleaving delay in micro seconds between 2 readings WMP/NK in a WMP+NK config
   if the ACC calibration time is very long (20 or 30s), try to increase this delay up to 4000
   it is relevent only for a conf with NK */
#define INTERLEAVING_DELAY 3000

/* for V BAT monitoring
   after the resistor divisor we should get [0V;5V]->[0;1023] on analog V_BATPIN
   with R1=33k and R2=51k
   vbat = [0;1023]*16/VBATSCALE */
//#define VBAT              // comment this line to suppress the vbat code
#define VBATSCALE     131 // change this value if readed Battery voltage is different than real voltage
#define VBATLEVEL1_3S 107 // 10,7V
#define VBATLEVEL2_3S 103 // 10,3V
#define VBATLEVEL3_3S 99  // 9.9V

/* when there is an error on I2C bus, we neutralize the values during a short time. expressed in microseconds
   it is relevent only for a conf with at least a WMP */
#define NEUTRALIZE_DELAY 100000

/* this is the value for the ESCs when thay are not armed
   in some cases, this value must be lowered down to 900 for some specific ESCs */
#define MINCOMMAND 1000

/* this is the maximum value for the ESCs at full power
   this value can be increased up to 2000 */
#define MAXTHROTTLE 1850

/* This is the speed of the serial interface. 115200 kbit/s is the best option for a USB connection.*/
#define SERIAL_COM_SPEED 115200

/* In order to save space, it's possibile to desactivate the LCD configuration functions
   comment this line only if you don't plan to used a LCD */
//#define LCD_CONF

/* to use Cat's whisker TEXTSTAR LCD, uncomment following line.
   Pleae note this display needs a full 4 wire connection to (+5V, Gnd, RXD, TXD )
   Configure display as follows: 115K baud, and TTL levels for RXD and TXD, terminal mode
   NO rx / tx line reconfiguration, use natural pins */
//#define LCD_TEXTSTAR

/* motors will not spin when the throttle command is in low position
   this is an alternative method to stop immediately the motors */
//#define MOTOR_STOP

/* some radios have not a neutral point centered on 1500. can be changed here */
#define MIDRC 1500

/* experimental
   camera trigger function : activated via Rc Options in the GUI, servo output=A2 on promini */
//#define CAMTRIG
#define CAM_SERVO_HIGH 2000  // the position of HIGH state servo
#define CAM_SERVO_LOW 1020   // the position of LOW state servo
#define CAM_TIME_HIGH 1000   // the duration of HIGH state servo expressed in ms
#define CAM_TIME_LOW 1000    // the duration of LOW state servo expressed in ms

/* you can change the tricopter servo travel here */
#define TRI_YAW_CONSTRAINT_MIN 1020
#define TRI_YAW_CONSTRAINT_MAX 2000
#define TRI_YAW_MIDDLE 1500

//****** end of advanced users settings *************

/**************************************/
/****END OF CONFIGURABLE PARAMETERS****/
/**************************************/


Thanks for your efforts, let me know if you need any more tests on this config.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: patterned sensor resets with last 3 dev releases

Post by Alexinparis »

Hi,

Thank you for this feedback.
I think I know where is the problem for timing. (one time variable was renamed wrongly from uint32_t to uint16_t)
At least this problem should be corrected in the last dev from today, it may have impact on other things.
I tested this one successfully with:
- a WMP only conf on a promini
- a WMP+NK conf on a promini
- a FFIMU on a mega board
- a FFIMU on a pro mini board

Could you please try it ?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: patterned sensor resets with last 3 dev releases

Post by PatrikE »

WMP+NK+Baro & MAG on a promini

I would say a little to unstable for a testflight..

/Patrik
Attachments
05929.png

Centurian
Posts: 44
Joined: Sat Jan 22, 2011 10:55 am

Re: patterned sensor resets with last 3 dev releases

Post by Centurian »

Alexinparis wrote:Hi,

Thank you for this feedback.
I think I know where is the problem for timing. (one time variable was renamed wrongly from uint32_t to uint16_t)
At least this problem should be corrected in the last dev from today, it may have impact on other things.
I tested this one successfully with:
- a WMP only conf on a promini
- a WMP+NK conf on a promini
- a FFIMU on a mega board
- a FFIMU on a pro mini board

Could you please try it ?


Alex,

The BMA020 data looks ok now, but I'm not getting any WMP data. I tired with and without BMA020 active and still no WMP gyro data. All gyro readings are zero and don't change. Had to go back to 1.7 to get the WMP working again, I could not get 5-26 to work with the 5-26 gui after loading 5-29. I'll double check to make sure I didn't cause the problem.

Thanks for the prompt support!

Doug

Centurian
Posts: 44
Joined: Sat Jan 22, 2011 10:55 am

Re: patterned sensor resets with last 3 dev releases

Post by Centurian »

I tried the 529dev on a WMP only set up and it works fine. Uploaded the exact sketch to the WMP & BMA020 board and get no gyro data with or without BMA020 active.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: patterned sensor resets with last 3 dev releases

Post by PatrikE »

Hi Alex
WMP gives normal data.
NB is showing crazy values.
Havn't tested WMP alone.

/Patrik

Centurian
Posts: 44
Joined: Sat Jan 22, 2011 10:55 am

Re: patterned sensor resets with last 3 dev releases

Post by Centurian »

PatrikE wrote:Hi Alex
WMP gives normal data.
NB is showing crazy values.
Havn't tested WMP alone.

/Patrik


Do you get good data on ver 1.7?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: patterned sensor resets with last 3 dev releases

Post by PatrikE »

Ver.1.7 works fine. But none of the last Devs.
The NB has not been detected. Or reset.

I think 0516 or 0519 was the last god for me.
Its the one i experimented with the baro in another thread.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: patterned sensor resets with last 3 dev releases

Post by PatrikE »

I found The reason why myNB went crazy...

It dosn't like this...

Code: Select all

#define I2C_SPEED 400000L   //400kHz fast mode, it works only with some WMP clones


After changing to 100000 it's normal again. :oops:

Summary...
Check ALL parameters in Config.h.
Something can be diffrent than last ver.

Keep up the god work Alex.

/Patrik

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: patterned sensor resets with last 3 dev releases

Post by ziss_dm »

Hi Alex,

In dev20110607 I have faced similar symptoms. But in my case it appears to be communication problem WMC->GUI. The packet size was significantly increased, but GUI was not adjusted. In my case this change looks like solved problem:

Code: Select all

  time1=millis();
  if (init_com==1) {
    if  (g_serial.available() >100) g_serial.clear();
    while (g_serial.available() > 95) processSerialData();
    if ((time1-time2)>100 && graph_on==1 && g_serial.available()<90) {
      g_serial.write('A');
      time2=time1;
    }
  }


regards,
ziss_dm

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: patterned sensor resets with last 3 dev releases

Post by Hamburger »

Hi,

just posted in another thread but it might fit here as well.
I found an error in arduino code processing serial communication between GUI and arduino which leads to spurious eeprom writes and acc calibration. Read here: http://wbb.multiwii.com/viewtopic.php?f=8&t=372
Maybe this is the cause of sensor resets as well? If so, then the fix is easy.

HTH Hamburger

Post Reply