NRF24E1 transceiver is a system level RF chip launched by Nordic VLSI. Advanced 0.18 M CMOS process, 6 6mm 36 pin QFN package, based on nRF2401 RF chip structure, integrates RF, 8051mcu, 9-input 10 bit ADC, 125 channel, UART, SPI, PWM, RTC and WDT into a single chip, with internal voltage regulator (working voltage 1.9 3.6V, recommended working voltage 3.3V) and VDD voltage monitoring, and the channel switching time is less than 200 s. The data rate is 1Mbps, the maximum RF output decibel is 0dB, and external saw (sound meter) is not required Filter. NRF24E1 is the first and universal low-cost RF system level chip with a transceiver band of 2.4GHz. It is suitable for wireless keyboard and mouse, wireless handheld terminal, wireless frequency identification, digital video, remote control, automotive electronics and other short-range wireless high-speed applications. 1 Introduction to nRF24E1 1.1 microprocessor the instruction system of nRF24E1 microprocessor is compatible with the instruction system of industry standard 8051, but their instruction execution time is slightly different. Generally, the execution time of each instruction of nRF24E1 is 4 20 clock cycles, while that of industry standard 8051 is 12 48 clock cycles. NRF24E1 increases ADC, SPI and R compared with industry standard 8051 Five interrupt sources are f receiver 1, RF receiver 2 and wake-up timer; three timers are the same as 8052. NRF24E1 contains one UART which is the same as 8051. Under the traditional asynchronous communication mode, timer 1 and timer 2 can be used as UART (serial port) In order to facilitate data transfer with the external RAM area, the CPU of nRF24E1 also integrates two data pointers, and the clock of its microcontroller directly comes from the crystal oscillator. The functional module diagram of nRF24E1 is shown in Figure 1.
There are 256b data RAM and 512b ROM in the microprocessor. After power on reset or software reset, the processor automatically executes the code in the boot area of the ROM. the user program is usually loaded from E2PROM into a 4KB RAM (the ram can also be used to store data) under the guidance of the boot area. If the mask ROM (i.e. the included ROM) is not used in the application , the program code must be loaded from the external nonvolatile memory. It is common to extend E2PROM through SPI interface, and the model is recommended to be 25320. Compared with the standard 8051, the microcontroller of nRF24E1 adds some new functions, so some special function registers are added accordingly to control these new functions. The new special function registers are rad IO (P2), adccon, adcdatah, adcdatal, adcstatic, pwmcon, pwmduty, etc. in the microcontroller of nRF24E1, the registers of P0 and P1 ports are also different from those of standard 8051, and other special function registers are the same as those of standard 8051. 1.2 PWM and SPI interface nRF24E1 has a programmable PWM output.
During use, dio9 (i.e. p0.7) can be changed by program It can be programmed to determine that PWM works in 6-bit, 7-bit or 8-bit. The three ports of SPI are reused with GPIO (din0, dio0 and dio1) and RF transceiver. SPI hardware does not generate any chip selection signal. Generally, GPIO bit (P0 port) is used As the chip selection port of external SPI equipment. 1.3 RTC wake-up timer, WTD and RC oscillator. There is a low-power RC oscillator in nRF24E1, which can work continuously when VDD 1.8V, independent of the application. RTC wake-up timer and WTD (watchdog) It is two 16 bit programmable timers whose working clock is lp_osc of RC oscillator.
The timing time of wake-up timer and watchdog is about 300 S 80ms, and the default value is 10ms. 1.4 the A / D converter nRF24E1 has 9 channels of 10 bit ADC, and the linear conversion time is 48 CPU instruction cycles per 10 bits. The 9 inputs of the A / D converter can be selected by software. Channels 0 7 can convert the voltage values on the corresponding pins ain0 ain7 into digital values, and channel 8 is used to monitor the working voltage of nRF24E1. The A / D converter works at 10 bits by default Mode, which can work in 6-bit, 8-bit or 12 bit mode through software. 1.5 wireless transceiver nRF24E1 transceiver communicates with other modules through internal parallel port or internal SPI port, and its function is the same as that of single-chip RF transceiver nRF2401. The data standby signal output by duoreceiver receiver can be turned into microprocessor interrupt signal through program or transmitted to CP through GPIO port U. NRF2401 operates in the global open 2.4G 2.5GHz frequency band. The transceiver consists of a complete frequency synthesizer, a power amplifier, a regulator and two receivers. The output power, channel and other RF parameters can be controlled by programming the special function register radio (0xa0). In the transmitting mode, the RF current consumption is only 10.5ma and in the receiving mode, 18ma (energy saving can be achieved by program controlling the on / off of the transceiver). 2 Basic knowledge of wireless keyboard wireless keyboard uses wireless mode to communicate between keyboard and PC. the wireless module is generally realized by RF technology or Bluetooth technology.
Due to the complex protocol, high cost and long development cycle of Bluetooth technology, many wireless keyboards use RF technology to realize wireless connection. In the field of RF, Nordic VLSI company of Norway The performance of our RF chips is very outstanding. Our products mainly include nRF401 series, nRF903 series, nRF2401 series and nRF24E1 series. This paper introduces the design method of using nRF24E1 to realize wireless keyboard.
Most wireless keyboards are powered by batteries, so many energy-saving technologies are needed. For energy-saving purposes, many wireless keyboards do not use "num lock", "caps lock" and "scroll lock" on wired keyboards These three LED indicators. In addition, the wireless keyboard should reasonably and effectively use the RF module. The RF data packet from the keyboard to the PC may contain up to 8 keystrokes. The keyboard scanning matrix is scanned about 500 times per second. Generally, no more than 1 keystroke is detected in each scanning cycle. Because people can't feel the detection delay of 150ms, when the keyboard detects 1 keystroke and sends After sending the RF data packet to the PC, it can be idle for more than 150ms until the next key is pressed, which can minimize the working time of the RF module  3. For the keyboard that only needs to send data, the use of nrf24e2 can meet the needs of the general keyboard. If the keyboard is required to not only send information, but also receive feedback from the PC, nRF24E1 needs to be used as the wireless module in the keyboard. Two way transceiver is more conducive to ciphering, packet retransmission and energy saving when the system is turned off. 3 The application of nRF24E1 in wireless keyboard 3.1 keyboard scanning matrix the interface mode between nRF24E1 and wireless keyboard is shown in Figure 2. The common PC keyboard has 104 keys, while the keyboard matrix shown in Figure 2 has 8 rows and 20 columns, and up to 160 key switches can be defined. During the design process, some keys can not be defined. Each key is arranged at the intersection of rows and columns. When the key is pressed In order to scan the keyboard matrix, nRF24E1 sends the column scanning signal to the shift register in sequence. The column scanning signal consists of 1 "0" and 19 "1" and "0" Move backward bit by bit in the shift register, and the status of the keyboard row is scanned once for each move. If a key in this column is pressed, the row value corresponding to the key is "0" and others are "1".
In the process of keyboard scanning, the key may shake, so the problem of de jitter should be considered when writing software. Common de jitter methods: once the system detects that a key is pressed, it will delay 30 50ms before detecting the key. If the detected key state is still pressed, the key will be treated as pressed once. 3.2 system software NRF24E1 has 4KB on-chip RAM, which is enough for keyboard software. After the system is powered on, the program in E2PROM will be automatically downloaded to the 4KB ram, and MCU can directly read and write the code in RAM. The functions of keyboard software: (1) provide column scanning information required by shift register. (2) read travel scanning value. (3) Detect that the key is pressed and de jittered. (4) send the scanned information of the pressed key to the PC. (5) Energy saving state cycle. The wireless keyboard should use energy-saving technology to prolong the battery life. The ShockBurst TM technology of nRF2401 on nRF24E1 chip is designed to save energy for users, so designers can not consider energy saving when writing software. However, designers should consider how to further reduce the current when the system is idle. When the crystal oscillator of nRF2401 is 16mhz, its The working current of the on-chip 8051 core is 3mA. Because the keyboard works periodically, the idle time of the keyboard is very long compared with the working time. Therefore, when the keyboard does not work, it is necessary to set the on-chip 8051 to the idle state, and the working current of the on-chip 8051 in the idle state is only 2 A. This is used to reduce battery consumption. The tasks of the system in idle state and working state are as follows. Idle state: (1) complete all keyboard scanning (about 0.5ms). (2) enter the working state if a key is pressed. (3) set 8051 to idle state and the wake-up time of RTC to 20ms. (4) Idle state cycle. Working state: (1) scan the keyboard 500 times per second. (2) send all key information to the PC. (3) enter the idle state if no key is pressed within 10 seconds. (4) Working state cycle. Generally speaking, considering battery energy conservation according to the above methods can increase the service life of the battery by about 40 times. Therefore, it is very important to consider battery energy conservation in the design of system software. 4 junction Practice has proved that nRF24E1 is very suitable for realizing the communication between wireless keyboard and PC. its advantages: (1) nRF24E1 is embedded with 8051, which is easier to reduce the volume. (2) ShockBurst TM technology is adopted to make programming more convenient. (3) it is easier to realize safe keyboard information transmission. (4) the 2.4GHz transceiver frequency band is a global open frequency band (5) Battery monitoring is more convenient and low power consumption. (6) the GPIO of nRF24E1 makes it easier to expand other functions, such as LED indication.