• 'Spending countless hours on details others just left out ore did not think of to matter made me chip up the few extra bucks to buy Espruino hardware for which the Espruino Firmware and Software was built for[...]'

    Although I love how Espruino is currently implemented, I think I'll prefer donating directly to support the project instead of buying the boards. At the price points, donating and buying a Raspberry Pi Zero W makes more economical sense to me while allowing me to use fully featured JS and toolchains and not really supporting the "board building" effort part of the project. You guys seem to be more experienced than me with microcontrollers so maybe I'm just missing the point, please enlighten me. The fact I'm running JS and Wifi from this 2$ chip is what makes it interesting to me.

    Btw, I liked your abstraction layer for pin mapping[...]

    Thank you. Thinking about it, it would work, by using D pins instead of Numbers, essentially recreating a NodeMCU-like prefix for my board.

    At this point I'll share my exact errors and test script for reference and documentation.
    There doesn't seem to be a spoiler feature on the Forum so sorry for the long post.

    I built a script to test everything using the console :

    const MFRC522 = require("MFRC522");
    var nfc;
    var spi;
    
    const SPI_PINS = {
      sck: D14,
      miso: D12,
      mosi: D13
    };
    
    function softwareSPI() {
      spi = new SPI();
      spi.setup(SPI_PINS);
    }
    
    function hardwareSPI() {
      SPI1.setup(SPI_PINS);
    }
    
    function connect(_spi) {
      nfc = MFRC522.connect(_spi, D15);
    }
    
    function log(c) {console.log('Card : ', c);}
    
    function test() {
      nfc.findCards(log);
    }
    
    // softwareSPI() or hardwareSPI()
    // connect(spi) or connect(SPI1)
    // test()
    

    As you can see, it's not doing much at upload time, only definitions. I then run the commands that are commented, using the Espruino IDE console.

    Hardware SPI results :

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0x20 chip 0x4016
    >
    >hardwareSPI()
    =undefined
    >connect(SPI1)
    =undefined
    >test()
    Uncaught Error: MFRC522 Request Error 12
     at line 1 col 189
    ...("MFRC522 Request Error "+a);a=this.r(20);return this.ra(18,...
                                  ^
    in function "req" called from line 1 col 34
    this.w(26,7);return 0<this.req(38).length
                                     ^
    in function "isNewCard" called from line 1 col 16
    this.isNewCard()&&a(this.getCardSerial()­)
                   ^
    in function "findCards" called from line 1 col 18
    nfc.findCards(log);
                     ^
    in function "test" called from line 1 col 6
    test()
         ^
    

    Software SPI results :

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0x20 chip 0x4016
    >
    >softwareSPI()
    =undefined
    >connect(spi)
    =undefined
    >test()
    =undefined
    

    To make sure, I double checked that each D pins referenced was the actual physical pin I was plugging into, so I'm fairly sure that my wiring is fine, again.

    Removing each pin one by one changes the error code :

    All pins connected : Error 12
    Without NSS pin :    Error 158
    Without SCK :        Undefined
    Wihtout MOSI :       Undefined
    Without MISO :       Error 255
    Swapping MISO and MOSI : Error 255
    
    

    I'll try to dissect the MFRC522 library a little more tonight. If that doesn't do it, I'll wait for the NodeMCU and I'll try to get another RC522 module from another mfg. My local supplier seems to like Keyestudio alot.

    I may try flashing to an earlier version of Espruino too. Just in case.

    EDIT: typo 2020-01-01

About

Avatar for Drumline18 @Drumline18 started