2020-02-19 07:49 AM
Hello,
I use the accelerometer LSM6DSOX. I want to get an interruption when the norm is above 8g.
So I try to use the FSM and configure it. When I flash (for the first time) the system, everything works perfect ! But when I remove my battery and put it again (restart the device), the FSM interrupt do not work anymore (also if I flash again , it still not work) ... I really don't understand where is my mistake ... I followed exactly your AN_FSM doc.
I tried on 2 different prototype, same problem, so it must be software.
Here is the configuration of FSM and Accel (In my main I first call FSM_config and then Accel_config). I just give you the value I write in which register adress :
So first I call FSM_CONFIG : (address / data)
0x10 / 0x00 turn off accel
0x11 / 0x00 turn off gyro
0x01 / 0x80 enable access to embedded function register
0x05 / 0x01 Enable FSM
0x5F / 0x4B FSM odr = 26Hz
0x46 / 0x01 Enable FSM1
0x0B / 0x01interrupt of FSM on int1
0x17 / 0x40 enable write operation on embedded page
0x02 / 0x11 enable access to emb features -> PAGE_SEL = 1
0x08 / 0x7A write PAGE_ADDRESS
0x09 / 0x00 long counter
0x09 / 0x00 long counter
0x09 / 0x01 one FSM program
0x09 / 0x01 dummy write to increment the write addess
0x09 / 0x00 start adress
0x09 / 0x04 start adress
0x02 / 0x41 configure program on PAGE_SEL = 4
0x08 / 0x00 page adress = 00
0x09 / 0x50 config A
0x09 / 0x00 config B
x0x9 / 0x0C size
0x09 / 0x00 Settings
0x09 / 0x00 reset pointer
0x09 / 0x00 program pointer
0x09 / 0x00 thresh LSB
0x09 / 0x48 thresh MSB
0x09 / 0x03 mask A
0x09 / 0x00 Tmask A
0x09 / 0x05 NOP | GNTH1
0x09 / 0x22 Contrel
0x02 / 0x01 disable access to emb feat reg PAGE_SEL = 0
0x17 / 0x00 PAGE_WR disable write operation
0x01 / 0x00 disable access to embedded function reg
0x5E / 0x02 MD1_CFG = 1 : interrupt on int 1
Then I call Accel_config :
0x10 / 0x34 accel active, 52Hz, full scale 16g
0x12 / 0x04 multiple access with I2C
0x14 / 0x80 low power mode enable
main () {
FSM_CONFIG();
ACCEL_CONFIG;
Where am I wrong ? Why does it work first but after restart it does not work anymore ?
Waiting for your reply,
Thanks !
Valentin
2020-02-20 11:51 PM
Hi @VLeme.2256 , the restart procedure resets the internal memory flash. When you restart the device, you have to configure again your FSM registers, and I suggest you to save them in your sw to speed up this process. Regards
2020-02-21 02:15 AM
Hello,
Yes I know that, that's why I configure my FSM at the start of my main loop. So on restart, the accelerometer is reconfigured.
I found a solution, with a software reset of the LSMDSOX before configure it, it works properly.
Thank you for your time !
Regards,
Valentin