Design of CAN communication based on WinCE and LPC935 microcontroller

Publisher:zhaodawei617Latest update time:2013-09-14 Source: 21ICKeywords:WinCE Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the continuous development of information technology, embedded WinCE is increasingly used in the field of industrial control. It is mainly used as the operating system of the host computer. As an industrial-grade single-chip microcomputer chip, the LPC935 microcontroller is widely used in various industrial control equipment. In many complex applications, one LPC935 microcontroller is impossible to meet the needs, and multiple LPC935 microcontrollers are required to work together. At this time, how to achieve the communication of multiple LPC935 microcontrollers has become the key to the design. Based on the embedded WinCE device as the core, replace the traditional PC to build a CAN communication system. Combining the advantages of embedded, single-chip microcomputer, and network communication technology, the complex communication protocols and data formats of each independent system are uniformly converted to achieve mutual communication between systems. Combining embedded WinCE with single-chip microcomputers will have important practical value and broad application prospects.

1. Hardware Platform

1) Embedded WinCE uses Zhou Ligong's TIPC-700 as the hardware platform. The main hardware resources include S3C2440A processor, 1 isolated CAN-bus interface, 1 10/100M Ethernet interface, 2 RS-232C serial ports, etc. According to the requirements of the core hardware, the required WinCE system kernel is customized. The application is written in the Visual Studio 2005 integrated development environment.

2) The LPC935 microcontroller is a single-chip packaged microcontroller that uses a low-cost package. It uses a high-performance processor processing structure, and the instruction execution time only takes 2 to 4 clock cycles. 6 times that of the standard 80C51 device. It has high integration and rich peripherals, 2 4-input 8-bit A/D converters/DAC outputs, 2 analog comparators, 2 16-bit timers/counters and a 23-bit system timer, enhanced UART and SPI communication ports. The LPC935 integrates many system-level functions, greatly reducing the number of components and circuit board area and reducing system costs. Therefore, it has been widely used in many fields.

3) Establish ActiveSync connection between TIPC-700 and PC through USB, and embedded WinCE and LPC935 communicate through isolated CAN-bus interface.

4) Each sub-board controls 4 colorimetric cells, each colorimetric cell has 3 detection channels, and each sub-board can perform 12-channel detection, but each colorimetric cell only uses one channel for detection at a time. Therefore, each sub-board can perform 4-channel detection at the same time, and 4 sub-boards can perform 16-channel detection at the same time, thus achieving the purpose of multi-channel detection. The subsequent communication protocol is designed based on this.

2. Customization of embedded WinCE platform

WinCE is a 32-bit, multi-threaded, multi-tasking operating system that uses an API that is independent of the usual programming language and compatible with Windows. WinCE has good communication capabilities and a very good graphical user interface. The WinCE operating system is divided into hardware layer, OEM adaptation layer, operating system layer, application support library, application development layer, and application integration layer. Each layer can only rely on or call one-way. This makes the calling relationship between functional modules clearer. In order to make the system more scalable and have a clearer structure, the WinCE system often needs to be customized.

WinCE provides a tool called PB (PlatformBuilder), which is the main integrated development environment of WinCE. Through this tool, you can easily customize and cut out WinCE operating systems that meet different design requirements according to different hardware. The complete WinCE operating system includes the following: Bootloader, CPU initialization code, driver programs (keyboard, mouse, sound card, graphics card, IDE, COM, USB), user interface interface, and application programs that complete specific functions.

3. Bottom board CAN design

The main control chip used in the baseboard is LPC935, which is a type of microcontroller that does not have an on-chip CAN. However, it has an SPI interface. The design uses the SPI interface plus an independent CAN controller (MCP2515) to implement the CAN function. MCP2515, as a CAN controller, is an independent controller mainly used for local area network control in general industrial environments and fully supports the CAN bus V2.0A/B technical specifications. The CAN transceiver uses TJA1050T, which can operate multiple CAN networks at the same time and provide a transmission rate of up to 1Mb/s. At the same time, optoelectronic isolation is used to improve the stability of the system. It is used to realize the communication between the baseboard and the embedded WinCE device.

4. CAN communication protocol design

In order to enable embedded WinCE and multiple LPC935 microcontrollers to communicate, the key is to have a good communication protocol. This includes making unified regulations on data format, communication method, transmission speed, transmission steps, error detection method, and control character definition [5]. From the design of the hardware platform, we can know that each sub-board controls 4 colorimetric cells, and each colorimetric cell can be set to 3 detection channels. Therefore, each sub-board can control 12 detection channels and number them 1-12. However, each sub-board can only select 1 channel from the 3 channels of each colorimetric cell for detection at a time, and can only detect 4 channels at a time. The entire system can detect 16 channels at the same time. The frame format of CAN communication message transmission includes a standard frame with an 11-bit identifier and an extended frame with a 29-bit identifier. This design uses the standard frame format to design the CAN communication protocol.

