GIPdA / ZetaRF

Arduino Library for SiLabs Low Current Sub-GHz Wireless Transceiver: Si4455 (ZETA modules), Si446x (DRF4463F modules)
BSD 3-Clause "New" or "Revised" License
13 stars 7 forks source link

Library install for Arduino #16

Closed jazzjohn27 closed 1 year ago

jazzjohn27 commented 1 year ago

Arduino 1.8.19 IDE compiler generates error ZETA.h: No such file or directory

GIPdA commented 1 year ago

Hello, Can you give more details? e.g. in what file and line, what board, etc this error shows up. AFAIK, no ZETA.h file exists on this repo (and probably never did), so I have no clue where that comes from, and I can't test right now.

jazzjohn27 commented 1 year ago

Thank you for the response. Below is the code from the manufacturer.

/* Arduino-Uno Sample Code For ZETA Module useing library.

Company: RF SOLUTIONS
web site: http://www.rfsolutions.co.uk

Sample code sends a 12byte packet out every 600ms can be recived on sample rx code and seen on a terminal program as #R--0123456789 .
*/

// Include spi Lib

include // include SPI

include // RF Solutions Library for ZETA CODEC

/* // define controls fro LEDs

define SSEL 10 // slave selact pin for SPI

define SDN 9 // sleep pin High = Sleep low = Active

define IRQ 8 // Interupt request from CODEC

*/

define TX_LED 7 // ON Board TX LED Controled Via arduino pin 7

define RX_LED 6 // On Board RX LED Controled Via arduino pin 6

byte RxData; // rx data byte byte PLength; // Packet lencth read from FIFO

zeta ZETA; // Name the class for use with the library

void setup() {

ZETA.Init(); // setup ZETA SPI Bus and IO config also setup uart for 19200 baud

ZETA.Zeta_Ready(); // wait for codec to init ready for next command;

// ZETA.Set_RF_Baud(0X02); // set RF baud to 9k6

}

void loop() {

delay(600);

  ZETA.Send_Packet(0x00, 0x0C);        // send a paket on channle 0, 12bytes long   
     ZETA.Write_Byte(0x30);            
     ZETA.Write_Byte(0x31);            // packet received on ZETA-LIB-RX sample = 0, 1, 2, 3, 4, 5, 6, 7 ,8 ,9 <CR LF>
     ZETA.Write_Byte(0x32);            // dispalyed on a terminal program. 
     ZETA.Write_Byte(0x33);
     ZETA.Write_Byte(0x34);
     ZETA.Write_Byte(0x35);
     ZETA.Write_Byte(0x36);
     ZETA.Write_Byte(0x37);
     ZETA.Write_Byte(0x38);
     ZETA.Write_Byte(0x39);
     ZETA.Write_Byte(0x0D);          
     ZETA.Write_Byte(0x0A);
  ZETA.Close_Send();                   // Close send TX data called to finnish data packet. 

}

GIPdA commented 1 year ago

This code does not make use of the ZetaRf library. I think their code needs their "codec" IC or something, which is an extra layer on top of the ZETA module, but I don't know much more. You can replace all of that with this library (ZetaRf) and connect your Arduino board directly to the ZETA module on the SPI bus. See the readme and try the examples ;)

jazzjohn27 commented 1 year ago

Thank you. I will give it a try and report back.

jazzjohn27 commented 1 year ago

questions: What should this line be for the 900Mhz radio? ZetaRf868<ZetaRf::nSEL<10>, ZetaRf::SDN<9>, ZetaRf::nIRQ<8>> zeta;

Also, how can I tell which GPIO pins the code is using (so I can make the proper connections)?

Sorry for asking for help in the "issues" section. If I should be communicating elsewhere, please let me know.

Thanks.

GIPdA commented 1 year ago

The lib doesn't have 915MHz configs yet. I added them in the ZIP file joined, replace the current library with the content of this archive, and use this line : ZetaRf915<ZetaRf::nSEL<10>, ZetaRf::SDN<9>, ZetaRf::nIRQ<8>> zeta; (ZetaRf915_VL is also available for variable length data)

I don't have 900MHz modules to test, so please try and let me know how it works. ;) I'll add the configs to the repo later on. You can also get to 900MHz with the 868MHz config: channels are 250kHz apart, 900MHz = channel 128 (max 255)

For the GPIO, it's using the default SPI pins (MISO, MOSI, SCK, what pins they're on depends on which board you're using) and the 3 pins in the previous line : ZetaRf::nSEL<10>, ZetaRf::SDN<9>, ZetaRf::nIRQ<8> === pin 10 (NSEL, or chip select), 9 (SDN / Shutdown) and 8 (IRQ) (these 3 can be changed to other pins)

Posting here is fine, no worries.

ZetaRF 915.zip

jazzjohn27 commented 1 year ago

Program does not get beyond setup() and printing "ZetaRf begin failed..." I added the line for the 915 radio and used the new library file you provided. Here's my wiring for the Arduino Nano. Please tell me what I'm missing. 20230426_144439

GIPdA commented 1 year ago

SPI wiring seems good, but SDN and IRQ are definitely needed too. If you're short on GPIOs, it may be possible to avoid them, but let's start with the default config ;)

If you don't have another level translator for the Arduino outputs, just add a 10k or so resistor in series, or a voltage divider (dividing by 2 is fine). You can bypass the level translator for Arduino inputs (SDO, IRQ).

GIPdA commented 1 year ago

If it still doesn't work with the proper wiring, I would try with the 868MHz config just to check against a possible error in the 915MHz configs.

