<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Re: Problem communicating with MMA8452Q in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242678#M334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well... I must be blind, I didn't see the level shifters! I adapted the code now to a JM128 Coldfire V1 running at 5V, and now it works great!&lt;/P&gt;&lt;P&gt;One more question, I was reading AN4069 and I noticed that I have to change the calibration routine in order for it to work correctly with the mma8452 in 2g mode and 12 bits. But this isn't very clear to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;/******************************************************************************&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;* Simple offset calibration&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;******************************************************************************/&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void Calibrate (void)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; unsigned char reg_val = 0;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; while (!reg_val) // Wait for a first set of data &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; reg_val = I2C_ReadRegister(MMA845x_I2C_ADDRESS, STATUS_REG) &amp;amp; 0x08;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_ReadMultiRegisters(MMA845x_I2C_ADDRESS, OUT_X_MSB_REG, 6, AccData); // Read data output registers 0x01-0x06 &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Xout_14_bit = ((short) (AccData[0]&amp;lt;&amp;lt;8 | AccData[1])) &amp;gt;&amp;gt; 2; // Compute 14-bit X-axis output value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Yout_14_bit = ((short) (AccData[2]&amp;lt;&amp;lt;8 | AccData[3])) &amp;gt;&amp;gt; 2; // Compute 14-bit Y-axis output value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Zout_14_bit = ((short) (AccData[4]&amp;lt;&amp;lt;8 | AccData[5])) &amp;gt;&amp;gt; 2; // Compute 14-bit Z-axis output value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Xoffset = Xout_14_bit / 8 * (-1); // Compute X-axis offset correction value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Yoffset = Yout_14_bit / 8 * (-1); // Compute Y-axis offset correction value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Zoffset = (Zout_14_bit - SENSITIVITY_2G) / 8 * (-1); // Compute Z-axis offset correction value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x00); // Standby mode to allow writing to the offset registers&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_X_REG, Xoffset);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_Y_REG, Yoffset);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_Z_REG, Zoffset);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG3, 0x00); // Push-pull, active low interrupt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG4, 0x01); // Enable DRDY interrupt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG5, 0x01); // DRDY interrupt routed to INT1 - PTA14&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x3D); // ODR = 1.56Hz, Reduced noise, Active mode&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made the following changes (marked in bold):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Xout_12_bit = ((short) (AccData[0]&amp;lt;&amp;lt;8 | AccData[1])) &amp;gt;&amp;gt; &lt;STRONG&gt;4&lt;/STRONG&gt;; // Compute 12-bit X-axis output value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Yout_12_bit = ((short) (AccData[2]&amp;lt;&amp;lt;8 | AccData[3])) &amp;gt;&amp;gt; &lt;STRONG&gt;4&lt;/STRONG&gt;; // Compute 12-bit Y-axis output value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Zout_12_bit = ((short) (AccData[4]&amp;lt;&amp;lt;8 | AccData[5])) &amp;gt;&amp;gt; &lt;STRONG&gt;4&lt;/STRONG&gt;; // Compute 12-bit Z-axis output value&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; Xoffset = Xout_12_bit / &lt;STRONG&gt;2&lt;/STRONG&gt; * (-1); // Compute X-axis offset correction value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Yoffset = Yout_12_bit / &lt;STRONG&gt;2&lt;/STRONG&gt; * (-1); // Compute Y-axis offset correction value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Zoffset = (Zout_12_bit - SENSITIVITY_2G) / &lt;STRONG&gt;2&lt;/STRONG&gt; * (-1); // Compute Z-axis offset correction value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please tell me if this changes are correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, and sorry for the troubles.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Jan 2014 03:48:13 GMT</pubDate>
    <dc:creator>juanm</dc:creator>
    <dc:date>2014-01-23T03:48:13Z</dc:date>
    <item>
      <title>Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242674#M330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I'm having problems with this accelerometer. I'm using an FRDM KL25Z and I tested the onboard MMA8451Q with this code:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="11146" data-containertype="14" data-objectid="98836" data-objecttype="102" href="https://community.nxp.com/docs/DOC-98836" target="_blank"&gt;MMA8451Q - Bare metal example project&lt;/A&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code works great. The problem started when I wanted to try this code with the MMA8452Q. I modified the code so I can use it with the I2C1 module and I used PTC1 as SCL and PTC2 as SDA. Also, I used PTA5 for the interrupt. So, the configuration is like this:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;/******************************************************************************&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;* MCU initialization function&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;******************************************************************************/ &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;void MCU_Init(void)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; //I2C0 module initialization&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; SIM_SCGC4 |= SIM_SCGC4_I2C1_MASK; // Turn on clock to I2C0 module &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK; // Turn on clock to Port C module &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; PORTC_PCR1 = PORT_PCR_MUX(2); // PTC1 pin is I2C1 SCL line &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; PORTC_PCR2 = PORT_PCR_MUX(2); // PTC2 pin is I2C1 SDA line &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; I2C1_F&amp;nbsp; = 0x14; // SDA hold time = 2.125us, SCL start hold time = 4.25us, SCL stop hold time = 5.125us *&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; I2C1_C1 = I2C_C1_IICEN_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable I2C0 module &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; //Configure the PTA5 pin (connected to the INT1 of the MMA8451Q) for falling edge interrupts&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; // Turn on clock to Port A module &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; PORTA_PCR5 |= (0|PORT_PCR_ISF_MASK| // Clear the interrupt flag &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; PORT_PCR_MUX(0x1)| // PTA5 is configured as GPIO &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; PORT_PCR_IRQC(0xA)); // PTA5 is configured for falling edge interrupts &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; //Enable PORTA interrupt on NVIC&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; NVIC_ICPR |= 1 &amp;lt;&amp;lt; ((INT_PORTA - 16)%32); &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; NVIC_ISER |= 1 &amp;lt;&amp;lt; ((INT_PORTA - 16)%32); &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this doesn't work. The program get stuck in the function I2C_Wait();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If I try to read the WHO AM I register, it always return 0xFF. &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I tried with two different accelerometers, and both fails.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; I attach the complete code, maybe someone can test it.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PD: This is the breakout board that I'm using.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fdx.com%2Fp%2Fmma8452-3-axial-triaxial-digital-accelerometer-module-for-arduino-147107%23.UtmPR6jNjJE" rel="nofollow" target="_blank"&gt;MMA8452 3-Axial Triaxial Digital Accelerometer Module for Arduino - Free Shipping - DealExtreme&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338522" target="_blank"&gt;MMA8452q_KL25.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 21:00:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242674#M330</guid>
      <dc:creator>juanm</dc:creator>
      <dc:date>2026-02-03T21:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242675#M331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your source code seems to be properly modified to make use of the I2C1 module (PTC1 and PTC2 pins) and the PTA5 pin. You have also correctly adapted both the I2C.c and I2C.h files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a schematic of the breakout board you are using available? I was not able to find it. Please double check how is the SA0 pin connected and if necessary change the 7-bit I2C slave address accordingly. Also make sure the INT1 pin is connected properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also recommend to use a logic analyzer to know what is going on on the I2C bus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 09:26:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242675#M331</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2014-01-20T09:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242676#M332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have attached the schematic.&lt;/P&gt;&lt;P&gt;I tried with the SA0 pin to GND and also to 3.3V (and changed the code accordingly), but it's the same, also I checked the INT1 pin connection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have a logic analyzer, but I have access to an oscilloscope. I'm going to try this, and I will let you know.&lt;/P&gt;&lt;P&gt;Thank you very much for the answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 03:49:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242676#M332</guid>
      <dc:creator>juanm</dc:creator>
      <dc:date>2014-01-21T03:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242677#M333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How exactly are you interfacing a 3.3V MKL25Z128VLK4 MCU on the FRDM-KL25Z board with the breakout board? Looking at the schematic, they do not seem to be compatible. There is an on-board 3.3V regulator and MOSFET-based level shifters to interface the breakout board easily with 5V (Arduino) boards only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 17:53:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242677#M333</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2014-01-22T17:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242678#M334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well... I must be blind, I didn't see the level shifters! I adapted the code now to a JM128 Coldfire V1 running at 5V, and now it works great!&lt;/P&gt;&lt;P&gt;One more question, I was reading AN4069 and I noticed that I have to change the calibration routine in order for it to work correctly with the mma8452 in 2g mode and 12 bits. But this isn't very clear to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;/******************************************************************************&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;* Simple offset calibration&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;******************************************************************************/&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void Calibrate (void)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; unsigned char reg_val = 0;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; while (!reg_val) // Wait for a first set of data &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; reg_val = I2C_ReadRegister(MMA845x_I2C_ADDRESS, STATUS_REG) &amp;amp; 0x08;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_ReadMultiRegisters(MMA845x_I2C_ADDRESS, OUT_X_MSB_REG, 6, AccData); // Read data output registers 0x01-0x06 &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Xout_14_bit = ((short) (AccData[0]&amp;lt;&amp;lt;8 | AccData[1])) &amp;gt;&amp;gt; 2; // Compute 14-bit X-axis output value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Yout_14_bit = ((short) (AccData[2]&amp;lt;&amp;lt;8 | AccData[3])) &amp;gt;&amp;gt; 2; // Compute 14-bit Y-axis output value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Zout_14_bit = ((short) (AccData[4]&amp;lt;&amp;lt;8 | AccData[5])) &amp;gt;&amp;gt; 2; // Compute 14-bit Z-axis output value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Xoffset = Xout_14_bit / 8 * (-1); // Compute X-axis offset correction value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Yoffset = Yout_14_bit / 8 * (-1); // Compute Y-axis offset correction value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Zoffset = (Zout_14_bit - SENSITIVITY_2G) / 8 * (-1); // Compute Z-axis offset correction value&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x00); // Standby mode to allow writing to the offset registers&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_X_REG, Xoffset);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_Y_REG, Yoffset);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_Z_REG, Zoffset);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG3, 0x00); // Push-pull, active low interrupt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG4, 0x01); // Enable DRDY interrupt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG5, 0x01); // DRDY interrupt routed to INT1 - PTA14&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x3D); // ODR = 1.56Hz, Reduced noise, Active mode&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made the following changes (marked in bold):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Xout_12_bit = ((short) (AccData[0]&amp;lt;&amp;lt;8 | AccData[1])) &amp;gt;&amp;gt; &lt;STRONG&gt;4&lt;/STRONG&gt;; // Compute 12-bit X-axis output value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Yout_12_bit = ((short) (AccData[2]&amp;lt;&amp;lt;8 | AccData[3])) &amp;gt;&amp;gt; &lt;STRONG&gt;4&lt;/STRONG&gt;; // Compute 12-bit Y-axis output value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Zout_12_bit = ((short) (AccData[4]&amp;lt;&amp;lt;8 | AccData[5])) &amp;gt;&amp;gt; &lt;STRONG&gt;4&lt;/STRONG&gt;; // Compute 12-bit Z-axis output value&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; Xoffset = Xout_12_bit / &lt;STRONG&gt;2&lt;/STRONG&gt; * (-1); // Compute X-axis offset correction value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Yoffset = Yout_12_bit / &lt;STRONG&gt;2&lt;/STRONG&gt; * (-1); // Compute Y-axis offset correction value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Zoffset = (Zout_12_bit - SENSITIVITY_2G) / &lt;STRONG&gt;2&lt;/STRONG&gt; * (-1); // Compute Z-axis offset correction value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please tell me if this changes are correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, and sorry for the troubles.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 03:48:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242678#M334</guid>
      <dc:creator>juanm</dc:creator>
      <dc:date>2014-01-23T03:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Re: Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242679#M335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; background: white;"&gt;Glad to hear that you have got it working with the JM128. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; background: white;"&gt;The changes you made are correct. &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Helvetica','sans-serif'; background: white;"&gt;The resolution of all three offset registers (0x2F – 0x31) is ~2mg (1.953125mg) per LSB, so if calibration is done in the ±2g mode (0.9765625mg/count), the 12-bit output data needs to be divided by 2 and then multiplied by -1 to shift the offset to zero. If you calibrated in the ±4g mode (1.953125mg/count), then all you would have to do is multiply the 12-bit output data by -1. In the ±8g mode (3.90625mg/count), the 12-bit output data needs to be multiplied by 2 and -1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Helvetica','sans-serif'; background: white;"&gt;I hope it makes sense. &lt;SPAN style="font-size: 10.0pt; font-family: 'Helvetica','sans-serif'; background: white;"&gt;If you have any other questions, just let me know. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-size: 10.0pt; font-family: 'Helvetica','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-size: 10.0pt; font-family: 'Helvetica','sans-serif';"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-size: 10.0pt; font-family: 'Helvetica','sans-serif';"&gt;Tomas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 08:33:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242679#M335</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2014-01-23T08:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Problem communicating with MMA8452Q</title>
      <link>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242680#M336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much! You have been very helpfull.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 16:25:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Problem-communicating-with-MMA8452Q/m-p/242680#M336</guid>
      <dc:creator>juanm</dc:creator>
      <dc:date>2014-01-23T16:25:26Z</dc:date>
    </item>
  </channel>
</rss>

