USB-RF application with SX1272 LoRa modem
Overview
The USB-RF application implements a USB Virtual COM Port which sends and receives data by SX1272 LoRa long range radio modem.
Load the USB-RF firmware in XRange board
Connect the ST-Link or other JTAG probe to XRange board.
Download the source code of the USB-RF application from GitHub USB-RF source code.
Open the USB-RF project with EmBlocks Free IDE from Examples/EmBlocks/USB-RF.
Set the parameters of LoRa modem in main.c the more important parameters are in bold
tLoRaSettings LoRaSettings =
{
870000000, // RFFrequency
20, // Power
0, // SignalBw [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved]
7, // SpreadingFactor [6: 64, 7: 128, 8: 256, 9: 512, 10: 1024, 11: 2048, 12: 4096 chips]
1, // ErrorCoding [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
true, // CrcOn [0: OFF, 1: ON]
false, // ImplicitHeaderOn [0: OFF, 1: ON]
0, // RxSingleOn [0: Continuous, 1 Single]
0, // FreqHopOn [0: OFF, 1: ON]
4, // HopPeriod Hops every frequency hopping period symbols
500, // TxPacketTimeout
1000, // RxPacketTimeout
128, // PayloadLength (used for implicit header mode)
};
Build the project from main menu Build -> Build target or press F7
Configure the JTAG probe from Debug -> Interfaces
The project is configured for ST-Link/V2 if you use other JTAG probe you have to configure it.
Load the firmware in XRange board from Debug -> Start/stop Debug Session or press F8.
Next run the program with Continue Button.
Install the USB driver in Windows
Windows will install the usb driver automatically if there is a problem you can download it from here.
Repeat the same procedure for second XRange module.
Test the communication between the modules
Obtain the COM Port names from control panel.
Set-up serial terminal program (you can use PuTTY )
Connect the the terminal program to Virtual COM Ports.
When you type something in one terminal programme you should see the text in the other terminal programme.
Install the USB driver in Linux
Linux will install the driver automatically when you connect the XRange board.
Obtain the names of COM ports with dmesg
[ 111.189584] usb 2-1.2: new full-speed USB device number 4 using ehci-pci
[ 111.276957] usb 2-1.2: New USB device found, idVendor=0483, idProduct=5740
[ 111.276962] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 111.276965] usb 2-1.2: Product: STM32 Virtual COM Port
[ 111.276968] usb 2-1.2: Manufacturer: STMicroelectronics
[ 111.276970] usb 2-1.2: SerialNumber: 222CDDD3FFF9
[ 111.277239] cdc_acm 2-1.2:1.0: This device cannot do calls on its own. It is not a modem.
[ 111.277257] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[ 114.352148] usb 1-1.3: new full-speed USB device number 6 using ehci-pci
[ 114.439520] usb 1-1.3: New USB device found, idVendor=0483, idProduct=5740
[ 114.439525] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 114.439528] usb 1-1.3: Product: STM32 Virtual COM Port
[ 114.439530] usb 1-1.3: Manufacturer: STMicroelectronics
[ 114.439533] usb 1-1.3: SerialNumber: 4136BEC9FFF5
[ 114.439995] cdc_acm 1-1.3:1.0: This device cannot do calls on its own. It is not a modem.
[ 114.440019] cdc_acm 1-1.3:1.0: ttyACM1: USB ACM device
Run serial terminal program (for example gtkterm ) with root privileges
gtkterm --port /dev/ttyACM0
gtkterm --port /dev/ttyACM1
Recent Comments