FXLS8471Q - FIFO Fill mode example code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FXLS8471Q - FIFO Fill mode example code

Jump to solution
1,896 Views
andrewneil
Contributor III

here:

https://community.nxp.com/t5/Sensors-Knowledge-Base/FXLS8471Q-FIFO-Fill-mode-example-code/ta-p/11080... 

by @TomasVaverka 

In the first code block, I think the comment against CTRL_REG4 is wrong (or, at least, misleading):

 

 

void FXLS8471Q_Init (void)
{
  FXLS8471Q_WriteRegister(CTRL_REG1,   0x00); // Standby mode
  FXLS8471Q_WriteRegister(F_SETUP_REG, 0xA0); // FIFO Fill mode, 32 samples
  FXLS8471Q_WriteRegister(CTRL_REG4,   0x40); // Enable FIFO interrupt, push-pull, active low
  FXLS8471Q_WriteRegister(CTRL_REG5,   0x40); // Route the FIFO interrupt to INT1 - PTA5   
  FXLS8471Q_WriteRegister(CTRL_REG1,   0x19); // ODR = 100Hz, Active mode
}

 

 

According to the datasheet, CTRL_REG4 contains only interrupt enable bits - not push-pull or active-low controls.

The push-pull and active-low controls are in CTRL_REG3  (the defaults are push-pull & active-low).

 

 

 

0 Kudos
1 Solution
1,878 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello Andrew,

Thank you again for your feedback, you are right, both the output mode (push-pull vs. open-drain) and polarity (active low vs. high) are configurable using bits pp_od and ipol in the CTRL_REG3 register.

I have updated the FXLS8471Q_Init function to make this clear.

void FXLS8471Q_Init (void)
{
  FXLS8471Q_WriteRegister(CTRL_REG1,   0x00); // Standby mode
  FXLS8471Q_WriteRegister(F_SETUP_REG, 0xA0); // FIFO Fill mode, 32 samples
  FXLS8471Q_WriteRegister(CTRL_REG3,   0x00); // Push-pull, active low interrupt
  FXLS8471Q_WriteRegister(CTRL_REG4,   0x40); // Enable FIFO interrupt
  FXLS8471Q_WriteRegister(CTRL_REG5,   0x40); // Route the FIFO interrupt to INT1 - PTA5   
  FXLS8471Q_WriteRegister(CTRL_REG1,   0x19); // ODR = 100Hz, Active mode
}

 

BR, Tomas

View solution in original post

2 Replies
1,879 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello Andrew,

Thank you again for your feedback, you are right, both the output mode (push-pull vs. open-drain) and polarity (active low vs. high) are configurable using bits pp_od and ipol in the CTRL_REG3 register.

I have updated the FXLS8471Q_Init function to make this clear.

void FXLS8471Q_Init (void)
{
  FXLS8471Q_WriteRegister(CTRL_REG1,   0x00); // Standby mode
  FXLS8471Q_WriteRegister(F_SETUP_REG, 0xA0); // FIFO Fill mode, 32 samples
  FXLS8471Q_WriteRegister(CTRL_REG3,   0x00); // Push-pull, active low interrupt
  FXLS8471Q_WriteRegister(CTRL_REG4,   0x40); // Enable FIFO interrupt
  FXLS8471Q_WriteRegister(CTRL_REG5,   0x40); // Route the FIFO interrupt to INT1 - PTA5   
  FXLS8471Q_WriteRegister(CTRL_REG1,   0x19); // ODR = 100Hz, Active mode
}

 

BR, Tomas

1,872 Views
andrewneil
Contributor III

Thanks.

It would be useful to have some samples like this for the FXLS896xAF, please ...

