I have two LoRa modules. One is set up against a Nano clone and seems to work (transmitter). A spectrum analyzer does say, I am transmitting something in the correct frequency area with a spectrum that looks like FSK.
Now, on the BadUSB SPI seems to be placed at pins D14-16 (not D11-13). The SPI pins (MISO, MOSI and SCK) are all dual marked along with the standard digital I/O names (D14-16) for the pins.
D12 and 13 do not seem to be externally accessible on a BadUSB Beetle.
I am using some standard SPI module. Heaven knows which and where it may be located. I have found several in the arduino-1.6.5-r5 directory structure.
The one I have looked into (hardware\arduino\avr\libraries\SPI, the only one being spi.cpp) does not seem to issue pins for SPI at all. No matter processor, board or what ever.
Has anybody successfully tried a Leonardo or BadUSB Beetle with a LoRa?
What am I not doing right?
Would an upgrade to a newer IDE help?
I am, of course, using Chinese clones all over, but should that be a problem?
Has anybody successfully tried a Leonardo or BadUSB Beetle with a LoRa?
You failed to provide information about the LoRa board you're using. With the Leonardo it works if the SPI connection is made by the ICSP header. It seems that your Beetle has the ICSP pins broke out on the right side of the board (marked MI, MO and SCK). So connect the SPI bus signals there and use another free pin for the CS, same for the LoRa reset signal. The interrupt signal (DIO0) should go to D2/D3 (SDA/SCL). Be sure to adapt the software accordingly.
I am, of course, using Chinese clones all over, but should that be a problem?
Yes, because they are usually missing any useful documentation! For example, post a link to the schematics of your BadUSB Bettle board! You cannot? That's what I mean.
NSS, Reset and DIO0 pins are connected to D10, D9 and D2. As specified in the LoRa.h file.
All three SPI signals connected as they are marked on both units.
Found some wiring errors, but still no joy. LoRa still fails initialization.
Have just found out, that on a Leonardo the SPI has a special connector, as Shannon also pointed out.
Maybe I should program the Beetle as a Pro Micro instead? It has SPI and D14-16 placed on the same accessible pins. (and still the same processor!)
At least something to try, when I get back from work.
I have not yet been able to find out which actual processor pins are in use for SPI on the various boards. It does seem to be on Port B pin 1-3, however. So maybe it does not matter, which 32u4 based board I simulate when programming a Beetle.
Have just found out, that on a Leonardo the SPI has a special connector, as Shannon also pointed out.
Maybe I should program the Beetle as a Pro Micro instead? It has SPI and D14-16 placed on the same accessible pins. (and still the same processor!)
It doesn't make a difference. Your device isn't a Leonardo nor a Micro, it just uses the same processor. Given that pin labels are correct, your wiring should work.
LoRa module in use:
That module runs on 3.3V. If you connected the signals directly to the 5V signals of your Leonardo clone you might have destroyed the module already. You must have a level converter in between.
I got it to work!
Turned out to be my well used breadboard that did not hold one or two of the wires from the LoRa module well enough.
Programming the Beetle as a Leonardo it is!
Next step will be implementing CRC. The manual for LoRa does say CRC is default enabled, but what I got through when 'squeezing' the connection did have errors. Alternatively the module still issues interrupts, if the CRC is wrong. That would also be different from default.
I can not see any access to CRC setup in the code. Commented out and not the correct calls, when looking into the LoRa.cpp file.
Of course, Mr Chinaman can have made modules with different default setups. or with CRC completely unavailable. I do have spare bits in my protocol to implement something in that case.