Research on LPC900 series microcontrollers in radio frequency data transmission modules

Publisher:MindfulBeingLatest update time:2011-10-29 Keywords:LPC900 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Currently, many application fields use wireless methods for data transmission. Wireless data transmission refers to the use of wireless transmission modules to remotely transmit various physical quantities output by industrial field equipment. If the transmitted quantity is a switch quantity, remote equipment telemetry and remote control can also be achieved.

Wireless data transmission equipment DTD433 can provide highly stable, highly reliable and low-cost data transmission. It provides a transparent RS232/RS485 interface, with the characteristics of easy installation and maintenance, strong diffraction ability, flexible networking structure, and wide coverage. It is suitable for applications with many points and scattered locations and complex geographical environments. The device provides point-to-point communication and can also achieve point-to-multipoint communication. It does not require programming or wiring. General electrician debugging is also possible. Wireless data transmission equipment is widely used in the field of wireless data transmission. Typical applications include data acquisition, detection, alarm, process control and other links in remote control, remote sensing and telemetry systems.

1 Construction of RF Data Transmission Module Development Platform

Establishing a software and hardware development platform is the primary task of module development. After comparing several RF data transmission module solutions, we finally decided to adopt a development solution with LPC900 series FLASH microcontroller and CC1000 RF transmission chip as the main chip.

1.1 Introduction to the main chip

The LPC2900 FLASH microcontroller is a series of microcontrollers released by NXP Semiconductors (an independent semiconductor company created by Philips), further expanding the industry's most extensive production line of ARM7 and ARM9 microcontrollers. Based on the popular, high-performance ARM968E-S processor, NXP LPC2900 provides designers with a cost-effective, flexible, and low-power solution for applications in the industrial, medical, engine control, and automotive electronics industries.

CC1000 is an ideal UHF single-chip transceiver communication chip manufactured in 0.35μm CMOS process based on Chipcon's SmartRF technology. Its operating frequency band is 315, 868 and 915MHz, but CC1000 can be easily programmed to work in the range of 300-1000MHz. It has the characteristics of low voltage (2.3-3.6V), extremely low power consumption, programmable output power (-20-10dBm), high sensitivity (generally -109dBm), small size (TSSOP-28 package), integrated bit synchronizer, etc. Its FSK data transmission can reach 72.8Kbps, with 250Hz step programmable frequency capability, suitable for frequency hopping protocol; the main working parameters can be programmed through the serial bus interface, and it is very flexible to use.

1.2 Development platform construction

The LPC900 series MCU provides relatively complete software and hardware development tools. In system development, the TKS932 simulator is used for system simulation and debugging. The simulator supports the currently popular μVisionⅡ integrated development environment of KEILC.

The block diagram of the RF data transmission module development platform is shown in Figure 1, which is constructed by using a self-designed RF module development board and adding some auxiliary circuits, in conjunction with the TKS932 simulator and the software development tool μVisionⅡ.

The COM1 port of the PC communicates with the TKS932 emulator to perform software and hardware simulation on the module software. The COM2 port communicates with the LPC922, which can reflect the software debugging information more intuitively and assist in software debugging; on the other hand, it can receive or send data to the RF module through the serial port. [page]

2 Software Development and Debugging

2.1 Basic structure description of data transmission module software

The RF transmission chip CCl000 has three states: IDEL (idle), RX (receive data), and TX (send data). Overall, this is a state machine model with three states. The mutual conversion between states is shown in Figure 2. In addition to completing the basic chip initialization work, the main program of the module mainly runs based on the interrupt generated by the DCLK pin of CC1000, and the interrupt management program performs state detection and switching.

2.2 Analysis of Problems Encountered in Software Debugging and Development

The software development environment used in this development platform is μVisionⅡ. This environment is embedded with a variety of development tools that meet current industrial standards, and can complete the complete development process from project establishment and management, compilation, connection, target code generation, software simulation, hardware simulation, etc. Even if you do not use C language but only use assembly language for programming, its convenient integrated environment and powerful software simulation and debugging tools will greatly speed up the development progress. However, its development environment has its own characteristics, and some special issues need to be considered.

2.2.1 Keywords in the program

You cannot use C51 compiler keywords to define variable names or function names when programming. C51 distinguishes between uppercase and lowercase letters, and keywords are all lowercase.

Some function definitions seem to have no problem literally, but errors are indicated during compilation. After checking the relevant directory of C51 keywords, it is found that the reason is that the variable parameter data is its keyword, which causes errors during compilation.

The following are some commonly used keywords that should be avoided when defining variables or function names during program design:

_at_, alien, bdata, bit, code, data, idata, large, pdata, sbit, sfr, sfrl6, smal, task, using, xdata, priority.

