Learning from the NRF905 Wireless Module Based on stm32f103zet6

Stm32f103zet6 Introduction

The STM32F series is a low-end 32-bit ARM microcontroller. The series is produced by STMicroelectronics and its core is the Cortex-M3.

The series of chips according to the size of the Flash can be divided into three categories: small capacity (16K and 32K), medium capacity (64K and 128K), large capacity (256K, 384K and 512K).

Chip integrated timer, CAN, ADC, SPI, I2C, USB, UART, and other functions.

Learning from the NRF905 Wireless Module Based on stm32f103zet6

NRF905 Introduction

nRF905 is a monolithic radio frequency transmitter chip introduced by Norway Nordic Company. It is packaged in a 32-pin 5mm & 5mm QFN package and operates on 433, 868, 915MHz 3 ISM (industrial, scientific, and medical) channels, of which the domestic 433 band can Free to use. nRF905 consists of frequency synthesizer, receiver demodulator, power amplifier, crystal oscillator, modulator and other functions. It does not need to use external SAW filter and can also have good communication effects. The nRF905 can use the SPI interface to communicate with any MCU, where the address, output power, and communication channel can be configured by the program, so it can be used for multi-machine communication.

The nRF905 incorporates ShockBurstTM technology, which automatically processes packet headers and includes a built-in CRC checksum to ensure reliable data transmission. The nRF905 consumes only a very low power and emits only 11mA when transmitting at a power of -10dBm, while the corresponding operating current of the receiver is only 12.5mA. The chip can be set to idle mode and shutdown mode by software and is easy to design for energy saving. Suitable for industrial data acquisition, wireless alarms and security systems and many other applications.

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Learning from the NRF905 Wireless Module Based on stm32f103zet6

One, hardware

Nrf905 this chip Xiaobian will not talk about, involving high frequency, RF is more complex, mainly for how to use this module to talk about

Learning from the NRF905 Wireless Module Based on stm32f103zet6

This is a pin diagram related to Xiaobian's programming, where uclk is not used here. Please see the pin diagram below.

Learning from the NRF905 Wireless Module Based on stm32f103zet6

To sum up the more important information of this pin table is as follows:

1, nrf905 and the one-chip computer communication use SPI agreement, Xiao Bian here uses the software simulation spi, the hardware spi has other uses

2, 3.3V power supply is no problem, IO port voltage is fully compatible, the output current is no problem

3, CD is a carrier detection signal, meaning that when Xiao Bian's module is received, once it receives the signal of the same frequency band of the transmitting module, the pin will be set high by nrf905, which is usually low!

4, AM is the meaning of address matching, when as a receiving module, when the receiving address and the transmit address match, then the pin will be set to nrf905 high, usually low!

5, DR indicates that the data is received or sent successfully! When a correct packet is received, the RF905 automatically removes the word parity and then sets the DR pin high, which is normally low!

Note: The status of the 3 pins of CD, AM, and DR is very important during debugger debugging, so make full use of the functions of these pins!

Where the hardware needs to pay attention to small editors have finished, then analyze the Xiaobian program!

Second, software

The first is the sending process:

1. When the microcontroller has data to send, the address and the data to be sent are sent to the RF905 via the SPI protocol. The rate of the SPI interface is determined during the communication protocol and device configuration.

2. The microcontroller is set TRX_CE and TX_EN high, which is set to send data mode

3, RF905 send process:

(1) The RF register is automatically turned on;

(2) Data packetization (plus header and CRC checksum

(3) send data packets;

(4) When the data transmission is completed,

(1) (2) Two steps are automatically completed!

4, AUTO_RETRAN is set high, RF905 repeatedly retransmitted until TRX_

5. When TRX_CE is deasserted, the RF905 transmission process is completed and it automatically enters idle mode.

Note: The ShockBurstTM mode of operation guarantees that once the process of sending data begins,

The TRX_EN and TX_EN pins are high or low and the transmit process is processed. Only in the first

After the data packet is sent, RF905 can accept the next data packet.

Then the receiving process:

1. When TRX_CE is high and TX_EN is low, RF905 enters ShockBurstTM receive mode;

After 2,650us, RF905 keeps monitoring and waits to receive data;

3. When the RF905 detects the carrier of the same frequency band, the carrier sense pin is set high;

4. When receiving a matching address, the AM pin is set high;

5. When a correct data packet is received, the RF905 automatically removes the header, address, and CRC check bits, and then sets the DR pin high.

6. The microcontroller sets TRX_CE low and the nRF905 enters idle mode;

7. The microcontroller moves the data to the microcontroller through the SPI port at a certain rate.

8. When all data has been received, the nRF905 deasserts the DR and AM pins.

9. The nRF905 can now enter the ShockBustTM receive mode, the ShockBurstTM transmit mode, or the shutdown mode. When a packet is being received, the status of the TRX_CE or TX_EN pin changes.

The RF905 immediately changed its operating mode and the packet was lost.

It should be noted that when Xiao Bian sets the receiving mode, it is necessary to write the data to the nrf905 module first, and then enable the sending pin. ! !

The next step is to analyze the specific program

A, first look at the main function of Xiaobian, it is very simple

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Pay attention to this mode

B, then the function of this configuration NRF905, this is the key ah, the specific data selection, it is best to look at the chip manual, Xiao Bian put the code out

Learning from the NRF905 Wireless Module Based on stm32f103zet6

In fact, the content sent to it simply is:

Learning from the NRF905 Wireless Module Based on stm32f103zet6

This is based on the meaning of the format of the register, in fact, there is nothing to say, but Xiao Bian always suspect some problems on the chip manual, that should be 433.0MHZ

C. Next, let's see how Xiaobian composes the data. Xiaobian compiles the Xiaobian code and then analyzes it.

Learning from the NRF905 Wireless Module Based on stm32f103zet6

The above printf function is a small series of printing functions, easy to debug!

We may be curious that the previous mode setting is not a problem. I thought that when it is set to send, it should be that both are selected as high, but here I want to tell you that when Xiaobian compiles the data, Xiao Bian understands it. When choosing a mode

First disable EN. Then use the sentence after Xiao Bian wrote the data through SPI.

Learning from the NRF905 Wireless Module Based on stm32f103zet6

This is to eliminate interference, Xiaobian thinks this way.

D, and finally paste part of the drive function

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Learning from the NRF905 Wireless Module Based on stm32f103zet6

Hight Voltage Soft Starter

Medium Voltage Soft Starter,High Voltage Soft Starter,10Kv Voltage Soft Starter,6Kv Voltage Soft Starter

Jinan Xinyuhua Energy Technology Co.,Ltd , https://www.xyhenergy.com