1 Star 0 Fork 1

Lee Lup Yuen 李立源 / lora-sx1276

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

BL602 LoRa Driver for Semtech SX1276 / HopeRF RF96

Ported from Apache Mynewt OS to BL602...

https://github.com/apache/mynewt-core/tree/master/hw/drivers/lora/sx1276

Read the articles...

Connect BL602 to SX1276

The pins are defined in include/sx1276.h

Note that BL602 Pins are mapped to specific SPI Functions, so not all SPI Pins may be remapped.

BL602 Pin SX1276 / RF96 Pin Wire Colour
GPIO 0 DIO1 Dark Green
GPIO 1 ISO (MISO) Light Green (Top)
GPIO 2 Do Not Connect (Unused Chip Select)
GPIO 3 SCK Yellow (Top)
GPIO 4 OSI (MOSI) Blue (Top)
GPIO 5 DIO2 Blue (Bottom)
GPIO 11 DIO0 Yellow (Bottom)
GPIO 12 DIO3 Light Green (Bottom)
GPIO 14 NSS Orange
GPIO 17 RST White
3V3 3.3V Red
GND GND Black

From include/sx1276.h:

#define SX1276_SPI_IDX      0  //  SPI Port 0
#define SX1276_SPI_SDI_PIN  1  //  SPI Serial Data In Pin  (formerly MISO)
#define SX1276_SPI_SDO_PIN  4  //  SPI Serial Data Out Pin (formerly MOSI)
#define SX1276_SPI_CLK_PIN  3  //  SPI Clock Pin
#define SX1276_SPI_CS_PIN  14  //  SPI Chip Select Pin
#define SX1276_SPI_CS_OLD   2  //  Unused SPI Chip Select Pin
#define SX1276_NRESET      17  //  Reset Pin
#define SX1276_DIO0        11  //  DIO0: Trigger for Packet Received
#define SX1276_DIO1         0  //  DIO1: Trigger for Sync Timeout
#define SX1276_DIO2         5  //  DIO2: Trigger for Change Channel (Spread Spectrum / Frequency Hopping)
#define SX1276_DIO3        12  //  DIO3: Trigger for CAD Done
#define SX1276_DIO4        -1  //  DIO4: Unused (FSK only)
#define SX1276_DIO5        -1  //  DIO5: Unused (FSK only)
#define SX1276_SPI_BAUDRATE  (200 * 1000)  //  SPI Frequency (200 kHz)
#define SX1276_LF_USE_PA_BOOST  1  //  Enable Power Amplifier Boost for LoRa Frequency below 525 MHz
#define SX1276_HF_USE_PA_BOOST  1  //  Enable Power Amplifier Boost for LoRa Frequency 525 MHz and above

(CAD = Channel Activity Detection. We detect whether a Radio Channel is in use, by scanning very quickly for the LoRa Packet Preamble)

Demo Firmware

To transmit and receive LoRa packets with the driver, run the sdk_app_lora BL602 Demo Firmware...

Here's a sample log...

# create_task

# init_driver
SX1276 init
SX1276 interrupt init
SX1276 register handler: GPIO 11
SX1276 register handler: GPIO 0
SX126 register handler: GPIO 5
SX1276 register handler: GPIO 12
TODO: os_cputime_delay_usecs 1000
TODO: os_cputime_delay_usecs 6000
SX1276 DIO3: Channel activity detection

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca6
Rx done: 
48 65 6c 6c 6f 

# spi_result
DIO0 Interrupts: 1
DIO1 Interrupts: 0
DIO2 Interrupts: 0
DIO3 Interrupts: 1
DIO4 Interrupts: 0
DIO5 Interrupts: 0
Unknown Int:     0
Tx Interrupts:   302
Tx Status:       0x0
Tx Term Count:   0x0
Tx Error:        0x0
Rx Interrupts:   302
Rx Status:       0x0
Rx Term Count:   0x0
Rx Error:        0x0

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca6
Rx done: 
48 65 6c 6c 6f 

# spi_result
DIO0 Interrupts: 2
DIO1 Interrupts: 0
DIO2 Interrupts: 0
DIO3 Interrupts: 1
DIO4 Interrupts: 0
DIO5 Interrupts: 0
Unknown Int:     0
Tx Interrupts:   354
Tx Status:       0x0
Tx Term Count:   0x0
Tx Error:        0x0
Rx Interrupts:   354
Rx Status:       0x0
Rx Term Count:   0x0
Rx Error:        0x0

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca6
Rx done: 
48 65 6c 6c 6f 

# spi_result
DIO0 Interrupts: 3
DIO1 Interrupts: 0
DIO2 Interrupts: 0
DIO3 Interrupts: 1
DIO4 Interrupts: 0
DIO5 Interrupts: 0
Unknown Int:     0
Tx Interrupts:   406
Tx Status:       0x0
Tx Term Count:   0x0
Tx Error:        0x0
Rx Interrupts:   406
Rx Status:       0x0
Rx Term Count:   0x0
Rx Error:        0x0

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca6
Rx done: 
48 65 6c 6c 6f 

# spi_result
DIO0 Interrupts: 4
DIO1 Interrupts: 0
DIO2 Interrupts: 0
DIO3 Interrupts: 1
DIO4 Interrupts: 0
DIO5 Interrupts: 0
Unknown Int:     0
Tx Interrupts:   458
Tx Status:       0x0
Tx Term Count:   0x0
Tx Error:        0x0
Rx Interrupts:   458
Rx Status:       0x0
Rx Term Count:   0x0
Rx Error:        0x0

# receive_message
SX1276 receive timeout
Rx timeout

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca8
Rx done: 
48 65 6c 6c 6f 

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca8
Rx done: 
48 65 6c 6c 6f 

# receive_message
SX1276 receive timeout
Rx timeout

# receive_message
SX1276 DIO0: Packet received
Rx done: RadioEvents.RxDone=0x23000ca8
Rx done: 
48 65 6c 6c 6f 
--- Revised BSD License --- Copyright (c) 2013, SEMTECH S.A. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Semtech corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH S.A. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

LoRa Driver for Semtech SX1276 on BL602 and BL604 展开 收起
C 等 2 种语言
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/lupyuen/lora-sx1276.git
git@gitee.com:lupyuen/lora-sx1276.git
lupyuen
lora-sx1276
lora-sx1276
main

搜索帮助