1) Setting of communication protocol when the main board transmits commands to the sub-board

Identifier setting: fix the upper four bits of the 11-bit identifier to 1010, the following two bits are the board number (0-3), the seventh bit is set to 0 to read AD, set to 1 to set the colorimetric cell LED luminous intensity, and the lower four bits are set to the detection channel (1-12). At this point, the 11-bit identifier is set.

Data field settings: When the 7th bit is set to 0, the data part is one byte (less than 16), indicating the detection item, which is the same as the lower four bits of the identifier. The sub-board adjusts to the corresponding detection state when receiving it. When the 7th bit is set to 1, the light tube is set/calibrated. The lower four bits of the identifier are the detection channel, and the data part is 3 bytes.

2) Setting the communication protocol when the sub-board uploads data/commands to the main board

Identifier setting: The high 4 bits of the 11 bits are fixed to 1010, the next 2 bits are the board number (0-3), the 7th bit is 0, and the low 4 bits are set to the detection channel (1-12).

Data field settings: 8 bytes in total

When uploading a command to a sub-board, the identifier is the same as the uploaded data. The data part is one byte. When it is "0x0b", it means that the detection button has been pressed. When it is "0x0A", it means that the last command has been processed.

Baud rate setting: set to 50K.

Filter setting: The motherboard only filters the high 4 bits of the identifier, and the value is 1010.

The sub-board only filters the high 6 bits of the identifier, the value is 1010XX, XX is the sub-board number 0-3.

For example, if you want to test the test items of channel 1 of the first colorimetric cell of the first sub-board: if it has been calibrated, set the identifier to 10100000001, followed by the corresponding data field, and then you can test the test items of channel 1 of the first colorimetric cell of the first sub-board. If it has not been calibrated, set the identifier to 10100010001, add the corresponding data field to calibrate, and perform the test according to the previous steps after calibration. Similarly, the data/command uploaded by channel 1 can be operated according to the communication protocol written above.

5. Conclusion

CAN communication was first used in the automotive field. With the development of science and technology, CAN communication has been widely used in computer control systems. This paper studies and develops CAN communication between embedded WinCE and multiple LPC935 single-chip microcomputer baseboards, and integrates embedded, single-chip microcomputer and network communication technologies to achieve multi-channel CAN communication, achieving the original design purpose. The communication protocol designed in this paper has been proven to be stable and reliable in practice, ensuring the real-time and accuracy of information transmission between the baseboard and the WinCE control board. It improves the accuracy of data and reduces the packet loss rate. The technology used in this paper has important practical value and broad application prospects in the fields of short-distance control, remote control and industrial control.

Keywords:WinCE Reference address:Design of CAN communication based on WinCE and LPC935 microcontroller

Previous article:Analysis on the Application of Single Chip Microcomputer in Electronic Technology
Next article:Design of signal modulation amplifier in dual laterolog tool

Recommended ReadingLatest update time:2024-11-15 16:40

Design of CAN communication based on WinCE and LPC935 microcontroller
With the continuous development of information technology, embedded WinCE is increasingly used in the field of industrial control. It is mainly used as the operating system of the host computer. As an industrial-grade single-chip microcomputer chip, the LPC935 microcontroller is widely used in various industrial contr
[Power Management]
Programming of a single network node in WinCE system
1. Single network node system A node is simply a computer or other device that has the function of sending and receiving data. A good node requires both good hardware support and suitable software control . This paper selects the S3C6410 Arm11 chip as the node CPU and WindowsCE 6.0 as the embedded operating system r
[Power Management]
Programming of a single network node in WinCE system
Replace the decoder in IIMAGING with hard decoding in wince6
I have always wanted to use 6410's jpg decoder to replace wince's decoder. I finally had some time these days and did it. The process is not too complicated, and it is roughly as follows: 1. Start from the decoder example that comes with wince, mainly modifying the renderImage part. 2. Registry configurati
[Microcontroller]
Design of Embedded Image Acquisition System Based on WinCE
With the progress of science and technology and the development of society in my country, the acquisition, storage, processing and transmission technology of digital video images has been widely used and developed in recent years, and various image acquisition and processing systems have gradually penetrated into all a
[Microcontroller]
Design of Embedded Image Acquisition System Based on WinCE
Clock synchronization design of ARM-WinCE distributed system platform
With the advancement of computer technology and network communication technology, the establishment of distributed networked test systems, improving test efficiency and sharing information resources have become the development direction of modern test systems. Distributed test systems connect test equipment distributed
[Microcontroller]
Clock synchronization design of ARM-WinCE distributed system platform
Latest Power Management Articles
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号