Abstract: The smart card technology is used in the set-top box to realize conditional reception. The smart card interface of the set-top box chip Sti5516 and the TDA8004T chip for realizing the communication between the set-top box and the smart card are introduced. The T=0 communication protocol is introduced, and the communication realization process is given. .
Keywords: set-top box smart card T=0 protocol
When using digital set-top boxes to watch digital TV programs, in order to meet the needs of different users and ensure the interests of each user, it is necessary to use the conditional access system to manage the user's rights and ensure the normal viewing of the users. In a set-top box, conditional reception is usually achieved using smart card technology.
A smart card has its own microprocessor, memory, and an interface to communicate with the set-top box. The advantage of using smart card to achieve conditional access is that it has high security and confidentiality. It is mainly used to store user's private key, control authorization, security algorithm and other information, which can ensure the security of the entire digital TV system.
This article focuses on communication between smart cards and set-top boxes. The main chip in the set top box generally provides an interface for communication with the smart card, and normal communication between them can be realized by using corresponding hardware and communication protocols. In this paper, the set-top box chip uses ST's Sti5516. Because the smart card interface provided by the Sti5516 requires an external interface chip to communicate with the smart card, Philips' TDA8004T chip is also used. The entire hardware block diagram is shown in Figure 1.
1 Sti5516 smart card interface
The Sti5516 supports a smart card interface, the Asynchronous Receiver Controller (UART), for communicating the Sti5516 with two smart card controllers. The asynchronous transceiver controller supports full-duplex asynchronous communication, and the receiver and transmitter use the same data format and baud rate. The transmission and reception of data can be either a double BUFFER or a 16-bit FIFO. The parity bit, data bit, and stop bit are all programmable during communication. At the same time, error awareness in transmission and reception enhances the stability of data transmission. The handshake protocol between UART and smart card ensures the security of data transmission. The Sti5516 has a smart card clock generator that provides a clock signal to the smart card. The smart card uses this clock to drive communication between the smart card and the UART. This clock is also used for the smart card CPU clock. The smart card interface operation requires that the card's clock can be adjusted so that the baud rate can be changed and the clock can be adjusted according to the ISO7816 standard. The smart card interface provided by the Sti5516 supports the T=0 and T=1 protocols.
2 Introduction to TDA8004T
The TDA8004T provides a low-cost asynchronous smart card interface for electronic payment, card readers, pay TV, and more. It can replace some external components between the smart card and the microcontroller, providing a stable, low-noise and ISO-7816-compliant communication interface between the microcontroller and the smart card [1]. The schematic structure diagram is shown in Figure 2.
3 communication protocol
In the process of communication between Sti5516 and smart card, this paper adopts T=0 protocol.
The T=0 protocol is an asynchronous half-duplex byte transfer protocol [2], that is, the smallest unit handled by the protocol is a single byte. The communication command is always initiated by the interface device to command the header to inform the card what to do and to allow the transfer of data bytes under the control of the process byte issued by the card. The command header consists of consecutive 5 bytes, which are designated as CLA, INS, P1, P2, P3. Where CLA is the instruction class, INS is the instruction code in the instruction class, P1 and P2 are reference symbols (such as addresses) of the completion instruction code, and P3 is composed of a variable length conditional body. The conditional body includes the command data field length byte Lc, the command data field, and the maximum length byte Le returned by the response. The composition of the conditional body is also different according to different commands.
figure 2
Thus, after a 5-byte command header is transmitted, the interface device waits for one or two process bytes. The value of the procedure byte will indicate the action requested by the interface device. If the value of the process byte is the same as the INS byte, it means that the interface device sends or receives all data from the card; if it is the same as the complement of the INS byte, it means that the interface device sends to the card or receives the next byte from the card; If it is 0x60, it means to extend the waiting time; if it is 0x61, it means that the interface device waits for the second process byte and sends the command to retrieve the data according to the second process byte; if it is 0x6c, it means the interface device waits for the second process. Bytes, and resend the previous command according to the second procedure byte. If the process byte is 0x90, 0x00, the communication is successfully completed [2~3].
4 communication implementation
In the actual communication process, this paper will set the working frequency to 3.57MHz, and ensure the baud rate of data transmission is 9600bps. The data format uses 8 data bits with parity and 2 stop bits, as shown in Figure 3.
The Sti5516 smart card interface UART driver is used in the process of sending and receiving data from the set-top box and the smart card. Therefore, the UART must first be initialized before communicating. After initialization, the card's reset response is made, and if the answer is correct, it can communicate with the card.
According to the definition of the T=0 protocol, the flow chart of the communication between the set top box and the smart card is as shown in FIG. 4 .
5 debugging experience
(1) When writing the driver of the smart card interface UART, the operating frequency, data transmission baud rate and data format must be configured according to the T=0 protocol standard;
(2) The card can be communicated with the set-top box after ensuring that the card's reset response is correct;
(3) The transmission of the command headers is generally in a certain order. During the test, the command headers need to be sent in order to receive data normally.
Figure 4
(4) When judging the process byte and conditional form, be sure to consider carefully and comprehensively as described in Figure 4 to avoid communication errors.
Since most smart cards currently support the T=0 protocol, this paper mainly introduces the communication between the set-top box and the smart card based on the T=0 protocol. On this basis, communication based on the T=1 protocol can be implemented in the future to support more smart cards.
2.1 Rgb Speakers,2.1 Speaker With 7 Led,2.1 Color Multimedia Speaker,2.1 Speaker With Bluetooth
Comcn Electronics Limited , https://www.comcnspeaker.com