<?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 Setting MMA8451 HPF in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/Setting-MMA8451-HPF/m-p/632178#M3932</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying set the high pass filter, and followed some of the instructions in the notes and using the arduino package already created. It works a bit, but when I lay the accelerometer flat I'm still getting some of the gravity effect (about half) in my data. I've tried to configure the settings to choose different cutoffs, but still no luck. I've seen that others on this site have nearly eliminated the effect of gravity. Here's a snapshot of my output and then my code taken, or adapted, from arduino code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;y,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;z&lt;BR /&gt;-1.29526,-4.54898, 1.33836&lt;BR /&gt;-1.29047,-4.54180, 1.31442&lt;BR /&gt;-1.29047,-4.54898, 1.30723&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set data rate to 2G with HPF default cutoff:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate&lt;BR /&gt; writeRegister8(MMA8451_REG_XYZ_DATA_CFG, 0b00001 &amp;amp; 0x13);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set data rate to 800Hz:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t ctl1 = readRegister8(MMA8451_REG_CTRL_REG1);&lt;BR /&gt; readRegister8(0x0F);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate&lt;BR /&gt; writeRegister8(0x0F, 0x00); &lt;BR /&gt; ctl1 &amp;amp;= ~(0b111 &amp;lt;&amp;lt; 3); // mask off bits&lt;BR /&gt; ctl1 |= (0b000 &amp;lt;&amp;lt; 3);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, ctl1 | 0x01); // activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set HPF:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate&lt;BR /&gt; writeRegister8(MMA8451_REG_HPF, 0x03); &lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Feb 2026 22:54:20 GMT</pubDate>
    <dc:creator>chrishedenberg</dc:creator>
    <dc:date>2026-02-03T22:54:20Z</dc:date>
    <item>
      <title>Setting MMA8451 HPF</title>
      <link>https://community.nxp.com/t5/Sensors/Setting-MMA8451-HPF/m-p/632178#M3932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying set the high pass filter, and followed some of the instructions in the notes and using the arduino package already created. It works a bit, but when I lay the accelerometer flat I'm still getting some of the gravity effect (about half) in my data. I've tried to configure the settings to choose different cutoffs, but still no luck. I've seen that others on this site have nearly eliminated the effect of gravity. Here's a snapshot of my output and then my code taken, or adapted, from arduino code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;y,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;z&lt;BR /&gt;-1.29526,-4.54898, 1.33836&lt;BR /&gt;-1.29047,-4.54180, 1.31442&lt;BR /&gt;-1.29047,-4.54898, 1.30723&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set data rate to 2G with HPF default cutoff:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate&lt;BR /&gt; writeRegister8(MMA8451_REG_XYZ_DATA_CFG, 0b00001 &amp;amp; 0x13);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set data rate to 800Hz:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t ctl1 = readRegister8(MMA8451_REG_CTRL_REG1);&lt;BR /&gt; readRegister8(0x0F);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate&lt;BR /&gt; writeRegister8(0x0F, 0x00); &lt;BR /&gt; ctl1 &amp;amp;= ~(0b111 &amp;lt;&amp;lt; 3); // mask off bits&lt;BR /&gt; ctl1 |= (0b000 &amp;lt;&amp;lt; 3);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, ctl1 | 0x01); // activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set HPF:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);&lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate&lt;BR /&gt; writeRegister8(MMA8451_REG_HPF, 0x03); &lt;BR /&gt; writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 22:54:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Setting-MMA8451-HPF/m-p/632178#M3932</guid>
      <dc:creator>chrishedenberg</dc:creator>
      <dc:date>2026-02-03T22:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Setting MMA8451 HPF</title>
      <link>https://community.nxp.com/t5/Sensors/Setting-MMA8451-HPF/m-p/632179#M3933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to get the HPF data, the HPF_OUT bit must be set in the XYZ_DATA_CFG register (0x0E). Looking at your source code, you are not setting it correctly. You should use something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writeRegister8(MMA8451_REG_XYZ_DATA_CFG, 0b000&lt;STRONG&gt;1&lt;/STRONG&gt;00XX);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where XX depends on the selected full-sacle range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Tomas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="margin: 0px; padding: 0px; border: 0px; font-weight: normal; font-style: italic; font-size: 11px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; vertical-align: baseline; color: #51626f; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2016 10:17:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Setting-MMA8451-HPF/m-p/632179#M3933</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2016-12-23T10:17:43Z</dc:date>
    </item>
  </channel>
</rss>

