This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: Can't get data from the MMA7455 Accelerometer

Part Number: MSP430G2553
Other Parts Discussed in Thread: ENERGIA

Hello all. :)

I'm new in the world of microcontrollers and looking for a way to solve a problem. I'm trying to make the aforementioned accelerometer work with my launchpad.

I tried using different libraries with Energia (examples below) but with no success. I get no readings at all.

I tried understanding how to use the datasheet but it has proven a difficult task for a beginner. Until now I understand that I must write into some registers and then read some others, but I'm doing something wrong.

The only thing I need is a working example in order to understand what makes it work, and where I failed until now. I would be grateful if someone could help. :)

Libraries I used:

In the first link are links to the library and the datasheet.

https://arduino-info.wikispaces.com/accelerometer-MMA7455

https://playground.arduino.cc/Main/MMA7455

 

  • Hi Alexandros,
    Are you using the module? How are you powering it? You will want to ensure you are using the 5v (not 3v3) pin to power it, if it's the one shown in your link.

    What pins are SDA and SCL connected to?
  • Hello Cameron,
    thanks a lot for your reply. I am using a VCC pin to power it, as in the documentation under features is the following text.

    "Low Voltage Operation: 2.4 V – 3.6 V"
    yourduino.com/.../MMA7455L.pdf

    I just tried 5V but the result is the same.

    The SDA is on the P1.7 pin, while the SCL on the P1.6 pin. The P1.6 jumper is removed.
  • A few more checks:
    Can you see any activity on the I2C lines by using an oscilloscope?

    Have you connected the CS pin to VCC?

    Sometimes Arduino Libraries need to be ported to MSP430, can you post the code that you are using here?
  • Unfortunately I don't have an oscilloscope, so that check cannot be done at the moment. :(

    The CS pin used to be on pin 2.2 (output) and I put it on VCC, but nothing changed. Through every test you propose I am also testing both 3. and 5V.

    The MMA_7455 library is under the following link:

    https://github.com/eklex/MMA_7455

    Here is the code from the ino file, in principle it is one the examples in the aforementioned link.

    #if defined(ARDUINO)
    /* Mandatory includes for Arduino */
    #include <SPI.h>
    #include <Wire.h>
    #endif
    
    
    #include <SPI.h>
    #include <Wire.h>
    #include "MMA_7455.h"
    
    /* Case 1: Accelerometer on the I2C bus (most common) */
    MMA_7455 accel = MMA_7455(i2c_protocol);
    /* Case 2: Accelerometer on the SPI bus with CS on pin 2 */
    //MMA_7455 accel = MMA_7455(spi_protocol, A2);
    
    int16_t x10, y10, z10;
    float   xg, yg, zg;
    
    void setup()
    {
    
    delay(2000);
      /* Set serial baud rate */
      Serial.begin(9600);
      /* Start accelerometer */
      accel.begin();
      /* Set accelerometer sensibility */
      int sensitivity = 2;
      accel.setSensitivity(sensitivity);
      /* Verify sensibility - optional */
      if(accel.getSensitivity() != sensitivity)   Serial.println("Sensitivity failure");
      /* Set accelerometer mode */
      accel.setMode(measure);
      /* Verify accelerometer mode - optional */
      if(accel.getMode() != measure)    Serial.println("Set mode failure");
      /* Set axis offsets */
      /* Note: the offset is hardware specific
       * and defined thanks to the auto-calibration example. */
      accel.setAxisOffset(0, 0, 0);
    }
    
    void loop()
    {
      // Get 10-bit axis raw values
      x10 = accel.readAxis10('x');
      y10 = accel.readAxis10('y');
      z10 = accel.readAxis10('z');
      //Get 10-bit axis values in g
      xg  = accel.readAxis10g('x');
      yg  = accel.readAxis10g('y');
      zg  = accel.readAxis10g('z');
      
      // Display current axis values
      Serial.println("X: ");    Serial.print(x10, DEC);
      Serial.println("Y: ");  Serial.print(y10, DEC);
      Serial.println("Z: ");  Serial.print(z10, DEC);
    
      Serial.println("Xg: "); Serial.print(xg, DEC);
      Serial.println("Yg: "); Serial.print(yg, DEC);
      Serial.println("Zg: "); Serial.print(zg, DEC);
      Serial.println();
      delay(500);
    }
    
    
    

  • I apologize for the delay. I will check this code with an oscilloscope .
  • Hi Alexandros,
    I'm having trouble importing this. I will update my Energia and report back.

    My immediate suspicion is that the library is using something specific to AVR. This could be a pin assignment or register setting.
  • Alexandros,
    I apologize again. I cannot get this sketch to compile on my machine. and officially we don't support Energia. Have you tried going to energi.nu and checking out the forum on the right hand side of the page? You might get better help there.
  • Hello Cameron,
    I understand that this is not the most appropriate forum. I will try my luck elsewhere. In any case, I thank you for your tries, it is appreciated. Have a nice day. :)
  • Thanks for understanding, Alexandros.

    If I find anything else, I'll be sure to post it here!

**Attention** This is a public forum