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

Hang using serialport package under nRF Connect

I modified the BLE Low Enery app under nRF Connect (Windows), and fork a custom .js file to connect to a comm port.  The custom file requires 2 packages, fs and serialport.  Running the .js file using node.js works fine, but running via nRF Connect require('fs') works, but then require('serialport') hangs the .js.  The .js doesn't have console access so I write to a log file for debug and status.  Upon require('serialport') I get nothing, but otherwise nRF Connect continues to run. 

Any reason for this, or ideas on how to fix?

Parents
  • Do you have a production built nRFConnect Desktop (which version) or locally built from sources?

    Can I ask what do you mean by .js doesn't have console access?

    Can you open the dev-console (by Ctrl+Shift+I) and type require('serialport') there? Do you get error/undefined/function output, or does it hang?

    Do you have your sources available?

    BR, Bence

  • Yes, using production install of v2.5.0.

    No console because starting in Windows from icon, console.log() doesn't have a window to print in, and logger.info() from my called .js doesn't seem to go to the log window.

    Didn't know about Ctl+Shift+I.  Nice.  I get this, plus a big grey screen of "function SerialPort(.....blah, blah)" if I hover over the right spot, but it doesn't hang.

    require('serialport')
    ƒ SerialPort(path, options, openCallback) {
      if (!(this instanceof SerialPort)) {
        return new SerialPort(path, options, openCallback);
      }

      if (options instanceof Function) {
        openCallback = o…

    I have sources if you would like.  I only changed 2 files of the BLE Low Energy app, and added a .js and a config.json file.

    -Marty

Reply
  • Yes, using production install of v2.5.0.

    No console because starting in Windows from icon, console.log() doesn't have a window to print in, and logger.info() from my called .js doesn't seem to go to the log window.

    Didn't know about Ctl+Shift+I.  Nice.  I get this, plus a big grey screen of "function SerialPort(.....blah, blah)" if I hover over the right spot, but it doesn't hang.

    require('serialport')
    ƒ SerialPort(path, options, openCallback) {
      if (!(this instanceof SerialPort)) {
        return new SerialPort(path, options, openCallback);
      }

      if (options instanceof Function) {
        openCallback = o…

    I have sources if you would like.  I only changed 2 files of the BLE Low Energy app, and added a .js and a config.json file.

    -Marty

Children
Related