Problem connecting to MetaMotionR using Javascript SDK after upgrading firmware to 1.4.2

Hi, I have several MetaMotionR devices. I'm writing a JavaScript script to connect and access them. One of the devices I can connect to fine (firmware 1.4.1) and the other I can't (firmware 1.4.2). The one that I can't connect to using the Javascript SDK, I can connect to via the MetaBase app and I can see it in the nRF Connect app but I can't see it in the JavaScript code. I have tried just scanning for all devices as well as for the specific address of each device. I have several others with the same issue (I don't have them with me at the moment). Is there something that needs to be changed in order to connect to them? Can I revert back to an older version of the firmware? I don't want to upgrade the one that is working until I can solve the problem of connecting to it. Thanks

Comments

  • edited September 17

    I just tried via Noble directly and I can see the device there, just not through the MetaWear SDK. I've done a soft reset as well but still no luck with the MetaWear SDK.

    I also tried with noble-device, but this time it only connected but didn't go any farther which is does with the earlier firmware.

  • edited September 18
    • What is the hardware revision of the boards?
    • Post a minimal script that reproduces the issue.
    • You can use MetaBase to revert to back to v1.4.1

    I haven't seen any connection issues with the v1.4.2 firmware with this simple connect script:

    var MetaWear = require('metawear');
    
    MetaWear.discoverByAddress(process.argv[2].toLowerCase(), device => {
    //MetaWear.discover(function (device) {
      console.log('discovered ' + device.address);
      device.connectAndSetUp(error => {
        if (error) {
          console.log(error);
          process.exit(1);
        }
        console.log('connected ' + device.address);
        // Stop logging after 10 seconds
        setTimeout(function () {
          console.log('time to disconnect')
          device.once('disconnect', reason => {
            process.exit(0);
          });
          MetaWear.mbl_mw_debug_reset(device.board);
        }, 10000);
      });
    });
    
  • edited September 18

    Here's the script (the one that doesn't work, just hangs, it never discovers the device):

    var MetaWear = require('metawear');

    //MetaWear.discoverByAddress("c0:4f:26:cf:7e:77",function(device){ //1.4.2 doesn't work hardware 0.1
    MetaWear.discoverByAddress("e2:94:7b:2d:39:69",function(device){ //1.4.1 works hardware 0.1
    console.log("got em");
    console.log(device);

    //you can be notified of disconnects
    device.on("disconnect",function(){
        console.log("we got disconnected, bummer!!");
    }); //disconnect
    
    //you'll need to call connect and setup
    device.connectAndSetUp(function(error) {
        console.log("we're connected!!!");
    
        setTimeout(function(){
            device.disconnect(function(error) {
                console.log("disconnect call finished");
            }); //disconnect
        }, 1000);//timeout
    });//setup
    

    });//discover

    How do I revert back to 1.4.1? What do I put in for the DFU from Version?

  • edited September 18

    I tried your script too. Same results, the 1.4.1 works fine, the 1.4.2 hangs and never gets discovered.

    I'm running Node.js version 8.11.3 on Mac OSX 10.13.6

  • Hrm, I was testing on Linux (Tumbleweed, kernel 4.18.0), same Node version. Are you using a USB BT adapter or the integrated radio?

  • edited September 18

    Integrated radio. I can also see the device service uuid and characteristics if I use just the noble library. I have trouble with noble-device, it hangs just like the metawear sdk.

    How do I revert back to 1.4.1? What do I put in for DFU version or is it better to download a file? If so, where do I get that? I have an extra one that I can keep trying things with you to see what the problem is, I just need to get the other ones working so my students can use them this week.

  • Try using an external usb adapter. Also, try using the Swift SDK to connect the device.

    You put in "1.4.1" in DFU version.

  • Unfortunately, I don't have an external USB adapter.

    I can see and connect to the device using everything (the Metabase App, the nFR Connect App, Swift SDK) but the Javascript SDK

    I reverted back to 1.4.1 and everything worked fine. I re-updated the firmware to 1.4.2 and it is now working.

    I just updated the other device to 1.4.2 and that one worked right off.

    Not sure if something happened during the original upgrade? I will try this process on the other devices tomorrow. Hopefully it will fix all of them.

    Thanks for your help!

  • UPDATE: The downgrading and upgrading or just downgrading didn't work for all of the devices. What seems to be happening now, is the devices still seem to think they are paired with a specific computer. For example, one device will be discovered and connect to my computer and then disconnect. If I try to then connect to that device from any other computer using the Javascript SDK, it won't work. Similarly, I got another of the devices to connect to a computer in our lab, but now I can't connect to it on my computer even though it's been disconnected. Are the devices keeping any sort of information that might prevent them from pairing with a different device? Is there any way to "reset" the devices? I tried "reset" in the metawear app.

  • Also scanning using:

    var noble = require('noble'); // import the noble library

    //Bluetooth ON or OFF
    noble.on('stateChange', function(state) {
    if (state === 'poweredOn') { // if Bluetooth is on
    console.log("start scanning");
    noble.startScanning(); // start scanning
    } else { // if Bluetooth is off
    noble.stopScanning(); // stop scanning
    console.log("Please check that Bluetooth is turned on.");
    }
    });

    // runs when a peripheral is discovered from a scan:
    noble.on('discover', function(peripheral) {
    // bundle the name, UUID, MAC address,
    // and received signal strength up in a JSON object:
    var peripheralData = {
    "name": peripheral.advertisement.localName,
    "uuid": peripheral.uuid,
    "MAC address": peripheral.address,
    "rssi": peripheral.rssi
    }
    // print it out:
    console.log(JSON.stringify(peripheralData));
    });

    The ones I can connect to I get mac addresses for, the other ones I can see the uuid, but not the mac address.

  • No, the boards should connect once disconnected from the previous device. Given that you said you didn't have issues with the Swift SDK and I am not seeing any issues on the Linux side, this could be an issue with the Mac specific portion of Noble.

    The BLE scan result is interesting though as the mac address should always be in the scan response. I wonder if you would see the same behavior if you used CBCentralManager to do the device scan.

Sign In or Register to comment.