Jump to content
I2Cdevlib Forums

briantee

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

1,176 profile views

briantee's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Do you have an uno board to try? Did you try both the raw and DMP code examples and does it stop there on both? Then definitely and I2C issue. Are you sure you are hooked to the correct SDA and SDC lines? Never used the mega before, but do a search on which lines to use. Seems there was some talk about that.pin 21 and 20 i think If you don't have an uno, grab one to learn on. Everything (sketches) works on that board and when you get used to it, then go to different ones. The little things will drive you crazy while learning and probably spoil the experience that is arduino. The chip is replaceable, you can make breadboards from the 328p, etc. Have fun not frustration. Just my $.02. The program stops there because its not getting back from the IMU the "who am i" byte. So it definitely is your I2C. Do you have another I2C device you could try also to confirm you are communicating?
  2. First off, thank you for an awesome library. Running low on space in the atmega328 so streamlining code and came across the following nuances Taken right from the example that comes with the libraries, MPU6050_DMP6.INO i was wondering why? 1. During setup, this line occurs: mpu.initialize(); followed by this line: devStatus = mpu.dmpInitialize(); Which resets the device and changes any configs set by the the first initialize(). The first initialize line can be commented out completely and functions the same. Is it req'd at all? 2. In the motion_apps.h this line occurs many times and i was wondering why? for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); The code is exactly the same, in fact deleting the whole section of dmpupdates, resets, enables etc seems to have no effect on operation. Was curious as to why the above statement is repeated exactly with the same data many times. Thanks in advance. I'm just looking to save some compiled code space. uint8_t dmpUpdate[16], j; uint16_t pos = 0; for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); /* for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); */ resetFIFO(); uint16_t fifoCount = getFIFOCount(); uint8_t fifoBuffer[128]; getFIFOBytes(fifoBuffer, fifoCount); setFIFOEnabled(true); setDMPEnabled(true); resetDMP(); /* for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); while ((fifoCount = getFIFOCount()) < 3); getFIFOBytes(fifoBuffer, fifoCount); uint8_t mpuIntStatus = getIntStatus(); for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); readMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); while ((fifoCount = getFIFOCount()) < 3); getFIFOBytes(fifoBuffer, fifoCount); //mpuIntStatus = getIntStatus(); for (j = 0; j < 4 || j < dmpUpdate[2] + 3; j++, pos++) dmpUpdate[j] = pgm_read_byte(&dmpUpdates[pos]); writeMemoryBlock(dmpUpdate + 3, dmpUpdate[2], dmpUpdate[0], dmpUpdate[1]); */ //setDMPEnabled(false); //$$$$ set to 18 for quaternion only dmpPacketSize = 18; //resetFIFO(); //getIntStatus();
  3. The Due works well, changed the interrupt to 2 and used pin 2. Doesn't crash.
  4. I have a sen0142 DFROBOT version and it hangs, The A0 pin isn't broke out but according to the schematic it is not floating. The only application not working is the DMP, it hangs on both an UNO board and a breadboarded atmega328P. The raw example works, and my own app i wrote to get only AccX and GyroY works, even at 1000 khz retrieving samples by the DUE. So i know its not the SDA/SDC lines be miswired or voltages incorrect. The motion control application crashes abruptly, everything else works flawless. I'm at a loss as to why, don't know either where it crashes in the program. This question is consistently unanswered for many people on many sites even tho A0 is tied properly, like myself. Would love to use the DMP app, it just doesn't run for more then 10 seconds to a minute.
  5. Here ya go, works nice, prints "nix" while waiting for the buffer to exceed normal packet size. /* I2Cdev device library code is placed under the MIT license Copyright (c) 2012 Jeff Rowberg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. */ // if programming failed, don't try to do anything if (!dmpReady) return; while (fifoCount < packetSize) { //do stuff Serial.println("nix"); fifoCount = mpu.getFIFOCount(); } if (fifoCount == 1024) mpu.resetFIFO(); else { fifoCount = mpu.getFIFOCount(); mpu.getFIFOBytes(fifoBuffer, packetSize); mpu.resetFIFO(); fifoCount -= packetSize; mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetEuler(euler, &q); /* for (int i = 1; i < 64; i++) { Serial.print(fifoBuffer[i]); Serial.print(" "); } */ Serial.print("euler\t"); Serial.print((euler[0] * 180/M_PI)); Serial.print("\t"); Serial.print(euler[1] * 180/M_PI); Serial.print("\t"); Serial.println(euler[2] * 180/M_PI); // blink LED to indicate activity blinkState = !blinkState; digitalWrite(LED_PIN, blinkState); }
  6. Should your code be: while (fifoCount < packetSize) { //do stuff Serial.println("nix"); fifoCount = mpu.getFIFOCount(); } As you can't escape your while loop without updating your fifoCount? Also do a "mpu.resetFIFO();" to make sure the buffer is empty for the next packet to start from the beginning for the next read. I'm working on the same thing. I just need ypr "p" value, i wish i could just get it from a register in the IMU instead of transferring so much data. I just started coding my sketch but hopefully 2 are better then one on this. I have much to learn on this IMU.
×
×
  • Create New...