Si4463 Radio Library for AVR and Arduino

This is a library for use with the Si4463 radio IC from Silicon Labs, used (or will soon be) in some of my projects. The Si4463 is configurable in a ton of different ways with options for modulation, packet format, CRC algorithms and has a high output power of up to +20dBm (100mW). The Si4463 is used in a number of pre-made modules like the HopeRF RFM26W and Dorji_Com DRF4463F. The whole range of Si446x transceivers should also work with this library.

This library configures the chip to send and receive variable length packets of up to 128 bytes and uses callback functions for when events occur, such as receiving a new packet and completing a packet transmission. The callback functions run straight from the interrupt routine allowing the program to react much faster to events than if the library was polled.

Download from GitHub
Documentation

Pinout

Si4463 ATmega328 Arduino Uno Arduino Mega Description
VCC 3.3V 3.3V 3.3V Power (3.3V)
GPIO0
GPIO1
SDO B4 (18) 12 50 SPI MISO
SDI B3 (17) 11 51 SPI MOSI
SCLK B5 (19) 13 52 SPI SCK
NSEL B2 (16) 10 10 SPI SS
NIRQ D2 (4) 2 2 Interrupt
SDN D5 (11) 5 5 Shutdown/reset – High = on, Low = off
GND GND GND GND Ground


The Si4463 is not 5V compatible, you’ll need to do some level conversion to bring the 5V IO voltage down to 3.3V.

Callbacks
This library uses callbacks which are ran when events occur. Since the callbacks run from the interrupt routine be sure that any global variables you use in them are declared ‘volatile’, just as you would when dealing with normal ISRs. These events will wake the microcontroller if it is sleeping. Some callbacks can be turned on and off using Si446x_setupCallback() and Si446x_setupWUT().

Event Callback Default setting
New packet incoming SI446X_CB_RXBEGIN Off
Valid packet received SI446X_CB_RXCOMPLETE Always enabled
Invalid packet received SI446X_CB_RXINVALID Always enabled
Transmission of packet complete SI446X_CB_SENT Off
Wakeup timer expired SI446X_CB_WUT Off
Supply voltage below threshold SI446X_CB_LOWBATT Off

Wakeup timer (WUT)
The Si4463 can be configured to periodically wake up using the wake up timer (WUT). When the wake up timer is active and the radio is put into sleep mode it consumes a tiny 900nA. When the WUT expires the SI446X_CB_WUT callback is ran. The low battery detector uses the wake up timer to initiate a supply voltage measurement. If the supply voltage is below the threshold set by Si446x_setLowBatt() then the SI446X_CB_LOWBATT callback will be ran.
Calculating the correct mantissa (M) and exponent (R) values for the WUT can be a little difficult so here’s a calculator:

WUT Calculator
Interval (seconds)
R
M
Resolution
Actual interval
-

Compatible chips/modules

Device Tested
Si4460 Not tested
Si4461 Not tested
Si4463 Works
Si4467 Not tested
Si4468 Not tested
HopeRF RFM26W Works
Dorji_Com DRF4463F Works

Radio configuration
The radio configuration is quite complex. Wireless Development Suite (WDS) can be used to create different configuration header files:

  1. Open WDS (can sometimes take a while to load, also try clicking on the center logo)
  2. Choose 'Simulate radio'
  3. Scroll down and select 'Si4463'
  4. Make sure the Revision is set to 'C2'
  5. Click 'Select Radio' button
  6. Select 'Radio Configuration Application'
  7. Click 'Select Application' button
  8. Click Open (top right of the window) and choose config_normal.xml from the GitHub repo

Areas to avoid changing

  • Packet tab
    • Don't change anything in the 'Packet config' and 'Variable length config' tabs
  • Interrupt tab
    • Don't change any of these settings
  • GPIO and FRR tab
    • Only change GPIO 2 and 3 if your module uses different pins for the RF TX/RX switch
    • Don't change NIRQ and SDO
    • Don't change Fast Response Register A and B

