Skip to content

Commit

Permalink
RF24: Implement MY_RF24_INVERTED_ACK hack
Browse files Browse the repository at this point in the history
This hack allows better nRF24L01<-->SI24R01 interoperability

Signed-off-by: Andrew Andrianov <[email protected]>
  • Loading branch information
nekromant committed Jan 8, 2021
1 parent 8903b93 commit 06870a9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
42 changes: 42 additions & 0 deletions MyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,48 @@
#define MY_RF24_CHANNEL (76)
#endif

/**
* @def MY_RF24_INVERTED_ACK
* @brief Assume that this node's radio auto-ack bit is reversed
*
* Define this if this node has a wireless chip with AutoACK bit reversed
* compared to wireless chip in the gateway. Read this for more details.
*
* There are a dozen nRF24L01+ clones out there in the wild. A few of them (SI24R01)
* have their AutoACK bit inverted, due to a bug in the original doc they ripped off
*
* If this define doesn't help with your setup (and your clones are even weirder),
* here are a few more tricks:
*
* 1. Assign a static Parent ID and Node ID for your node.
*
* #define MY_NODE_ID 1
* #define MY_PARENT_NODE_ID 0
* #define MY_PARENT_NODE_IS_STATIC
*
* However you loose the automated 'mesh' organisation function of the network.
* That is not fun, but it's okay for some leak sensors that should have this static
* anyway.
*
* 2. Try different speeds. Some of the fakes I got don't play along with genuine
* chips nicely when the speed is 250Kbps. 1Mbps and 2Mbps work fine.
*
* 3. Put your finger on the PCB antenna. If the thing starts working, you are missing
* a 1 pF capacitor on the module. See this post:
*
* https://ncrmnt.org/2021/01/03/nrf24l01-fixing-the-magic-finger-problem/
*
*
* Obligatory reading material:
*
* https://sigrok.org/wiki/Protocol_decoder:Nrf24l01 - A list of clones and their 'features'
* https://hackaday.com/2015/02/23/nordic-nrf24l01-real-vs-fake/ - Hack-a-Day article describing the problem
* https://forum.mysensors.org/topic/9947/nrf24l01-si24r1 - mysensors forum thread
* https://ncrmnt.org/2015/03/13/how-do-i-cost-optimize-nrf24l01/ - Missing components on some COB fakes
*
*/
//#define MY_RF24_INVERTED_ACK

/**
* @def MY_RF24_DATARATE
* @brief RF24 data rate.
Expand Down
2 changes: 2 additions & 0 deletions hal/transport/RF24/driver/RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ LOCAL void RF24_setNodeAddress(const uint8_t address)
// enable node pipe
RF24_setPipe(_BV(RF24_ERX_P0 + RF24_BROADCAST_PIPE) | _BV(RF24_ERX_P0));
// enable autoACK on pipe 0
#ifndef MY_RF24_INVERTED_ACK
RF24_setAutoACK(_BV(RF24_ENAA_P0));
#endif
}
}

Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ MY_RF24_BASE_RADIO_ID LITERAL1
MY_RF24_ENABLE_ENCRYPTION LITERAL1
MY_RF24_CE_PIN LITERAL1
MY_RF24_CHANNEL LITERAL1
MY_RF24_INVERTED_ACK LITERAL1
MY_RF24_CS_PIN LITERAL1
MY_RF24_DATARATE LITERAL1
MY_RF24_IRQ_PIN LITERAL1
Expand Down

0 comments on commit 06870a9

Please sign in to comment.