Avatar for user97106

user97106

Member since Jan 2019 • Last active Jan 2019
  • 2 conversations
  • 11 comments

Most recent activity

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

    I agree with what you have said. In fact I have already implemented the code you are drawing my attention to, but because it didn't work I decided to try to at least get something basic working,i.e. an echo 0x55.
    I have an Arduino on order so I'll give that a try and see what turns up.
    Thanks again for your help.

  • Avatar for user97106

    Results...

    Using this code...

    function echo(){
        var r=spi.send(0x55,SS_PIN);
       print("echo response:",r);
    }
    

    Gives me this...

    echo response:  6
    echo response:  0
    echo response:  0
    echo response:  0
    echo response:  0
    echo response:  0
    echo response:  85
    echo response:  85
    echo response:  255
    echo response:  255
    echo response:  255
    echo response:  255
    echo response:  255
    

    Tried the inventory function as written above and got lots of these (while scanning a tag)...

    Got data new Uint8Array(0)
    

    I think it might be necessary to set the NFC protocol before doing this.
    Anyway, you have helped in confirming I haven't been doing anything really silly, which is really want I wanted. Fresh eyes.

  • Avatar for user97106

    Thanks for getting back to me. Really appreciate your help.
    Interesting points. I've tried a few of your suggestions, nonetheless happy to try again.
    To answer your questions first.

    • I do have SS_0 pulled high.
    • Yes, I think I have tried the wrapper and I think that for sending command to the tag via the NFC. But I will try that again.
    • Also tried the inventory stuff, but will again, try again.

    Will get back to you soon with results...

  • Avatar for user97106

    So, here's the problems I am having with interfacing by SPI to BM019.
    Before I show the code and output here are some points of note;

    1. The code is just for test to see if I can get consistent communications going.
    2. I'm sending 0x55 (85) because the BM019 documentation says this should just echo back 0x55.
    3. I have tried just about every permutation and combination I can think of in terms of pins high/low, implementing in different ways to make it faster etc. I've spend quite some hours on this so this is my last shot before I switch to Arduino.
    4. I've checked my wiring loads of times and haven't spotted anything wrong there.
    5. It seems odd that I sometimes get a 0x55 response, which is why I suspected a timing issue.
    6. The BM019 documentation says I have to do a wake-up pulse so that' what I do first.
    7. I am using software SPI here, but I find the same result on hardware SPI.
    8. The output follows the code below. Note, inconsistency of output.

    If anyone has any suggestions they will be most grateful received :-)

    Here's the code...

    print("Setting up SPI");
    var spi=new SPI();
    
    spi.setup(
      {
        sck:D19,
        miso:D22,
        mosi:D20,
        mode:0,
        order:'msb'
      }
    );
    
    var WAKEUP_PIN=D17;
    var SS_PIN=D18;
    var LOW=0;
    var HIGH=1
    
    var d=digitalWrite;
    function echo(){
        "compiled";
        d(SS_PIN, LOW);
        r=spi.send(0x55,SS_PIN);
        d(SS_PIN, HIGH);
    }
    
    // Send wake upfirst after giving Espruino time to load code.
    d(WAKEUP_PIN, HIGH);
    setTimeout(function(){  
      setTimeout(function(){
        d(WAKEUP_PIN, LOW);
        setTimeout(function(){
          d(WAKEUP_PIN, HIGH);
          setTimeout(function(){
            setInterval(function(){
              echo();
            },1000);
          },1000);
        },10);
      },1000);
    },2000);
    

    Here's the output...

    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v01 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >Setting up SPI
    echo response: 12
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 5
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 20
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 0
    echo response: 1
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 85
    echo response: 245
    echo response: 255
    echo response: 255
    [etc. ...]
    
  • in Puck.js, Pixl.js and MDBT42
    Avatar for user97106

    Ok, I want to see if I can get SPI to work first. I know Arduino will work with BM019 and I have ordered one, but I like the Espruino package so I want to persevere with that for now until I have exhausted all options/ideas.

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

    That's interesting. I am seeing FIFO_FULL messages, though again, not consistently. Anyway, as I said I'll do some more testing, capture the output and get back to you.

  • Avatar for user97106

    Thanks for sorting that out, although I haven't had a chance to test yet, I will so as soon as I can.

    Interesting what you say. I will do as you suggest when I'm back in the office.

    My suspicions have been raised because of the intermittement nature of the reponse from the BM019 board. Anyway, I'll get an update to you soon as I am keen to sort this out.

Actions