Cannot connect to puck v1 when advertising

Posted on
  • When puck is advertising it is not possible to connect it via bluetooth.

    I use the npm espruino package on linux to connect to the puck and to upload code.

    After uploading this file

    const keys = {
      temperature: 0x1809,
      battery: 0x180f,
      someData: 0xfffe
    };
    
    function a() {
      digitalPulse(LED3, 1, 1000);
    
      const adData = {};
      adData[keys.battery] = [Puck.getBatteryPercentage()];
      adData[keys.temperature] = [Math.round(E.getTemperature())];
    //  adData[keys.someData] = [1, 2, 3, 4, 5];
      NRF.setAdvertising(adData);
    }
    
    setWatch((e) => a(), BTN, { repeat: true, edge: 'rising', debounce: 40 });
    

    it is possible to connect to the puck. Pressing the button to start advertisement does not change that.

    When slightly modifying the code to

    const keys = {
      temperature: 0x1809,
      battery: 0x180f,
      someData: 0xfffe
    };
    
    function a() {
      digitalPulse(LED3, 1, 1000);
    
      const adData = {};
      adData[keys.battery] = [Puck.getBatteryPercentage()];
      adData[keys.temperature] = [Math.round(E.getTemperature())];
      adData[keys.someData] = [1, 2, 3, 4, 5];
      NRF.setAdvertising(adData);
    }
    
    setWatch((e) => a(), BTN, { repeat: true, edge: 'rising', debounce: 40 });
    

    to advertise on an additional service id will change that. Once the advertisement is started by pressing the button I am not able to connect to the puck until it is reset.
    The behavior is not specific to this service ID.

  • What command are you using to connect? If you use the NRF Connect app to scan for devices what do you see?

    I believe what happens is you specify too many services to advertise, and then the Puck.js abcd name gets cropped down to make space for them. If you're trying to connect by name, the tools will no longer see the device name they expect

  • I'm using the espruino tools npm package cli tool to connect to the puck.

    Connecting with --port <MAC address instead of -d <deviceName> worked fine.

    Thanks for the hint!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Cannot connect to puck v1 when advertising

Posted by Avatar for palortoff @palortoff

Actions