This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Power Profiler Kit modification for long time measurements: Problem with npm

Hello,

my goal is to measure the average current consumption of an external chip connected to the Power Profiler Kit on Windows 7. Since the Software inside the nRF Connect App only allows a maximum of 120s, I want to modify the NodeJS source code and save all measured current values into an SQLite3 database. Afterwards I want to do the averaging by myself by evaluating the database file. My modification inside the Chart.jsx file starts like this:

const sqlite3 = require('sqlite3').verbose();

My problem is about including the sqlite3 module into the package. After using "npm install sqlite3" (I also tried many options like  --build-from-source or --save) there is the right directory in node_modules and the command "npm run dev" succeeds. But at runtime I receive the error: 

 Cannot find module 'C:\Users\MyUser\.nrfconnect-apps\local\pc-nrfconnect-ppk-master\...\node_sqlite3.node'

The required node file is actually located in C:\Users\MyUser\.nrfconnect-apps\local\pc-nrfconnect-ppk-master\node_modules\sqlite3\lib\binding\node-v57-win32-ia32
Any suggestions how to make the node file visible to the package? In the error message there are only the dots in the path, so I also don't know where the programm is searching for the file.

Hope you can help.

Kind regards,

Christian
Parents
  • My program is completed and works like a charm! Now I migrated it to Linux (Ubuntu 18.10, nRF version 2.6) and it occurs that the app is really unstable... Not only my modified code but also the default local repository.

    Only in rare cases it is possible to connect to the PKK Board. In most of the cases there is the error message: "Failed to start the PPK" and / or the program crashes. When I'm using the official version of the nRF Connect app (not my local compiled one) the problems do not occur.

    How can I fix the serial connection? I installed SEGGER, the udev rules and also ran "sudo usermod -a -G dialout <username>". I ran the program also as super user.

Reply
  • My program is completed and works like a charm! Now I migrated it to Linux (Ubuntu 18.10, nRF version 2.6) and it occurs that the app is really unstable... Not only my modified code but also the default local repository.

    Only in rare cases it is possible to connect to the PKK Board. In most of the cases there is the error message: "Failed to start the PPK" and / or the program crashes. When I'm using the official version of the nRF Connect app (not my local compiled one) the problems do not occur.

    How can I fix the serial connection? I installed SEGGER, the udev rules and also ran "sudo usermod -a -G dialout <username>". I ran the program also as super user.

Children
  • Hi Chris,

    The current PPK doesn't actually use serialport, it connects via nrfjprog library on top of JLink library.

    When you say you you migrated, what does that mean? Fresh install of Linux, upgrade? Do you use a git cloned nRFConnect or an official appImage? If cloned - after a pull did you remove/reinstall node_modules?

    I do not suggest to run any application as super user. It's not only going to give you access to some devices that you could gain access to by proper means, but also it will create/modify files and directories with wrong permissions that will be hard to track down later. Be sure your source, app directories, data directories are all user accessible.

    Could you also confirm nrfjprog version? You can check this in the app by opening the dev-console (Ctrl-Shift-I) and use this line:

    require('pc-nrfjprog-js').getLibraryVersion(console.log);

    One more thing, when using PPK, always connect the kit to the computer directly and not via a USB hub.

Related