In wireless communication, the nrf24l01 wireless transceiver module produced by Nordic is the choice of many players. It is GHz ~ The single-chip wireless transceiver chip in the GHz ISM band has the advantages of strong functions, convenient control, and low price. One piece of nrf24l01 can receive data sent from six channels at the same time, and change the communication channel to avoid wireless communication interference. The following briefly introduces the use of this chip.
Two single-chip microcomputer are used for wireless communication. One model is stc90c51 16rd +, and the receiver is nrf24l01.
The other is stc12c5a60s2, And the transmitter is nrf24l01.
I. Hardware
1> pin Introduction
Pin 1: Gnd, ground end; pin 2: VCC, 1.9v ~ 3.6 V
Pin 3: Ce, nrf24l01 Mode Controller
Pin 4: CSN, chip selection Signal
Pin 5: sck, SPI clock input
Pin 6: MoSi, SPI data input
Pin 7: miso, SPI data output end
Pin 8: IRQ, interrupt output end, low level enabling, that is, interrupt output low level
The power supply should not exceed 3.6 V, or the chip may be damaged.
For port pins, the voltage can be 5 V, that is, the TTL port can be connected.
2> Working Mode
3> enhanced shockburst Mode
The default mode of nrf24l01 is the enhanced shockburst mode, which can be automatically applied. In this mode, the single-chip microcomputer can be reduced and the program can be simplified. This time, the system will send and receive data by default.
In this mode, the communication protocol is as follows:
Send to the sender (with prim_rx low): After the sender starts sending, the CE pulls at least 10 US high, and the sender sends data. After sending the data, the sender uses channel 0 to receive the terminal's reply to the ASK signal, if no ask is received, the sender resends the same data packet until the response signal is received or the number of resends exceeds the set maximum. If the maximum number of times is exceeded, A MAX-RT interruption occurs, and IRQ outputs Low. If the ASK signal is received, tx_ds is interrupted if the sending is deemed to be successful.
For the receiver (configured with prim_rx as high): After the receiver starts receiving, the CE pulls at least 10 us. If the received data passes CRC verification, it is stored in rx_fifo.
4> Data Channel address configuration method
In the figure, the address width is 5 bytes.
You can configure zero-address 32-bit data for the nrf24l01 (sender and receiver) channel.
For the receiver, the first 4-byte addresses in Channel 1-Channel 5 must be the same, and the fifth byte cannot be the same.
For the sender, the channel 0 address must be the same as the Sending address, and must be the same as the recipient's communication channel address!
5> SPI instruction settings
Each Complete instruction must be written through a CSN change from high to low.
6> SPI Instruction format
When accessing a multi-byte register, you should first read/write a low byte High. If the SPI write operation is completed before the multi-byte register is written, the high byte content remains unchanged.
For interruptions, if 1 is written to tx_ds, rx_dr, and max_rt, the interrupt response is blocked.
7> SPI timing
When writing the registers in nef24l01, it must be in standby or power-down mode!
8> register table
There are 18 registers in total. for point-to-point communication, the nrf24l01 only uses less than 10 registers. For other registers, the default configuration can be maintained. For details, see program configuration. For register description, see Datasheet of Nordic.
Ii. Software
Next article: Continue,""
**************************************** **************************************** ********************************
Please consult: http://shop108408772.taobao.com/
**************************************** **************************************** ******************************
The single-chip microcomputer is based on the wireless communication of the 4G wireless transceiver module nrf24l01 (basic test passed)