Jump to content
I2Cdevlib Forums

unisev

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by unisev

  1. So I'm keeping my WatchDogTimer solution, this is satisfying me (328P reboot if no activity during 2s), and this is just adding 3 lines in the code : #include <avr/wdt.h> // NEWLINE : include WatchDogTimer arduino lib void setup() { wdt_enable(WDTO_2S); // NEWLINE : Activate the WTD with a 2S counter (before MPU init) mpu.initialize(); } void loop() { wdt_reset(); // NEWLINE : Prevent WatchDogTimer to reboot } There is another solution than "wdt_reset();" in the loop, you can deactivate WatchDogTimer at the end of setup section with "wdt_disable();".
  2. This solution is not working for me... but I found something : I think the freeze occur when you reboot the Arduino (for me it is a 328P) exactly at a precise moment, juste during another reboot that is not "complete". Maybe a I2C issue (for example a connection appear allready opened...)
  3. This is not working for me, the sketch still freeze sometimes, but now in this new code section (exactly at the Wire.endTransmission).
  4. I'm facing this, but first thing I'm trying to do is to detect this drift with the UNO, in order to prevent giving wrong values. EDIT : In your case, I think adding a compass-magnetometer (HMC5883 ?) is the best solution.
  5. I'm experiencing the initialize freeze, around 25% of time. I've treated it by adding a Watchdog Timer that reboot the 328P, if 2 seconds reached, but I'll try your fix.
  6. Hello, I know this has been discussed in several topic, but I really like to make it work. First thing I must know is : What should be the job of MPU-6050 as I2C master ?? take the compass value and keep it in a register ? that's all ? Here is the registery settings of the MPU6050 from the MultiWii code, in order to make it operate as master for compass : #if defined(MPU6050_I2C_AUX_MASTER) i2c_writeReg(MPU6050_ADDRESS, 0x6A, 0b00100000); //USER_CTRL -- DMP_EN=0 ; FIFO_EN=0 ; I2C_MST_EN=1 (I2C master mode) ; I2C_IF_DIS=0 ; FIFO_RESET=0 ; I2C_MST_RESET=0 ; SIG_COND_RESET=0 i2c_writeReg(MPU6050_ADDRESS, 0x37, 0x00); //INT_PIN_CFG -- INT_LEVEL=0; INT_OPEN=0; LATCH_INT_EN=0; INT_RD_CLEAR=0; FSYNC_INT_LEVEL=0; FSYNC_INT_EN=0; I2C_BYPASS_EN=0; CLKOUT_EN=0 i2c_writeReg(MPU6050_ADDRESS, 0x24, 0x0D); //I2C_MST_CTRL -- MULT_MST_EN=0 ; WAIT_FOR_ES=0 ; SLV_3_FIFO_EN=0 ; I2C_MST_P_NSR=0 ; I2C_MST_CLK=13 (I2C slave speed bus = 400kHz) i2c_writeReg(MPU6050_ADDRESS, 0x25, 0x80|MAG_ADDRESS); //I2C_SLV0_ADDR -- I2C_SLV4_RW=1 (read operation) ; I2C_SLV4_ADDR=MAG_ADDRESS i2c_writeReg(MPU6050_ADDRESS, 0x26, MAG_DATA_REGISTER); //I2C_SLV0_REG -- 6 data bytes of MAG are stored in 6 registers. First register address is MAG_DATA_REGISTER i2c_writeReg(MPU6050_ADDRESS, 0x27, 0x86); //I2C_SLV0_CTRL -- I2C_SLV0_EN=1 ; I2C_SLV0_BYTE_SW=0 ; I2C_SLV0_REG_DIS=0 ; I2C_SLV0_GRP=0 ; I2C_SLV0_LEN=3 (3x2 bytes) #endif Next step, take the value, again, here is the MultiWii code : void Device_Mag_getADC() { i2c_getSixRawADC(MPU6050_ADDRESS, 0x49); //0x49 is the first memory room for EXT_SENS_DATA MAG_ORIENTATION( ((rawADC[0]<<8) | rawADC[1]) , ((rawADC[4]<<8) | rawADC[5]) , ((rawADC[2]<<8) | rawADC[3]) ); } Am I on the right way ?
  7. Thank you janeppo, I finally found the problem, this was about the 14 byte packet synchronisation. Finally, the last trick to fix it was just to add ONE character in the information text send by the Arduino : This is not a real FIX but it works : The best way should be to re-think the Processing synchronising part.
  8. Hello, after taking a look to this video : http://www.google.fr/url?sa=t&source=web&cd=2&ved=0CDAQtwIwAQ&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DShdGoUaXMnc&ei=S5m3UZCVIYKxhAf6nYDQDA&usg=AFQjCNFDnE0eLVZEfWnN2C7f2c4VYmP2Iw&sig2=VOD23UV7V3FXoDaem7ZNjA I now understand there is no teapot... my only problem is the immobility of this "arrow plane" So let me give you more about my hardware : I'm using a "Drotek Flight Controller" originaly designed to be used with the MultiWii code : http://www.drotek.fr/shop/fr/home/72-multiwii-mpu6050-hmc5883-ms5611.html This little PCB contain : AtMega328P (& FTDI) MPU6050 gyro & accelerometer HMC5883 magnetometer MS5611 altimeter And currently don't know how those device are arranged, but it seems that the 328P is not connected to the INT pin of the MPU6050. Anyway, this "flight controller" is working well with the MPU6050_raw example. So let me give you more about my code : I did not modify the Processing code, except to use the right COM port, so let's talk about the Arduino Code : Since I have no interrupt PIN connected between the 328P and the MPU6050, I must modify the Arduino code at least here : // wait for MPU interrupt or extra packet(s) available while (!mpuInterrupt && fifoCount < packetSize) { // other program behavior stuff here // . // . // . // if you are really paranoid you can frequently test in between other // stuff to see if mpuInterrupt is true, and if so, "break;" from the // while() loop to immediately process the MPU data // . // . // . } Firstly I just removed all this "while loop", now the 328P is sending data to Processeing, but the "Arrow Plane" is still not moving.Does somebody can help ? PS : A also change in the MPU6050.h file this line from LOW to HIGH : #define MPU6050_DEFAULT_ADDRESS MPU6050_ADDRESS_AD0_LOW
  9. Hello and thank to Jeff Rowberg for your great work and those usefull examples. I'm trying to make those example codes working fine : The “MPU6050_raw” is ok. But the “MPU6050_DMP6” is not : 1) INTERRUPTION PIN : My interruption pin is not connected between MPU6050 & Atmega. (I’m using a all-in-one Drotek flight controller). Is it possible to change the wiring of the INT to another Arduino PIN (I mean, not the digital PIN2) ? If yes, where can I change this "parameter" in the code ? For the moment, and just to make it work, I simply supress the while loop... 2) PROCESSING RENDER : Here is my screen : As you can see, processing is receiving DATA, but this green thing does not look like a teapot. Thanks for reading this.
×
×
  • Create New...