jazzjohn27 commented 1 year ago

Thank you! Please tell me exactly which pins on the Nano to use for SDN and IRQ.

GIPdA commented 1 year ago

The defaults are: ZetaRf915<ZetaRf::nSEL<10>, ZetaRf::SDN<9>, ZetaRf::nIRQ<8>> zeta; Pin 9 for SDN Pin 8 for nIRQ

jazzjohn27 commented 1 year ago

OK, Init works now! Will test two communicating and report back. Thanks!

Communication works!

What is the RSSI range of values? At about 20ft apart, I'm seeing about 150.

GIPdA commented 1 year ago

👍🏻 The RSSI to dBm formula is detailed in the datasheet (approximation based on SiLabs Pico boards) : RSSI dBm = RSSI_value/2 – 130 150 = -55dBm, which is a fairly normal signal strength, not too good, not too bad. A very bad signal would be about -90dBm. Very good is around -20dBm.

emanuelefalli commented 1 year ago

Hi, I'm commenting under this still open issue, because I have the same difficulty in wiring. I first tried with an Arduino UNO R3 but then eventually found your comment about the 5V I/O and switched to an Arduino Nano BLE 33. However, I'm not able to go past the initial setup of the module also with the Arduino Nano. I'm using a Zeta 915 D and I downloaded the zip file from this chat and moved it in the libraries folder. I still haven't soldered a wire as antenna to the transceiver, because I first wanted to get the code working. I'm not sure if that might be the issue

I'm not sure if I'm missing something else. The current pinout I'm using is (on the Arduino Nano) with ZetaRf915<ZetaRf::nSEL<10>, ZetaRf::SDN<9>, ZetaRf::nIRQ<8>> zeta; 2 | GND --> gnd 3 | SDN --> 9 4 | Vcc --> 3.3 V 5 | nIRQ --> 8 9 | SCLK --> 13 10 | SDI --> 11 11 | SDO --> 12 12 | nSEL --> 10

I hope it's clear. Thanks for the help

jazzjohn27 commented 1 year ago

@emanuelefalli That's the wiring I used along with level translators (for the Nano). I will try to eliminate the translators for the Zeta inputs with resistor dividers. I don't know what could be wrong if your connections are correct unless there's some difference in I/O use for the BLE.

emanuelefalli commented 1 year ago

Yeah, I also double checked the pinout schematics on the Arduino Nano 33 BLE and it's the same, also the I/O voltage is 3.3 V so that shouldn't be the problem. Have you soldered an antenna wire before trying to upload the code?

jazzjohn27 commented 1 year ago

No soldered antenna, just a little wire plugged into a breadboard. I also tried it with no antenna and it works that way too. I don't think the antenna has any effect on the initializing phase.

GIPdA commented 1 year ago

@emanuelefalli Your wiring is good, so I would look into the integrity of said wiring? Use a continuity tester to check everything while unpowered, then a voltmeter to check power supply. A scope or a logic analyser would be useful. AFAIK it should work.

The Si4455 IC is quite resistant to over voltage (I've managed to power some at 5V by mistake for quite some time, but I wouldn't recommend it!), but it may be fried. Have you tried with other modules ? A missing antenna won't be a problem. I would avoid transmitting without one though (could damage the PA stage, even if at the given power it should be fine).

emanuelefalli commented 1 year ago

Thank you so much for both the feedbacks, I'll try to check the wiring integrity and the over voltage issue (I have two 915 transceivers at the moment, but I have left them wired to two Arduino UNO for 4-5 hours, so that might have caused some issues).

GIPdA commented 1 year ago

One more thing you can do is enable some debug in the library: uncomment the line ZETARF_DEBUG_ON in ZetaRf.hpp (line 18), and the debugln lines in ezradiosi4455.hpp, function loadConfigurationArray (line 108). I suspect you'll get "Init failed: Command timeout"_ (line 160), which means an SPI comm failure (usually faulty wiring). Anything else would probably mean the module is responding but the config fails for some reason.

emanuelefalli commented 1 year ago

Thanks for suggestion! I did activate the debug and got command timeout error like you said. I also checked the wires and they are okay. I also replaced all of them with new ones as well but with no results. I suspect the module is not working, because I'm not sure what else might be wrong.

GIPdA commented 1 year ago

That's unfortunate! There's not much left, all I can think of is very improbable, like a power supply failing under load (but there's not much load at init...), the Arduino's SPI peripheral not working right/badly configured somehow (I highly doubt it). But most likely your Zeta modules are dead. You didn't say on what you wired everything, if it's on a breadboard I would check for shorts between pins and shorts to ground as a last resort. If you use long wires, try with short ones (I usually use ~5cm). In _zetarf_arduino_spihal.hpp:L15 you can reduce the SPI speed (10MHz by default) to 1MHz or less in the event of capacitive interferences that may happen with breadboards (I've never had issues though). Otherwise... I guess you'll need new modules! You may be interested in the Dorji DRF4463F modules which are cheaper but less convenient to use in a prototyping application due to their very fine header pitch. They otherwise work great and have slightly better RF performances. Ebyte also has some compatible modules (Si44xx), and some amplified.

emanuelefalli commented 1 year ago

Hi! It was definitely a problem of the previous transceiver which died. I ordered the new ones and got them to working with the example code for fixed length of the data. However I am going to open another issue because I am not able to communicate with variable length. Thank you so much for helping with this issue!

GIPdA commented 1 year ago

Hey! Good news, glad you resolved it. I'm going to close this one as it was resolved.