ESP8266+Lora RFM95 (SPI)

Posted on
  • all new with espruino on esp8266.

    found the module https://www.espruino.com/SX127x same chip in the RFM95.

    RFM95 (868mhz) pinout attached:

    Really nothing happens here, the callback is not called.
    How to check if radio is working? how to debug those?
    thanks for any help.

    by the way does anybody knows how to avoid showing crap chars when reseting the board (before espruino logo).

    connections:

    ESP <--------------> RFM
    CLK (GPIO14/D5)  <-> SCK
    MISO (GPIO12/D6) <-> MISO
    MOSI (GPIO13/D7) <-> MOSI
    CS (GPIO15/D8)   <-> NSS
    ??? <-> RESET
    

    code:

    function loraHandler(err, data){
      if (err) console.log("RX ERROR");
      else console.log("RX>", data);
    }
    
    console.log("all starting on ESP8266...");
    SPI1.setup({ sck:D14, miso:D12, mosi:D13 });
    var sx = require("SX127x").connect({spi: SPI1, cs: D15});
    
    // Until DIO0 line irqs are implemented we need this:
    setInterval(function() { sx.onIRQ(); }, 100);
    
    var config = { rxContinuous : true };
    sx.setRxConfig(config);
    
    sx.rx(loraHandler);
    
    setTimeout(function() {
      console.log("going standby");
      sx.standby();
    }, 10000);
    
    // vim: ai ts=2 sts=2 et sw=2 ft=javascript
    

    and the output:

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v92 Copyright 2016 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 0xe0 chip 0x4016
    
    >all starting on ESP8266...
    =undefined
    Uncaught Error: Radio not found!
     at line 1 col 63
    ...ow Error("Radio not found!");this.setOpMode(0);this.mask(1,1­...
                                  ^
    in function called from system
    going standby
    >
    

    1 Attachment

    • esp8266.png
  • RFM95 pinout


    1 Attachment

    • rfm95w.jpg
  • Odd - if it's coming up with that Radio Not Found error then it'll be some kind of connection issue. It comes from this bit of code:

    https://github.com/espruino/EspruinoDocs­/blob/master/devices/SX127x.js#L338

    So basically the radio's VERSION register is returning 0 or 255, which implies that communications with the module aren't working. Is the module powered from 3.3v?

    It's possible that some of those pins are used for other things on ESP8266. GPIO15 is definitely pulled low normally, and HSPI sounds like the pins could be shared with the onboard flash? I guess some others here might be able to help with that.

  • Gordon thanks for the reply, and congrats I noticed the module also is yours :) really great work.

    Yah the module is powered (checked 3.3v on the module). Powered from pins between D4&D5 on ESP.

    Is It possible to use the gpios 6/7/8/11 for spi? How about reset pin?

    regards

    if anyone is interested, rfm95 manual attached


    1 Attachment

  • Thanks! Actually you might find software SPI easier. Just do:

    var spi = new SPI();
    spi.setup({ sck:D14, miso:D12, mosi:D13 }); // or whatever pins
    ...connect({spi:spi...
    

    And then you can use any pins.

    To do a quick check, you could also try shorting MISO to MOSI (without the module attached) and running spi.send("Hello") - Hello should get returned.

  • With softspi I got the hello back in the console :)
    connected a logic analyser and only got this repeated.... (could you take any conclusion from this)
    one question, I noticed the module doesnt have any dependencies.
    how do i work with the module locally (on command line)?
    "wget SX127x" and use require('./SX127x').connect doesnt seems to work.


    1 Attachment

    • Screen Shot 2017-07-09 at 23.06.02.png
  • Is It possible to use the gpios 6/7/8/11 for spi? How about reset pin?

    These are used by the internal flash chip - you will have issues if you use these pins!

  • those for soft spi are ok?

    var sx = new SPI();
    sx.setup({ sck:D0, miso:D4, mosi:D5 });
    sx = require('SX127x').connect({spi: sx, cs: D2});
    

    regards,

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

ESP8266+Lora RFM95 (SPI)

Posted by Avatar for mvcorrea @mvcorrea

Actions