To generate the header file containing the new config

  1. Click 'Generate source' (bottom right)
  2. Choose 'Save custom radio configuration header file'
  3. Save the file somewhere
  4. The generated config file can't be used just yet, WDS has a few options missing. A Perl script (and a Windows .exe version of it) is provided in the GitHub repo - perl radio_config.pl radio_config_Si4463.h radio_config.h will read radio_config_Si4463.h and output to radio_config.h. With the Windows .exe the input header file can be dragged on top of the exe and it will output to radio_config.h. Or to do this manually follow the fix up instructions below, though the manual way won't remove unnecessary settings.

Manual config header fix up

  1. Remove any '#include' lines (usually just 1 around line 41)
  2. In 'RF_POWER_UP' define change the second value from 0x81 to 0x01 (normal power up without any patch stuff)
  3. In 'RF_GLOBAL_CONFIG_1' define change the 5th value (GLOBAL_CONFIG) from 0x20 to 0x30 (puts the FIFO into single 129 byte mode)
  4. In 'RF_PKT_RX_THRESHOLD_12' define change the 6th from last value (PKT_FIELD_2_LENGTH_7_0) from 0x3F to 0x80 (sets max packet length to 128)
  5. Remove the 'SI446X_PATCH_CMDS' and 'RF_GLOBAL_CONFIG_1_1' lines from the 'RADIO_CONFIGURATION_DATA_ARRAY' define

Sometimes the defines may not be called RF_GLOBAL_CONFIG_1 and RF_PKT_RX_THRESHOLD_12, in which case search for the field name instead (GLOBAL_CONFIG or PKT_FIELD_2_LENGTH_7_0) and change the corresponding value.

GPIOs
The Si4463 has 4 GPIO pins (numbered 0 to 3) which can be configured in a number of ways, however 2 of the GPIOs are used to control an RF TX/RX switch on most pre-made modules. By default the library configures GPIO2=HIGH when receiving and GPIO3=HIGH when transmitting, this works for the RFM26W and DRF4463F. Most other modules use this same configuration, but check anyways.

Library coding tips

  • When the radio is put to sleep with Si446x_sleep() it will automatically wake up when its SPI select line is asserted. Once SPI communication has finished the Si446x_sleep() function must be called again to put it back to sleep.
  • Si446x_setupWUT() will take 300us to complete if the WUT was previously disabled.

Range Testing
Using the config_longrange_500 config in the GitHub repo and driving around a fairly flat village/country area I managed to receive a valid packet at 2.2 km (1.37 miles) and 3.79 km (2.36 miles) for an invalid packet. This was done using a 3dBi antenna shown below instead of the sort that are normally supplied with radio modules.

Transmitter setup

14 comments

