Avatar for user94249

user94249

Member since Sep 2018 • Last active Mar 2019
  • 2 conversations
  • 11 comments

Most recent activity

  • Avatar for user94249

    Hi @Gordon
    I've figured out what the data in the arrays are.

    new Uint8Array([162, 4, 3, 10, 209, 1]).buffer
    162: NFC command for "write"
    4: Index for where to put data within tag array
    3: Type length
    10: Record length
    209: NDEF record header
    1: Type Name Field
    
    new Uint8Array([162, 5, 6, 84, 2, 101]).buffer   
    6: Payload Length
    84: Well known record
    2: Well known record type (in this case - the encoding for this text (UTF))
    101: e 
    
    new Uint8Array([162, 6, 110, 112, 111, 111]).buffer
    110: n - ("en" is locale)
    112: p
    111: o
    111: o
    
    new Uint8Array([162, 7, 254, 0, 0, 48]).buffer 
    254: Marks the end of the payload
    

    Further information on this can be found here.
    I am now able to send custom commands/string through NFC to Puck.js.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user94249

    Hi Gordon - Only just got around to looking at this one again - it seems to be working now (for whatever reason...)

    I have a much better understanding of how this all works too - I'm working on a way today read the data transmitted via NFC and action upon it based on whether it matches an expected format.
    I've got reading and writing working fine - but I'm tripping over the format of the data that's actually being sent. I'll spill my thoughts here, in case anyone else stumbles across this.
    When a 'write' command is sent to the chip, (if it complies to NTAG213/215/216) it'll be formatted like so:
    [[command code] [address of data to be changed] [data] [crc]]
    Pretty basic so far. But the NFC writer app that I'm using to test actually writes some prefix and suffix data, which makes it hard to find the data that I have specified to be written, as it is surrounded by metadata. Here is an example of a write sent to the chip (actually ends up being 4 write commands):

    new Uint8Array([162, 4, 3, 10, 209, 1]).buffer
    new Uint8Array([162, 5, 6, 84, 2, 101]).buffer
    new Uint8Array([162, 6, 110, 112, 111, 111]).buffer // <-- my data, following the 110, in ASCII
    new Uint8Array([162, 7, 254, 0, 0, 48]).buffer
    

    So the question I'm looking into is, what is the prefix/suffix data? And even if I wish to ignore this, there is no callback function on the tag to detect that it has finished being written to, so it's hard to locate my data afterwards - or even know when afterwards is.
    I'll keep the thread posted, for archive sake!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user94249

    I'm using Puck.js (Espruino v2.01) and I want to be able to manipulate variables based on data that is written to the NFC tag using NFCrx.
    If I use the 'NFCon' event, and console log based on that, everything works when I scan NFC:

    >NRF.on('NFCon', () => { console.log("test"); });
    =undefined
    test
    test
    test
    

    But when I use the NFCrx event instead, after NFCStart of course, the event callback is not called (almost as if the event is not registered):

    >NRF.nfcStart();
    =new Uint8Array([95, 193, 71, 81, 42, 138, 1, 165, 4, 3]).buffer
    >NRF.on('NFCrx', (rx) => { console.log(rx); });
    =undefined
    >NRF.on('NFCrx', (rx) => { NRF.nfcSend("test"); });
    =undefined
    >NRF.on('NFCrx', (rx) => { console.log("test"); });
    =undefined
    

    What am I missing?
    Thanks in advance

  • in General
    Avatar for user94249

    Ah of course! I know the code, but for some reason it completely slipped my mind that disabling the UART service would have that effect (duh).
    Cheers Gordon.

  • in General
    Avatar for user94249

    We actually have a bunch of Espruino Bluetooth devices here - which is why it's a bit confusing. The IDE actually worked for someone else with a Mac yesterday, but I can't for the life of me get it working - after trying on two separate Ubuntu machines and a Mac. See the attached image for our Espruino Bluetooth devices (prefixed with SB) showing up on the Web Bluetooth Example (gonna call it WBE so I don't have to keep typing that out)

  • in General
    Avatar for user94249

    Hi Gordon,

    When I click the connect icon, it says "select a port", with the (only) option being "web bluetooth". When clicked, it then opens the modal saying "no compatible devices found" (see attached image).
    But when I use the testing page mentioned before, the same prompt shows many devices. I can provide a screenshot of that too if you need.

    Thanks for the quick response!

  • in General
    Avatar for user94249

    Hi,

    I'm using the Espruino Web IDE on Google Chrome Version 69.0.3497.100 (Official Build) (64-bit) with Ubuntu 18.04.1.
    I have tried enabling web Experimental Web Platform features, running bluetoothd in experimental mode, and I still get the same error:

    Handling URL "https://www.espruino.com/ide/"
    Couldn't connect to wss://localhost:31234 - disabling websockets for this session
    ERROR: getURL("/serial/ports") error : Not Found
    /serial/ports doesn't exist - disabling WebSocket support
    ERROR: serial_frame: getPorts timeout, disabling
    >>> Connecting...
    Set Slow Write = true
    

    EDIT - From the browser console:

    index.js:81181 WebSocket connection to 'wss://localhost:31234/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
    ensureConnection @ index.js:81181
    index.js:78249 Couldn't connect to wss://localhost:31234 - disabling websockets for this session
    /serial/ports:1 Failed to load resource: the server responded with a status of 404 (Not Found)
    index.js:78259 getURL("/serial/ports") error : Not Found
    console.error @ index.js:78259
    index.js:78249 /serial/ports doesn't exist - disabling WebSocket support
    index.js:78259 serial_frame: getPorts timeout, disabling
    

    This isn't an issue with the browser's connection to the bluetooth adapter, as I can successfully find devices using the web-bluetooth testing page, so I know it's specifically a problem with the web IDE.

    I tried this on my Mac too, and the same problem occurred. Is the service down at the moment or ?

    I can provide screenshots upon request.

    Thanks in advance

Actions