Use of 2.4G wireless communication module NRF24L01 on Cortex M[Copy link]
The NRF24L01 module is a 2.4GHz communication module. The output power, channel selection and protocol settings can be set through the SPI interface. It can be connected to almost all microcontroller chips and complete wireless data transmission. One of the characteristics of NRF24L01 is its extremely low current consumption: when working in transmit mode, the current consumption is 11.3mA when the transmit power is 0dBm, and 12.3mA in receive mode. The current consumption is even lower in power-down mode and standby mode. After several days of debugging, I realized the communication between two Cortex M devices. NRF24L01 module pin diagram
Study notes Due to the clock limit of NRF24L01 itself not exceeding 10Mhz, the SPI clock of 72Mhz should be divided by 8 at least. When writing data to NRF24L01, give the chip CSN pin a low level, first send the position of the register to be written, and then send the value to be written. If the write is successful, 0xFF will be received, and finally the CSN pin will be set high. When reading the NRF24L01 register, give the chip CSN pin a low level, first send the position of the register to be read, and then send 0xFF, then the data of the register corresponding to this position will be received; by continuously sending 0xFF, the data of the next register can be received in sequence, and finally the CSN pin will be set high. After configuring the address register address, you can call NRF24L01_RxPacket(Buf) to receive data or NRF24L01_TxPacket(Buf) to send data. The length of the data is 32 uint8, that is, 32 bytes. The specific operation is not described here. If you want to perform one-to-many communication, you need to configure the send register of each Slave to be the same as the receive register of the Master, and indicate which Slave you are in the sent data. The Master can traverse the receive register of the Slave to communicate with each Slave. NRF24L01 wireless chip test:
In this test, I used a Cortex-M4 configured as a Master and a Cortex-M3 configured as a Slave. The Master sends data to the Slave every 100ms. If the Slave receives this data, it will beep. The transmission speed and power consumption have not been tested yet