IRNAS / ppk2-api-python

Power Profiling Kit 2 unofficial python api.
http://irnas.eu
GNU General Public License v2.0
145 stars 37 forks source link

Wrong values read on Mac #37

Closed N0ury closed 1 year ago

N0ury commented 1 year ago

OS: Big Sur (version 11.7.9) Plateform: MacBook Pro ppk2-api version: 0.9.2 Python version: 3.11.4 Serial port created: /dev/cu.usbmodemCE82F38621862

I have used the same script on Windows 11, Mac and Linux. On Windows results are the same with the script and with nRF Power Profiler app. On Mac results are same as on Windows when using nRF PP app, but wrong when using the script. On Linux results are good.

Ex: ~1.5mA appears as ~5uA with ppk2-api on Mac.

Can someone help me to find the cause and correct it. I have taken a look at _digital_to_analog method. It seems good. Just one thing int.from_bytes gives results different from struct.unpack with format "i". I have also taken a look at _handle_raw_data but I haven't understood anything :-(

Any help is welcome. I can do any tests one would like to do.

Thanks

N0ury commented 1 year ago

Is it related to #7 ?

N0ury commented 1 year ago

After several tests, it works today on Mac. Maybe a hardware issue, I do my tests on a breadboard. Also I've done my tests today on higher current 60mA vs 1-2mA yesterday. I close this issue. I'll reopen it if necessary.

NejcKle commented 1 year ago

Just as a note, the data stream from the PPK2 can get misaligned, due to multiple sources accessing the serial port at the same time. We have seen this happen when using the PPK2 ourselves, and the symptoms are showing in the form of wrong current readings.

RehabAbdAllah commented 2 months ago

@NejcKle I am seeing this .. how to avoid this from happening ?