2.2.2 The difference between BIT and SBIT and the use of global variables and local variables

Bit is mainly used for bit variable operation. Although sbit is also used for bit variable operation, its application range is wider than bit. Sbit can not only be used to define the bits of bit-addressable registers, so that we can perform bit operations on registers, but another important function of sbit is to construct a data type similar to a union. This data type plays an important role in the serial/parallel data conversion between LPC922 and CC1000. For example:

unsigned char bdata myDatas2; //define a bit-addressable global variable

//Define each bit of the variable

sbit cDatas0=myDatas2^O;

sbit cDatasl=myDatas2^l;

sbit cDatas2=myDatas2^2;

sbit cDatas3=myDatas2^3;

sbit eDatas4=myDatas2^4;

sbit eDatas5=myDatas2^5;

sbit cDatas6=myDatas2^6;

sbit cDatas7=myDatas2^7;

[page]

Here myDatas2 can be used as an 8-bit variable, and each bit can also be used separately, which is very useful in serial/parallel data conversion. It is particularly important to note that myDatas2, a bit-addressable variable, must be defined as a global variable. If it is defined as a local variable, the compiler will generate an error.

2.2.3 UART communication and function call

When performing hardware simulation, UART serial communication between LPC922 and PC is required, so that the relevant debugging information can be intuitively displayed on the hyperterminal. In the early stage, there was always a communication problem, so the underlying code related to serial port reading and writing was debugged.

The original microcontroller and PC serial port communication program is as follows:

The original UART write string function writeln is implemented by calling the putchar function, but errors always occur during hardware simulation. When this part of the program is separated for simulation, no problems occur. Later analysis and consideration led to the possible reason: Due to the limitation of internal stack space, C51 provides a compressed stack when calling a function. Each process is given a space for storing local variables. Each variable in the process is stored in a fixed position in this space. When the process is called multiple times or recursively, the variable will be overwritten and an error will occur. At this time, the function should be defined as a reentrant function, but reentrant functions generally run slower because they have to do some special processing. When writing the UART operation to call the putchar function in this program, other parts of the program are also calling the function, overwriting the parameters passed to the putchar function, causing the program to run incorrectly. So the program was modified as follows:

The difference between the modified program and the original program is that the putchar function is no longer called, but the relevant operations are performed directly. After the modification, the problem is well solved by hardware simulation. From this, we can see that due to the limited internal stack resources of the LPC900 microcontroller, when the program is found to be running abnormally during program design, special attention should be paid to the problems caused by function calls. Of course, there may be other reasons for this problem.

2.2.4 Watchdog

When the system is in some harsh environments (industrial control, bottom-level acquisition, etc.), if the system's anti-interference is not done well, it is easy to "freeze". At this time, the hardware circuit is not damaged, but the internal program runs incorrectly and must be reset to recover. At this time, the "watchdog" can be used to solve the problem. The watchdog timer subsystem can restore the system from incorrect operations by resetting. However, everything has its two sides. When the software fails to clear or reassign the timer before it overflows, the watchdog timer will cause the system to reset once, resulting in an error.

The simulation development board uses LPC922, so the registers related to the watchdog during reset were analyzed in detail. Finally, it was found that the problem was caused by not reconfiguring the parameters of the watchdog in a timely manner. The program reset problem was solved well by properly configuring the four registers related to the watchdog, WDCON, WDL, WFEED1, and WFEED2.

2.2.5 LPC900 read operation and CC1000 register read and write

LPC900 series microcontrollers usually have some characteristics of 51 microcontrollers, and you should pay attention to them when using them. When its I/O port is used as an input port, there are two working modes, namely, reading the port and reading the pin. Reading the port does not actually read data from the outside, but only reads the contents of the port latch to the internal bus, and then writes it back to the port latch after some operation or transformation.

When reading the pin, the external data is actually read into the internal bus. At this time, the port latch must be set to 1 through instructions, and then the pin reading operation can be performed, otherwise the reading may be wrong. In the process of reading and writing CC1000 registers of LPC922, the problem of reading pin operation is involved, and these two working modes should be distinguished.

3 Conclusion

On the development platform introduced in this article, the LPC900 series microcontroller is used to realize the effective parameter read and write configuration control of the CC1000 register on the RF module according to different application needs, and the design requirements are preliminarily met. The analysis and discussion of the problems encountered in software development also has a wide range of practical significance in the application development of the LPC900 series microcontroller.

Keywords:LPC900 Reference address:Research on LPC900 series microcontrollers in radio frequency data transmission modules

Previous article:LED Intelligent Lighting System Based on STC Microcontroller
Next article:MB89163 single chip microcomputer and its application in remote control

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号