Multi-serial communication programming method based on LPC2365 and embedded μC/OS-II

    This paper presents a multi-serial communication programming approach implemented under the embedded real-time operating system μC/OS-II, using the LPC2365 microcontroller as the central processor. For fixed-length short-byte frame data, the reception task is efficiently handled by configuring an appropriate byte trigger depth. In contrast, for variable-length long-byte frame data, the reception is completed through a single interrupt combined with a waiting delay. Additionally, for handling large volumes of data, a FIFO (First-In-First-Out) queue mechanism is employed to ensure smooth data flow and efficient processing.

    These strategies enable the successful execution of communication tasks across multiple serial ports, even when dealing with high data throughput. Specifically, when a domestically developed sea-going high-altitude target is being towed, it must continuously transmit various operational parameters to the towing master via a wireless link, while simultaneously receiving remote control commands to perform necessary actions in real time.

    The parameters transmitted include switch control status, battery voltage, radio altimeter reading, flying height setting, vertical acceleration, rudder angle, temperature, GPS receiver output values, and more. The first seven parameters are collected by a data acquisition board, formatted into frames, and sent through an RS232 serial port at 9600 bps and 1 Hz. Each frame contains 6 bytes of remote command data, while the general-purpose GPS outputs two NMEA sentences ($GPGGA and $GPRMC) at 9600 bps and 1 Hz, with variable frame lengths up to 160 bytes. The high-performance GPS operates at 57600 bps and 20 Hz, outputting nine key parameters such as RT, RD, TO, SI, RC, CP, DC, FC, and PV, with each frame typically containing no more than 305 bytes.

    To meet the requirement of uploading 75-byte data per frame (with three identical frames returned upon receiving a remote command) at a rate of one frame per second for real-time display, the system integrates data from the acquisition board and the general-purpose GPS. Meanwhile, the high-performance GPS data is directly uploaded to the towed master for post-processing, making this a classic case of multi-serial port communication involving large data volumes.

    1. Working Principle

    The ARM7-based LPC2365 microcontroller, equipped with multiple serial ports, is used to receive real-time data from the data acquisition board and the general-purpose GPS. After framing, the data is stored in a FIFO-type transmission queue using a mutual exclusion semaphore. Similarly, data from the high-performance GPS is also stored in the same queue. When the queue is not empty, a binary semaphore triggers the serial port transmission task, which continues until a complete frame is sent.

    Multi-serial communication programming method under II

    The application is built on top of the μC/OS-II real-time operating system, where different tasks are created for distinct functions, including serial port reception, serial port transmission, and data framing.

    2. Hardware Design

    The main control CPU uses the NXP ARM7 LPC2365, which features 256 KB of flash memory, 32 KB of SRAM, four full-duplex UART serial ports, and up to 70 general-purpose I/O pins. This rich set of hardware resources allows the system to communicate with the data acquisition board, general-purpose GPS, high-performance GPS, and a digital transmission module separately. The available memory is sufficient to run the μC/OS-II real-time operating system and its applications.

    Given that the high-performance GPS transmits data at 57600 bps and 20 Hz, with a data volume of up to 305 bytes per frame, the duty cycle reaches as high as 85%. To accommodate additional parameter transmissions, a digital transmission module with a higher baud rate is used to ensure reliable and efficient data transfer.

    Multi-serial communication programming method under II

    The EL806 digital transmission module from GE MDS offers advanced frequency-modulated spread spectrum technology, providing industrial-grade wireless communication at speeds up to 115200 bps in the 902–928 MHz band. It excels in reliability, integrity, and error correction during wireless data transmission. Additionally, it has a wide power supply range, low power consumption (up to 1 W), and strong environmental adaptability, making it ideal for demanding applications. The hardware system block diagram is shown in Figure 2.

    3. Software Design

    3.1 μC/OS-II Porting

    μC/OS-II is a fully portable, scalable, and open-source real-time multitasking kernel that supports a wide range of microprocessors, including 8-bit, 16-bit, 32-bit microcontrollers, DSPs, and even 64-bit processors. To run the OS on custom hardware, it must be ported to the specific CPU architecture. While there are numerous resources available to guide the porting process, a more straightforward approach is to download pre-transplanted routines for the target architecture, significantly simplifying the implementation for users.

    3.2 Application Programming

    T04 Series Terminal Blocks

    Withstand high voltage up to 750V (IEC/EN standard)

    UL 94V-2 or UL 94V-0 flame retardant housing

    Anti-falling screw

    Optional wire protection

    1~12 poles, dividable as requested

    Maximum wiring capacity of 4 mm2

    4 mm² Terminal Blocks,high quality terminal strips,BELEKS T04 series terminal connectors,3 amp connector strips

    Jiangmen Krealux Electrical Appliances Co.,Ltd. , https://www.krealux-online.com

    Previous Post: Netease CEO Zhou Feng recommended Go language and introduced 3 advantages of Go language
    Next Post: Multi-serial communication programming method based on LPC2365 and embedded μC/OS-II
    Home
    Recent Posts
    • Good at investing in IoT technology to improve t…
    • Netease CEO Zhou Feng recommended Go language an…
    • Netease CEO Zhou Feng recommended Go language an…
    • Multi-serial communication programming method ba…
    • Multi-serial communication programming method ba…
    • SPI interface concept, data transfer, clock pola…
    • SPI interface concept, data transfer, clock pola…
    • Has the daily life of Haimeidi audio-visual robo…
    • Method analysis of Linux performance diagnosis w…
    • Has the daily life of Haimeidi audio-visual robo…
    • Method analysis of Linux performance diagnosis w…
    • Analysis of the working principle and implementa…
    • Is the s type thermocouple a platinum wire? _s t…
    • Is the s type thermocouple a platinum wire? _s t…
    • Littelfuse Introduces Metal Hybrid PPTC Miniatur…
    • Littelfuse Introduces Metal Hybrid PPTC Miniatur…
    • Memory will not work! CPU cache is so important
    • Summarize how high-speed digital circuits suppre…
    • Common sense needs to understand the specificati…
    • Common sense needs to understand the specificati…