-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Hello!
I'am using the SparkFun_AK975x_Arduino_Library with a non-Sparkfun AK9750 module.
Every function of the library works fine.
I tried to implement interrupt management but I'am having bad results :
Only IR13L / IR24L interrupts are triggering
One interrupt only is triggering on the couple HIGH/LOW threshold:
This is IR13L / IR24L. It triggers when the differential signals of two IR sensors (IR1 - IR3 / IR2 - IR4) are equal to or below the lower threshold levels. (datasheet page 32)
Physicaly this correspond in sensor 4 excited for IR24L and sensor 3 excited for IR13L.
The other interrupt is not triggering normally :
This is IR13H / IR24H. It should trigger when the differential signals of two IR sensors (IR1 - IR3 / IR2 - IR4) are equal to or above the upper threshold levels. (datasheet page 32)
Bad INTST register value :
Lets take an example with setting IR24L for triggering (EINTEN = 11000010)
here is the INTST values when INT output triggers :
Sensor 4 excited, sensor 2 idle : INTST = 11100010 OK
when exiting the sensor 4 aera : INTST = 11100000 NOT OK
Sensor 4 idle, sensor 2 excited : INT pin doesn't trigger OK
INT pin should not trigger when exiting from sensors aera with a null INTST register value (11100000)
Next we set IR24H for triggering (EINTEN = 11000100)
here is the INTST values when INT output triggers :
Sensor 4 excited, sensor 2 idle : INTST = 11100000 NOT OK
when exiting the sensor 4 aera : INTST = 11100100 NOT OK
Sensor 4 idle, sensor 2 excited : INT pin doesn't trigger NOT OK
INT pin should trigger when sensor 2 is excited and sensor 4 is not (idle)
INT pin should not trigger when sensor 4 is excited and sensor 2 is not excited with a null INTST register value (11100000)
INT pin should not trigger when exiting from sensors aera with a INTST value corresponding to IR24H (11100100)
Threshold has no effect on interrupts
Setting threshold has no effect on interrupts.
INT pin is flickering on small "ir2-ir4" values while threshold si set on maximum value
Here is the Serial output of a basic sketch :
IR24L is set for triggering (EINTEN = 11000010).
Each time the interrupt is triggered, a message is printed with
the INTST register value
the result of ir2-ir4
the time since the last interrupt
AK9750_INTST : 11100010
ir2-ir4 : -8
time : 1022
AK9750_INTST : 11100000
ir2-ir4 : 32
time : 35
AK9750_INTST : 11100010
ir2-ir4 : -16
time : 88
AK9750_INTST : 11100000
ir2-ir4 : 16
time : 35
AK9750_INTST : 11100010
ir2-ir4 : -8
time : 123
AK9750_INTST : 11100000
ir2-ir4 : 64
time : 17
AK9750_INTST : 11100010
ir2-ir4 : -16
time : 618
AK9750_INTST : 11100000
ir2-ir4 : 16
time : 17
I really want to use the interrupt pin to reduce power consumption and read sensor values only when the interrupt pin is triggered.
I hope you could help but I think this problems are coming from the product itself.
Attachments :
The modificated SparkFun_AK975x_Arduino_Library (I worked on a previous version of the library)
Schematic used
AK9750 datasheet