Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPG not working if not connected to the debug board #8

Open
severinferard opened this issue Apr 8, 2022 · 1 comment
Open

PPG not working if not connected to the debug board #8

severinferard opened this issue Apr 8, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@severinferard
Copy link
Member

severinferard commented Apr 8, 2022

Describe the bug
PPG signal is only received while both part of the watch are connected to the debug board.

To Reproduce

  1. Flash test/unit/Max86141_connection/Max86141_connection.ino on the watch.
  2. Connect the Pogo to the watch (without the debug board).
  3. Open the serial monitor.

Expected behavior
The serial monitor should show the part id of the max86141, not 0.

If the same operation is carried out with both parts of the watch connected to the debug board, the connection works fine and data can be read from the sensor.

@severinferard severinferard added the bug Something isn't working label Apr 8, 2022
@severinferard
Copy link
Member Author

After further investigations, it appears that issue can be reproduced while connected to the debug board by touching (with bare fingers or probing with an oscilloscope) the MISO pins, either on the main board or on the ppg shield.

When looking at the MISO signal on an oscilloscope, we can clearly see a voltage drop during the transmission of the data, resulting in bits being perceived as 'zeros' by the master because their voltage is lower than the threshold needed to be read as 'ones'.
The following image is a capture on an oscilloscope of the MISO line and Clock line.
MISO_1Mhz
The 3 spikes which corresponds to 'ones' in the signal should be as high as the initial MISO signal.

FIX

It has been found that lowering the SPI Clock speed can fix the voltage drops issue, thus allowing for a solid connection between the watch and the ppg sensor.
Decreasing the CLK frequency from 1 Mhz to 100 khz allows for a stable connection between the watch and the ppg sensor, without the debug board and without hardware modification.

Further investigations

Here are 3 captures of the MISO signal, at respectively 100 Khz, 1 Mhz and 2 Mhz.
100 Khz
MISO_100khz
1 Mhz
MISO_1Mhz
2 Mhz
MISO_2Mhz

Here are 3 captures of the MOSI signal, at respectively 100 Khz, 1 Mhz and 2 Mhz.

100 Khz
MOSI_100khz
1 Mhz
MOSI_1Mhz
2 Mhz
MOSI_2Mhz

Because the clock speed appears to be the main factor, I've created a test to find the optimal clock speed. The test can be found in test/unit/SPI-clk-speed .
By reading the part id register of the max86141 which the value is constant and know, it is possible to plot the SPI read/write success rate depending of the clock speed, thus showing what is the maximum clock speed we can reach before the connection is no longer guaranteed. Results can be found in the 'results' folder.

Connected to the debug board
debugboard

Not connected to the debug board
standalone

The max clock speed we can set before the connection becomes unstable without the debug board appears to be around 450 Khz.

@severinferard severinferard added the good first issue Good for newcomers label Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant