Implementation of MDB/ICP Protocol Based on S3C2410A

Publisher:Lihua1314520Latest update time:2013-02-25 Source: dzscKeywords:S3C2410A  MDB Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

     MDB/ICP is widely used in self-service vending systems and has become the industry standard communication protocol for self-service vending systems. There are also products that adopt this standard in China, which basically use 51 single-chip microcomputers as hardware solutions. Let the more powerful processor S3C2410A support this protocol, which can greatly improve the software and hardware functions of the self-service vending system.

  Based on the ARM processor, a flexible method is provided to enable high-end processors to support MDB/ICP. Under the guidance of this method, it can also be widely used in non-ARM processor chips such as MIPS and Power PC, and has strong industry practicality.

  1 Overview of MDB/ICP Protocol

  MDB/ICP (Multi-Drop Bus/Internal Communication Protocol) is a set of protocols developed by the European Vending Machine Manufacturers Association to coordinate the communication between the main controller (VMC) of the vending machine and multiple peripherals (coin machines, bill readers, etc.). The standards for coin machines and bill readers were first developed by Coinco under the direction of the American Coca-Cola Company. This standard was adopted by the NAMA (National Automatic Merchandising Association) in 1993, and after being revised by a special working group, it was adopted by the EVMMA (Euro-pean Vending Machine Manufacturers Association) in 1994. The latest protocol version 4.0 was jointly developed by NAMA and EVA (European Vending Association) in April 2009.

  1.1 MDB protocol serial bit format

  The MDB interface is a master-slave serial bus interface operating at a baud rate of 9,600 bps. All peripheral devices (such as coin machines, banknote machines, card readers, etc.) are slaves of the master controller VMC. The communication method between all peripheral devices and VMC is the same. A maximum of 32 peripherals are supported.

  The serial bit format of the MDB protocol is: 9600 bps, 1 start bit, 8 data bits, 1 mode bit, and 1 stop bit.

  1.2 MDB/ICP communication protocol frame requirements

  On the MDB bus, the VMC sends commands to the outside through broadcasting. The first byte is the address byte (the upper 5 bits are addressing information, and the lower 3 bits are instructions to the peripherals). This byte is read by all peripherals, but only the peripherals specified by the address byte process the subsequent data bytes and respond. In the data from VMC to the peripheral, the mode bit of the address byte is set to 1, and the mode bit of the data byte is set to 0. The peripheral confirms whether it is an address command or data by checking the received mode bit. When data is sent from the peripheral to the host (up to 36 bytes), the mode bit of the last byte sent is set to 1, indicating that the data has been sent.

  The command sent by VMC to the peripheral consists of an address byte, some optional data bytes and a checksum (CHK) byte. After sending the command, the communication block of the peripheral response to VMC can consist of a data block and a CHK byte, or an acknowledgement byte (ACK), or a no acknowledgement byte (NAK). If the peripheral responds to the data block, VMC will respond to the data sent back by the peripheral through an acknowledgement byte (A-CK), no acknowledgement byte (NAK) or a send byte (RET).

  2 MDB/ICP Protocol Application

  Vending machines are a new form of commercial retail, which developed in Japan, Europe and the United States in the 1970s. It is also known as a 24-hour mini supermarket. In Japan, 70% of canned drinks are sold through vending machines. The world-renowned beverage company Coca-Cola has 500,000 beverage vending machines around the world. Now, the vending machine industry is moving towards informatization and further rationalization. For example, the online method is implemented to transmit the inventory information and sales records in the vending machine to the computers of each business point in a timely manner through a third-party wireless network, thereby ensuring the smooth delivery, replenishment and selection of goods, and realizing the global chain of vending equipment. And the vending terminal can be remotely controlled and monitored through a third-party network, and the cloud operation of the equipment can be realized through Ethernet control. In the future, it can also be connected to the Internet of Things to realize web-operated shopping. Under the increasingly complex requirements of the market for functions, the traditional 51 single-chip microcomputer + MDB device solution is difficult to meet the needs of the market. Today, when ARM processors are becoming more and more popular, using S3C2410A as VMC is a solution to meet customer needs. The S3C2410A chip has rich functional modules and good software support, which can enable the Linux operating system to achieve more complex user functional requirements. Figure 1 is a block diagram of the Gangwan Education Vending System.

