# 2022-09-06 **Problem/Confusion:** The yu-capteurs version of function i2c_master_write doesn't transfer nonblockingly correctly. The return value of `I2C_MasterTransferNonBlocking(EXAMPLE_I2C_MASTER, &g_m_handle, masterXfer)` is not `kStatus_Success`. [Link](https://githepia.hesge.ch/guoguo.yu/centre-medical-connecte/-/blob/yu-capteurs/project/oximetre/source/oximeter2.c#L103) Several things could be the cause of it: - Badly configured masterXfer variable - Badly configured handler g_m_handle - `extern` not done properly maybe? maybe I should use `static`? - `EXAMPLE_I2C_MASTER` incorrect After modifying the oximeter2_init function and changing the EXAMPLE_I2C_MASTER's MSTDAT value to 0x46(the correct value), the value goes back to the previous wrong value after `I2C_MasterTransferNonBlocking` in `i2c_master_write`. To be more precise, 0x46 is changed to 200 after `I2C_EnableInterrupts(base, (uint32_t)kI2C_MasterIrqFlags)` in function `I2C_MasterTransferNonBlocking`. Another observation is that the value `final_result` read in function oximeter2_logs_results is always 92, regardless if the click sensor oximeter2 is connected to the board or not. --- The I2C_MasterTransferNonBlocking in function i2c_master_write_then_read would return kStatus_I2C_Busy because the transaction is in progress. This is related to the problem of being stuck in `while(!g_MasterCompletionFlag)` (for the moment this while loop is commented out). # 2022-09-05 ##### yu-capteurs branch in function "oximeter2_read_data" optimisation **Context:** The library "oximeter2.h" on branch yu-capteurs is essentially the same thing as the [example code](https://github.com/MikroElektronika/mikrosdk_click_v2/blob/master/clicks/oximeter2/example/main.c) from the official github repo of MikroElektronika except a few modifications. There are modifications because the cod on this gitlab branch yu doesn't use the "drv" libraries. The code connecting the drivers of the [nxp mcu sdk](https://github.com/NXPmicro/mcux-sdk/blob/main/drivers/i2c/fsl_i2c.h) and the example code provided by mikroelektronika has to be reinvened. **Problem/Confusion:** The function oximeter2_read_data from the MikroElektro official oximeter2 library has 4 register value catchers catching readings from the 4 channels(PD_{1,2,3,4}). I received warnings of "variable 'reg_addr{1,3}' set but not used". Will removing these two variables affecting anything? # 2022-août-30 L'objectif du jour: Lire un registre de l'oximètre via I2C. (sans succès) # 2022-août-29 L'objectif du jour: Découvrir le capteur oximètre 2 qui est une partie d'une LPC55S16 d'application 2 "centre de mesures". - Le LPC55S16 "doit faire des mesures à la fréquence programmée" via l'oximètre connecté. - Possibilité de forcer une acquisition. Ce forcement démarre le cycle de mesure. - Probablement forcer depuis le tableau de bord. ### To-do list for being able to read measurements from the oximeter 2 [x] Familiariser avec la bibliothèque d'i2c "fsl_i2c.h". [ ] Implémenter la communcation entre le LPC55S16 et l'oximètre 2 en utilisant cette bibliothèque.
CLICK ME IF YOU ARE CURIOUS

## LPC55S16-EVK setup > "The I2C interface of the codec is routed to Flexcomm 4 of the LPC55Sxx, the same connection as used for the other I2C devices on the board." (from "LPCXpresso55S16 Development Boards User Manual") Donc "I2C_MasterTransferCreateHandle(I2C4, &a_i2c_master_handle_t, i2c_master_callback, NULL);" ## Oximeter 2 Oximeter 2 utilise l'ADPD144RI pour la détection par photopléthysmographie de l'oxygénation du sang. ### ADPD144RI Son adresse d'esclave est 0x64. Il n'a pas un who_am_i. > The ADPD144RI samples bursts of synchronous pulses in two independent time slots, Time Slot A and Time Slot B, which occur sequentially within a sample period. > A burst accumulator sums the pulse energies into a 20-bit value. The number of pulses in each time slot is set in the top octet of Register 0x31 for Time Slot A and Register 0x36 for Time Slot B. Each time slot can contain 1 to 255 pulses. #### Les Registres Importants ![Example_SpO2_Setup_File](./img/Example_SpO2_Setup_File.png) *Page 22 de 34 de "ADPD144RI(Rev.A)"*

# Useful Tutorials from the Official nxp website - [AN12805 Establish Secure Connection with Private Cloud](https://www.nxp.com/docs/en/application-note/AN12805.pdf) - [Internal link for AN12805 Establish Secure Connection with Private Cloud](./tuto/AN12805.pdf) Keywords: secure TLS; WiFi; MQTT; openssl; Mosquitto - [LPC55S00 Security Solutions for IoT](https://www.nxp.com/docs/en/application-note/AN12278.pdf) - [Internal link for LPC55S00 Security Solutions for IoT](./tuto/AN12278.pdf)