jnk0le / RFM7x-lib

library for ones of the worst of chinese nRF24l01+ "alternatives"
MIT License
67 stars 14 forks source link
bk2401 bk2411 bk2421 bk2423 bk2425 bk242x bk5811 counterfeit datasheet fake lcx24a nrf24l01 radio-modules rfm70 rfm73 rfm73p rfm75 sqi73 sqi75 undocumented

RFM7x library

This is library intended to use with radio modules based on bk2421/bk2423/bk2425 chips, commonly known as RFM70/RFM73/RFM75 or even more other rebrands like LCX24A(G?), TRW-24G2, SQI73/SQI75 and of course "not working" nrf24l01+ (cob) fakes. Also rare chips like bk2411/bk2412/bk5811 are also supported.

In order to force those modules to work as intended, special (undocumented of course) initialization sequence have to be followed:

  1. All "reserved & read-only" status registers in BANK0 have to be initialized - otherwise communication doesn't work after some power cycles (covered by rfm7x_init())
  2. BANK1 registers have to be initialized with predefined undocumented magic values which are different among datasheets for the same chip. (covered by rfm7x_init())
  3. All reserved registers in BANK1 have to be initialized. (covered by rfm7x_init())
  4. After power-up 1 or 2 bits in reg4(BANK1) have to be toggled. It might be necessary even after every power-up. (covered by rfm7x_toggle_reg4())

Every time the transmitter hits 15 retransmissions limit (no ACK received from called slave), MAX_RT interrupt request flag have to be cleared. Unlike the nRF24/SI24R1, in bk242x it is not enough, because PLOS_CNT is "overflow protected". In this case FLUSH_TX command have to be also executed, to unlock any further transmissions. (covered by rfm7x_mode_transmit())

In almost all nRF24 fakes, any kind of power noise, missing decoupling, or even anything around within few meters, may result in increased packet drop rate. Even though properly initialized bk242x chips are more stable than SI24R1, it still requires additional bypass caps.

how to examine fakes

Usually the exact fake model can be determined by exploiting specific features (including register dups), comparing overall module design or measuring current consumption. The following function should reveal any bk242x and SE8R01 (the one with only 3 components except cob and oscillator, not compatible) chip:

uint8_t rfm7x_is_present(void)
{
    uint8_t tmp1, tmp2;
    tmp1 = rfm7x_reg_read(RFM7x_REG_STATUS);
    rfm7x_reg_write(RFM7x_CMD_ACTIVATE, 0x53);
    tmp2 = rfm7x_reg_read(RFM7x_REG_STATUS);
    rfm7x_reg_write(RFM7x_CMD_ACTIVATE, 0x53);
    return (tmp1 ^ tmp2) == 0x80;
}

worst of the worst

component less cob fake

This is one of the most chinesed nRF24l01+ clone. It is assumed to be SI24R1 and always opens discussion about legality of missing RF filtering, but after some testing it turns out to be ordinary bk2425. If we look at schematics, there is not much missing:

ncrmnt observations compared to bk2425 datasheet left side from: https://ncrmnt.org/2015/03/13/how-do-i-cost-optimize-nrf24l01/

NO_ACK bit

The re-marked nRF24L01P (+) clones are not 100% register compatible. The issue with the counterfeit devices is that when they enabled “Dynamic Payload Length” (EN_DPL) in the "FEATURE" register, one bit get’s activated in the on-air payload (the NO_ACK bit) This bit should be active high (according to the Nordic datasheet), but it’s actually implemented the other way around. When EN_DPL is activated, the NO_ACK bit get reversed in the real nRF-devices. They did such a good job of cloning they cloned the datasheet error into the device!!!

Inversion of NO_ACK bit in the air payload can be controlled by the undocumented compatible mode bit in one of the bank1 registers. It can also be changed with simple RFM7x_CONFIG_COMPATIBLE_MODE macro in config header.

high power mode

AN0007 describes "non-existent" settings for high power/current mode in bk2423 (rfm73). It is said to output up to 15 dBm and require additional low-pass filter to pass FCC tests. bk2425 seems to not include this feature.

current in normal mode current in high power mode
bk2423 current normalpower mode bk2423 current hipower mode

bk2423 hipowercircuit

PA/LNA modules

Standalone RFM's were not weird enough so the 'P' version was introduced.

RFM70P/73P

Those modules requires hardware modification to act as a regular rfm7x with auto retransmissions and ACK. It has been done back in 2013 here.

RFM75P

This module uses bk2425 chip which is a (BOM) cost optimized one, thus it doesn't have VDDPA output. Internal PA seemed to leak some DC offset into antenna path, so it could be somehow possible to extract TREN (TXEN) signal.