nopnop2002 / Arduino-LoRa-Ra01S

An Arduino Library for LoRa Communication using SX1262/1268
MIT License
29 stars 10 forks source link

Running on Arduino UNO #6

Closed garudaonekh closed 1 year ago

garudaonekh commented 1 year ago

Hi, When I compile it for Arduino UNO, I got this error

21:35:24.546 -> begin
21:35:24.546 -> debugPrint=1
21:35:24.546 -> SX126x_SPI_SELECT=10
21:35:24.546 -> SX126x_RESET=9
21:35:24.546 -> SX126x_BUSY=2
21:35:24.546 -> SX126x_TXEN=-1
21:35:24.546 -> SX126x_RXEN=-1
21:35:24.581 -> Reset
21:35:24.581 -> ReadRegister:  REG=0x740  DataIn: 0 84 
21:35:24.581 -> syncWord=0x84
21:35:24.581 -> SX126x error, maybe no SPI connection

0x84 is SX126X_CMD_SET_SLEEP.

I use the following PIN configs:

SX126x  lora(10,               //Port-Pin Output: SPI select
             0xff,               //Port-Pin Output: Reset 
             2               //Port-Pin Input:  Busy
             );
nopnop2002 commented 1 year ago

The initial value of syncWord for this module is 0x1424.

21:35:24.581 -> syncWord=0x84

It indicates that the syncWord cannot be read correctly. SPI communication may not be performed correctly.


I use the following PIN configs: 0xff, //Port-Pin Output: Reset

This is incorrect.

SX126x  lora(5,               //Port-Pin Output: SPI select
             6,               //Port-Pin Output: Reset 
             7                //Port-Pin Input:  Busy
             );

Wireing

Ra-01S/SH UNO MEGA ESP8266
VCC -- 3.3V(*1) 3.3V 3.3V
GND -- GND GND GND
SCK -- D13(*2) D52(*2) IO14
MISO -- D12 D50 IO12
MOSI -- D11(*2) D51(*2) IO13
NSS -- D5(*2) D5(*2) IO2
RST -- D6(*2) D6(*2) IO0
BUSY -- D7(*2) D7(*2) IO16

(*1)
UNO's 3.3V output can only supply 50mA.
In addition, the output current capacity of UNO-compatible devices is smaller than that of official products.
So this module may not work normally when supplied from the on-board 3v3.

(*2)
SX126x is not 5V tolerant.
You need level shift from 5V to 3.3V.

garudaonekh commented 1 year ago

Thanks, I don't use RESET Pin to save pin and it works on ESP32 testinng. Is this fine because I only want to transmit data from sensor only.

nopnop2002 commented 1 year ago

If the RESET pin is not used, do not connect a wire to RESET. If you don't connect the wire, no RESET will be sent.

garudaonekh commented 1 year ago

Thanks I use Atmega16a instead and it works. it's way much cheaper than atmega328.