Skip to comment form

    • Hendrik on December 1, 2017 at 6:53 am
    • Reply

    Hi Zak,

    I just want to find out if your si4463 Library for Arduino can be used to receive in RAW/Direct mode?

    Thanks
    Hendrik

    1. Hey Hendrik, no the library only supports packet mode. Direct mode requires code to read and write to a GPIO pin on the module. Though, you might be able use this library to configure the module and then use VirtualWire (http://www.airspayce.com/mikem/arduino/VirtualWire/) to send and receive the data.

    • Tri Dao on January 12, 2018 at 7:54 am
    • Reply

    WOA…this is all things I need, I’m Viet Nam with limitted sources about this chip, and I’m finding docs for my RF projects (I have some modules Si4464 and they’re OK)
    I’m gona working hard with your project and it will take me a long time because I only have a little bit experiments about Si446x and coding with them ! 😀
    Anyways…Thanks you so much, Zak!

    • Puls Flag on January 29, 2018 at 4:35 pm
    • Reply

    Hi Zak,
    this seems to be a great work!
    I’ll try to get it work with the Si4460….

    Can the NIRQ-Pin be used with PCINT1_vect = Vectror Number 5 (ATmega 328) ?

    Many Thanks!
    Puls

    1. Hey Puls,
      The interrupt define value is the INTx number, not the raw vector number, so 5 won’t work, only 0 and 1 for the mega328. You’ll need to modify the library a little to use PCINTx.
      Modify Si446x_irq_off() and Si446x_irq_on() to use the correct registers and bits for PCINT1, and change the ISR vector name near the bottom of the library code to use PCINT1_vect. I think that’s it.

    • Puls Flag on February 2, 2018 at 5:00 pm
    • Reply

    Hey Zak,
    great, works fine!
    And all my SPI stuff, like display, also works fine. That’s really great!

    But I got an issue using the UART library of Peter Fleury ( http://homepage.hispeed.ch/peterfleury/avr-software.html ).
    Waiting for RF data using while(pingInfo.ready == PACKET_NONE); the UART doesn’t seem to react to any external input correctly anymore. The UART0_RECEIVE_INTERRUPT Peter is using, seems to work on incomming data, but reading the RX receive buffer, it always shows only a size of 2 counts, although it should be 9 (in my case).
    Commenting out the line with waiting for RF data, all UART stuff works fine again…
    Do you have any idea what to do, as UART-communication would be really useful?

    Many thanks and once again:
    You did an awesome job!!
    Puls

    1. while(pingInfo.ready == PACKET_NONE) will block the program until a packet is received, which also includes reading from the UART library buffer (though it should be able to buffer up to 32 characters by default, not sure why yours is only going to 2). It can be made non-blocking pretty easily by placing all the Si446x example code in the main while(1) loop into in if(pingInfo.ready != PACKET_NONE){ (code here) } and then have your stuff after the if().

    • Sachin on March 23, 2018 at 5:26 am
    • Reply

    Hi Zac,

    The Windows .exe file to convert the WDS generated file no longer works. I am using WDS version 3.2.11.0. Any idea why? Please let me know,

    Thanks,
    Kind Regards,
    Sachin

    1. Hey Sachin, in what why does the .exe not work, what does it say? WDS 3.2.11.0 is the version I’ve been using too.

    • Saurav Paudel on May 14, 2018 at 1:58 pm
    • Reply

    Can we set frequency of transmission by calling any function directly?

    1. Hey Saurav, no not in this library. Changing the frequency isn’t as simple as setting a single register like on some RF chips. The Si4463 needs to have a bunch of PLL synthesizer fractional and divider values and probably more things calculated. So instead the library just uses channels, which by default has a base frequency of 433MHz and each channel increments by 250KHz.

        • Saurav Paudel on May 14, 2018 at 3:54 pm
        • Reply

        Ahh got it, Thank You.

    • Puls Flag on May 14, 2018 at 8:54 pm
    • Reply

    Hi Zak,

    last time I build up a transmission with 2 HOPE RFM24W modules at 868MHz and transferring data with your library worked quite fine.
    Now I build my own module with an Si4460 rev. b1 (which is used in RFM24W module), but no data transmission is possible with the RFM24W module.
    The RFM24W module uses a 30MhZ external crystal and my setup uses a 26MHz crystal, as suggested by silabs.
    I modified the WDS file for my setup and used a simple RF-explorer to see what happens, while being in fast TX-mode.
    Both modules (RFM24W and my setup) show the same transmission frequency at 868,204 MHz with nearly the same signal strength.
    Unfortunately I don’t have the equipment to view the RF-data.

    Do you have any idea where I go wrong?

    Many thanks for your help!
    Puls

    1. Hah, it’s kinda difficult to say whats wrong. Are you able to test a 30MHz crystal on your own module? Try putting your module in receive mode and monitor the RSSI signal level when the RFM24W is transmitting, does your module sense the transmission?

Leave a Reply

Your email address will not be published.

Are you human? *