Block diagram of the Harbor Education vending system

Figure 1 Block diagram of the Harbor Education vending system

  As shown in Figure 1, this solution integrates the most mainstream embedded system interfaces, which is sufficient to realize a powerful vending system to meet customer needs.

  2.1 S3C2410A chip UART serial bit format

  By studying the S3C2410A data sheet, we can find that some current mainstream processor chips, such as S3C2410A, do not have UART modules that meet the serial bit protocol format of the MDB protocol like the traditional 51 microcontroller. The UART data format of S3C2410A is: up to 115 200 bps, 1 start bit, 5 to 8 data bits, 1 odd/even parity bit, and 1 or 2 stop bits. [page]

  2.2 S3C2410A supports MDB/ICP application methods

  If the MDB protocol is to be supported, the S3C2410A does not have a mode bit available. Therefore, it is impossible to determine whether the data on the MDB bus is an address byte or a data byte and when a frame of bus data ends on the S3C2410A. This poses a serious challenge to the original plan, and we have to conduct preliminary research on the possibility of the S3C2410A becoming a VMC device for the MDB/IPC protocol. The most direct way is to use the value of the optional parity bit of the S3C2410A to reverse the value of the mode bit of the MDB device, and let the parity bit play the role of the MDB mode bit, so as to determine whether the S3C2410A has finished receiving the data transmitted by the MDB device. After analysis, we can get the inferences listed in Table 1.

Table 1

Table 1

  Through the above analysis, we started to write a test program, and found a bug in the serial port design of S3C2410A: when BITS[5:3] of UART LINECONTROL REG ULCONn is configured as "101" and even parity is selected to receive data from the MDB bus, no matter the number of bits of the constructed data 1 is odd or even with the specific mode bit, it is found that the bit 2 frame. error of UART ERRORSTATUS REG (UERSTATn) of S3C2410A cannot be set accurately. Thinking that such a popular chip as S3C2410A has imperfect design, when we are about to give up, based on the principle that everything is possible, since the chip is unreliable, we simply test it, set BITS[5:3] of ULCONn to "100" according to Table 1, and select odd parity to receive data. According to common sense, the result of even parity should be the same as the result of odd parity. With a try-and-see attitude, the test code was constructed, and an obvious pattern emerged: when the mode bit is "0", the bit 2 frame. error bit of UERSTATn can be accurately set; when the mode bit is "1", the bit 0 (receive buffer data ready) of UART TX/RX STATUS REG (UTRSTATn) can be accurately set to receive data normally. After obtaining this pattern, the 2410 VMC device can accurately determine whether the data sent by the MDB device has received the end mark. In addition, when the VMC sends data to the MDB device, according to the protocol requirements, when sending the address byte, the BITS[5:3] of ULCONn can be set to "110", which means parity forced/checked as 1 to force the parity bit to 1 as the mode bit. After the address byte is sent, the BITS[5:3] of ULCONn is adjusted to "111" to send the data byte. At this point, the S3C2410A can be perfectly used as an MDB VMC device. The following is a partial debugging code snippet of VMC receiving bus data. It is relatively simple for VMC to send data to the bus. Interested readers can discuss with the author.




  Conclusion

  This paper presents a method for implementing the MDB/ICP protocol on an embedded processor ARM (S3C2410A). In engineering practice, this method has been proven to be accurate and reliable, meeting the needs of the market, expanding the hardware platform that supports the protocol, and enriching the software function interface of the device that supports the protocol. The implementation method in this paper can also be applied to other embedded processors.

References:

[1]. S3C2410A datasheet http://www.dzsc.com/datasheet/S3C2410A_.html.

Keywords:S3C2410A  MDB Reference address:Implementation of MDB/ICP Protocol Based on S3C2410A

Previous article:Design of water-saving irrigation system based on ZigBee wireless sensor network
Next article:Design and development of CAN bus communication based on S3C2410

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号