Recent Posts

Pages: [1] 2 3 ... 10
1
Hi !

I'm using a RFDuino in order to retrieve IMU MPU-9250 values and send it to an Android app via BLE.

Separately, BLE or I2C IMU works fine. However, when I merge the two codes, either the BLE nor the I2C IMU is starting. If BLE is using I2C, it should not be a problem because I2C can have multiple slaves at different addresses.

The IMU pins are GPIO5 and GPIO6 for the I2C. I even tried with differente I2C pin (2,3 for example) and it is the same result.

Does anyone faced this problem before ?

Here is the code I use for the RFDuino :

Code: [Select]
    #include <RFduinoBLE.h>
    #include "MPU9250.h"
   
    bool first = true;
    int iterations = 0;
    int NB_SENSORS = 4;
    int connected = 0;
    int PRECISION = 1000000;
    float PRECISION_F = 1000000.0;
   
    #define LazarusPin 31
    #define mySerialDebug true  // Set to true to get mySerial output for debugging
   
    // Pin definitions
    int intPin = 12;  // These can be changed, 2 and 3 are the Arduinos ext int pins
    MPU9250 myIMU;
   
    void setup() {
      Serial.begin(9600);
   
      pinMode(LazarusPin, INPUT_PULLDOWN);
      NRF_GPIO->PIN_CNF[LazarusPin] =
        (GPIO_PIN_CNF_PULL_Pulldown << GPIO_PIN_CNF_PULL_Pos);
   
      RFduinoBLE.advertisementData = "cube";
      RFduinoBLE.advertisementInterval = 1000; // ms
      RFduinoBLE.txPowerLevel = -20; // dBm, possible values: -20, -16, -12, -8, -4, 0, +4
   
      Serial.println("Waiting for connection...");
      RFduinoBLE.begin();
      RFduino_ULPDelay(INFINITE);
    }
   
    void setupIMU() {
   
      Wire.beginOnPins(2, 3);
      Serial.println("after begin wire");
      // Set up the interrupt pin, its set as active high, push-pull
      pinMode(intPin, INPUT);
      digitalWrite(intPin, LOW);
   
      // Read the WHO_AM_I register, this is a good test of communication
      byte c = myIMU.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250);
      if (mySerialDebug) {
        Serial.print("MPU9250 "); Serial.print("I AM "); Serial.print(c, HEX);
        Serial.print(" I should be "); Serial.println(0x71, HEX);
      }
      if (c == 0x71) // WHO_AM_I should always be 0x68
      {
        if (mySerialDebug) {
          Serial.println("MPU9250 is online...");
        }
   
        // Start by performing self test and reporting values
        if (mySerialDebug) {
          myIMU.MPU9250SelfTest(myIMU.SelfTest);
          Serial.print("x-axis self test: acceleration trim within : ");
          Serial.print(myIMU.SelfTest[0], 1); Serial.println("% of factory value");
          Serial.print("y-axis self test: acceleration trim within : ");
          Serial.print(myIMU.SelfTest[1], 1); Serial.println("% of factory value");
          Serial.print("z-axis self test: acceleration trim within : ");
          Serial.print(myIMU.SelfTest[2], 1); Serial.println("% of factory value");
          Serial.print("x-axis self test: gyration trim within : ");
          Serial.print(myIMU.SelfTest[3], 1); Serial.println("% of factory value");
          Serial.print("y-axis self test: gyration trim within : ");
          Serial.print(myIMU.SelfTest[4], 1); Serial.println("% of factory value");
          Serial.print("z-axis self test: gyration trim within : ");
          Serial.print(myIMU.SelfTest[5], 1); Serial.println("% of factory value");
        }
   
        // Calibrate gyro and accelerometers, load biases in bias registers
        myIMU.calibrateMPU9250(myIMU.gyroBias, myIMU.accelBias);
   
        myIMU.initMPU9250();
        // Initialize device for active mode read of acclerometer, gyroscope, and
        // temperature
        if (mySerialDebug) {
          Serial.println("MPU9250 initialized for active data mode....");
        }
   
        // Read the WHO_AM_I register of the magnetometer, this is a good test of
        // communication
        byte d = myIMU.readByte(AK8963_ADDRESS, WHO_AM_I_AK8963);
        if (mySerialDebug) {
          Serial.print("AK8963 "); Serial.print("I AM "); Serial.print(d, HEX);
          Serial.print(" I should be "); Serial.println(0x48, HEX);
        }
   
        // Get magnetometer calibration from AK8963 ROM
        myIMU.initAK8963(myIMU.magCalibration);
        // Initialize device for active mode read of magnetometer
        if (mySerialDebug) {
          Serial.println("AK8963 initialized for active data mode....");
          //  mySerial.println("Calibration values: ");
          Serial.print("X-Axis sensitivity adjustment value ");
          Serial.println(myIMU.magCalibration[0], 2);
          Serial.print("Y-Axis sensitivity adjustment value ");
          Serial.println(myIMU.magCalibration[1], 2);
          Serial.print("Z-Axis sensitivity adjustment value ");
          Serial.println(myIMU.magCalibration[2], 2);
        }
   
      } // if (c == 0x71)
      else
      {
        if (mySerialDebug) {
          Serial.print("Could not connect to MPU9250: 0x");
          Serial.println(c, HEX);
        }
        while (1) ; // Loop forever if communication doesn't happen
      }
    }
   
    /*int batteryLevel() {
      char out_ch[7];
      analogReference(VBG); // Sets the Reference to 1.2V band gap
      analogSelection(VDD_1_3_PS);  //Selects VDD with 1/3 prescaling as the analog source
      int value = analogRead(1); // the pin has no meaning, it uses VDD pin
      analogSelection(AIN_1_3_PS); // Selects the analog inputs with 1/3 prescaling as the analog source
      analogReference(DEFAULT); // switch back to default reference
      return value;
      }*/
   
   
    void RFduinoBLE_onConnect() {
      Serial.println("Connected");
    delay(200);
      iterations = 0;
      first = true;
   
      // Wake up from RFduino_ULPDelay()
      // http://forum.rfduino.com/index.php?topic=801.msg2682#msg2682
      NRF_GPIO->PIN_CNF[LazarusPin] =
        (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos);
      RFduino_pinWake(LazarusPin, HIGH);
      NRF_GPIO->PIN_CNF[LazarusPin] =
        (GPIO_PIN_CNF_PULL_Pulldown << GPIO_PIN_CNF_PULL_Pos);
    Serial.println("after wake up");
      setupIMU();
   
      connected = 1;
    }
   
    void RFduinoBLE_onDisconnect() {
      //Serial.println("Disconnected");
      connected = 0;
    }
   
    void loop() {
      if (connected != 0) {
            Serial.println("in loop");
     }

Thx for the help !
2
Interesting Uses & Applications / Re: Simblee hardware!
« Last post by grantpatterson on October 22, 2017, 11:03:34 AM »
Hi there, did you ever complete this hardware project? I'm interested!

I've been using DFRobot's Beetle BLE https://www.dfrobot.com/product-1259.html. It talks Bluetooth (perhaps an over-simplified system that goes over the ATMega32u4's serial port), has micro-usb for power and programming, and is a pretty small all-in-one package (but for the annoying wire-wrap compatible pads). Sounds like the Simblee would be a big upgrade in the right form factor.
3
Getting Started / Re: Just a little info about Sparkfun
« Last post by Wayne on October 20, 2017, 11:57:10 AM »
Well Simply put, we need Simblee's at DigiKey and Mouser...  And fast..  Now it is holding up the last of my demo boards.. ugh
4
Support / Re: Problem with i2c and ULP (low power mode)
« Last post by RFD_Nelson on October 20, 2017, 04:23:57 AM »
Hi murrpop,

Can you please post a copy of your sketch for us to take a look at?

Thanks,

Nelson
5
Support / Problem with i2c and ULP (low power mode)
« Last post by murrpop on October 19, 2017, 07:07:21 PM »
Hello all,

First post - I am communicating with an IMU via I2C, and have been newly trying to explore the ULP functionality. RFduino.ULPDelay() works great when debugging using serial, but as soon as I add Wire.begin() in the void setup(), the loop continues regardless of any ULPDelay.

Has anyone experienced this and/or would be able to help??  :D

Thanks!
6
Getting Started / Re: Just a little info about Sparkfun
« Last post by Tim on October 19, 2017, 09:21:40 AM »
Yeah, it's unfortunate that Simblee's MSL classification has not been properly documented/communicated for both distributors and customers. We've wasted a lot of chips/money due to this issue. The data sheet still says MSL: TBD, and DigiKey and Mouser label as MSL 3, not 6.

We typically bake at 125°C for 10 hours, then reflow within a couple hours. The recommendation from RF Digital is 125°C for 8-12 hours, then reflow within 6 hours.

It is rather unfortunate that SparkFun has been mishandling Simblees. From posts here, it's appears clear that their non-protective packaging is indeed the cause of so many failures. Simblee is very sensitive.

Hope all will be resolved very soon. And hoping for new supply to flow through DigiKey and Mouser much sooner than current estimates (10-14 weeks).

Thanks,

Tim
7
Getting Started / Re: Just a little info about Sparkfun
« Last post by Wayne on October 19, 2017, 09:12:56 AM »
Hi Tim,

All the parts from Digikey we had no issues with the parts.  Here in Salt Lake City, Humidity is very low..All the time.  The failure so far was 4 out of 6.  Have 4 in bags.. I have contacted Sparkfun about the issue with plastic bags used for shipping.
I would think Sparkfun be up of Static procedures.

8
Support / Re: Simblee supply issues?
« Last post by tolson on October 18, 2017, 04:03:36 PM »
The above statement equals 3 to 3-1/2 MONTHS. OUCH! It's only been a month.

9
Support / Re: Simblee supply issues?
« Last post by simonem on October 18, 2017, 03:31:37 PM »
Any news regarding availability?

Thanks
Simone
10
Getting Started / Re: Just a little info about Sparkfun
« Last post by simonem on October 18, 2017, 03:28:59 PM »
Wow how this is not mentioned on the datasheet?
How long need to be baked and at what temperature?

Thanks
Simone
Pages: [1] 2 3 ... 10
anything