The requirements to build correct communication protocol between chip and MCU
Due to the fact that the prorogation speed between electromagnetic wave and the light is nearly the same in open space, hence, the transmitting and receiving must synchronized in time. If to receive after the transmitting completed, the electromagnetic wave may already disappear in the open space and the receiver can’t receive the signal. Therefore, under the circumstance of there is no fixed code and Manchester coding and decoding, the corresponding sequence diagram should be as follows:
Baud Rate: 2.4kbit/s
In wireless communication process, we need to build up connection between MCU and receiver module. We usually define our own transport protocol. No matter with what kind of modulation mode, to pass information code format is important, it will directly affect the reliable data transceiver.
Recommended Code Group Format
Lead code + Synchronous code + data frame + dead zone (between one data group to the next data group), + the next frame lead code +...
The lead code length should be greater than 10 ms (433 MHZ), in order to avoid the background noise. Because the first data that received by the receiver is very easy to be interfered ((i.e., the zero level interference) and this will result in receiving false data. So we normally adopt CPU coding and decoding code, which can add some messy code in front of the data identifying bit to suppress zero level interference.
Synchronization code is mainly used to distinguish the leading code and data. It has certain characteristics, so that the software can identify the synchronization code through a certain algorithm and simultaneously, to get ready to receive data.
Hence, the final format should be as follows:：
In this figure, the Tp section is the lead code. It can be the square wave with identical characteristics (for example 0,1,0,1….). The duration should be more than 10 ms (433 MHZ). If the frequency is 315 MHZ, the Tp leading duration should be extended to 20 ms. The Td section is the guidance code, which is greater than 4 ms, the typical value is 4ms.
In the transmitting part, the transmitter will send out the data with the data frame format. In the receiver part, when detect identical characteristics of square wave, the MCU will identify this as "lead code". In the rest of the time, if it receive 4 ms low level, which is considered to be the "guidance code". So after 4ms, the MCU will consider the data to be "useful data for receipt”. After the useful data, if it’s continuous low level after the receiving date completed, we will consider this section to be the "dead zone".
Due to RF chip is a low-power consumption chip, its driver in DATA port only has 10 uA CMOS level. So you must be aware of level interface problem when select the MCU. For example, like 51 core MCU (TTL level), our chipset can’t drive it. We need to add the buffer. MCU with PIC core (COMS level) there will be no problem.
In practical application, repeat launch 4 times of the above code group, if there is one time is correct and we will consider it’s a successful data transmission.
In general, the data section is required to Manchester encoding and decoding. It can restrain the error rate of data transmission.