I am currently trying to develop a pulse oximeter. For this I use the MAX30102 sensor and the NXP LPC1768 microcontroller. The communication is done via I2C.
I have configured the MAX30102 sensor to generate an interrupt as soon as the FIFO is full.
As soon as I start the program in debug mode, an interrupt is generated (debug jumps to the interrupt service routine and the logic analyzer shows that the interrupt line goes low).
When I try to read the MAX30102's interrupt status registers on this first interrupt, I get a value of 0x00. And no other interrupt is generated either. I suspect this is because the I2C read of the interrupt status register is not working properly, and thus the interrupt on the MAX30102 is not reset.
However, if I read the FIFO data register interrupts are continuously generated because reading this register resets the interrupts on the MAX30102.
But now to the whimsical part. If I read other registers of the MAX30102 with the same I2C read function, I get values. E.g. the FIFO_CONFIG register, in which I have written before. There I get by reading the same value that I have written into the register.
But why does the reading of the interrupt status register with the same function not work?
I traced the I2C_Read_Function for reading both registers with a logic analyzer and it was correct for both registers.
Does anyone of you have any general ideas what this problem could be and what I can try, because I'm getting desperate with this project?! I have already tried a lot, so I am grateful for any solution that I have not yet pursued.
Attached my code files. I tried to cut it to the important parts, but i can not narrow it down more.