Getting started!

Today I got one of the Lora-modules hooked up to a breadboard. This took much more effort than it should have. If you want to buy some of these modules, I would recommend getting a version that has a 2.54mm pin spacing (if those exist), not metric 2mm ones. That should make things much easier when prototyping. Also make sure you know the pinout of the module. My seller didn’t include it. After some googling, I found the pinout of a board that looked suspiciously like mine, and visual inspection showed that the VCC and GND pins matched. Probing also showed that NSS matched, after which I just assumed that all the rest matched too.

I also added a 8 pin voltage level shifter module (bought on Ebay) to interface the 3.3V SX1278 to the 5V Arduino Uno. Unless I overlooked something in the datasheet, the I/O pins of the SX1278 are not 5V tolerant.

SX1278 hooked up to Arduino

Once the soldering smoke has lifted, it is time to take a look at the software side and get the SPI communication up and running. Looking at section 4.3 of the data sheet, the serial interface has CPOL = 0 and CPHA = 0, corresponding to Mode 0 on Arduino. The most significant bit is sent first (MSBFIRST parameter).

In order to talk to the chip, we need to make the slave select (NSS) pin low and then write an address byte with the most significant bit indicating read or write. If it is a write command, this is followed with one or more data bytes. You can write multiple consecutive registers, or in case you write to the FIFO buffer, write multiple message bytes.

As a test, I wrote a very simple program that reads out some registers and prints the result on the serial port. It worked the first time I ran it, displaying the same initial values as found in the data sheet. So now we can assume that the hardware is hooked up correctly and I can start exploring the chip’s functionality!

I created a github repository here: The aforementioned sketch is called read-registers.


Leave a Reply

Your email address will not be published. Required fields are marked *