0 Kudos
%3CLINGO-SUB%20id%3D%22lingo-sub-1817711%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFXLS8471Q%20%20-%20FIFO%20Fill%20mode%20example%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1817711%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ehere%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FSensors-Knowledge-Base%2FFXLS8471Q-FIFO-Fill-mode-example-code%2Fta-p%2F1108021%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FSensors-Knowledge-Base%2FFXLS8471Q-FIFO-Fill-mode-example-code%2Fta-p%2F1108021%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eby%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12216%22%20target%3D%22_blank%22%3E%40TomasVaverka%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20first%20code%20block%2C%20I%20think%20the%20comment%20against%20CTRL_REG4%20is%20wrong%20(or%2C%20at%20least%2C%20misleading)%3A%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Evoid%20FXLS8471Q_Init%20(void)%0A%7B%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG1%2C%20%20%200x00)%3B%20%2F%2F%20Standby%20mode%0A%20%20FXLS8471Q_WriteRegister(F_SETUP_REG%2C%200xA0)%3B%20%2F%2F%20FIFO%20Fill%20mode%2C%2032%20samples%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG4%2C%20%20%200x40)%3B%20%2F%2F%20Enable%20FIFO%20interrupt%2C%20push-pull%2C%20active%20low%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG5%2C%20%20%200x40)%3B%20%2F%2F%20Route%20the%20FIFO%20interrupt%20to%20INT1%20-%20PTA5%20%20%20%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG1%2C%20%20%200x19)%3B%20%2F%2F%20ODR%20%3D%20100Hz%2C%20Active%20mode%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3EAccording%20to%20the%20datasheet%2C%20CTRL_REG%3CSTRONG%3E4%3C%2FSTRONG%3E%20contains%20only%20interrupt%20enable%20bits%20-%20not%20push-pull%20or%20active-low%20controls.%3C%2FP%3E%3CP%3EThe%26nbsp%3Bpush-pull%20and%20active-low%20controls%20are%20in%20CTRL_REG%3CSTRONG%3E3%3C%2FSTRONG%3E%26nbsp%3B%20(the%20defaults%20are%20push-pull%20%26amp%3B%20active-low).%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1818662%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FXLS8471Q%20%20-%20FIFO%20Fill%20mode%20example%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1818662%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks.%3C%2FP%3E%3CP%3EIt%20would%20be%20useful%20to%20have%20some%20samples%20like%20this%20for%20the%20FXLS896xAF%2C%20please%20...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1818491%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FXLS8471Q%20%20-%20FIFO%20Fill%20mode%20example%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1818491%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Andrew%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20again%20for%20your%20feedback%2C%20you%20are%20right%2C%20both%20the%20output%20mode%20(push-pull%20vs.%20open-drain)%20and%20polarity%20(active%20low%20vs.%20high)%20are%20configurable%20using%20bits%20pp_od%20and%20ipol%20in%20the%20CTRL_REG3%20register.%3C%2FP%3E%0A%3CP%3EI%20have%20updated%20the%20FXLS8471Q_Init%20function%20to%20make%20this%20clear.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Evoid%20FXLS8471Q_Init%20(void)%0A%7B%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG1%2C%20%20%200x00)%3B%20%2F%2F%20Standby%20mode%0A%20%20FXLS8471Q_WriteRegister(F_SETUP_REG%2C%200xA0)%3B%20%2F%2F%20FIFO%20Fill%20mode%2C%2032%20samples%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG3%2C%20%20%200x00)%3B%20%2F%2F%20Push-pull%2C%20active%20low%20interrupt%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG4%2C%20%20%200x40)%3B%20%2F%2F%20Enable%20FIFO%20interrupt%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG5%2C%20%20%200x40)%3B%20%2F%2F%20Route%20the%20FIFO%20interrupt%20to%20INT1%20-%20PTA5%20%20%20%0A%20%20FXLS8471Q_WriteRegister(CTRL_REG1%2C%20%20%200x19)%3B%20%2F%2F%20ODR%20%3D%20100Hz%2C%20Active%20mode%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%2C%20Tomas%3C%2FP%3E%3C%2FLINGO-BODY%3E