UM0685 - CEC (consumer electronic control) C library using the STM32F101xx, STM32F102xx and STM32F103xx microcontrollers.pdf

(608 KB) Pobierz
CEC (consumer electronic control) C library using the STM32F101xx, STM32F102xx and STM32F103xx microcontrollers
UM0685
User manual
CEC (consumer electronic control) C library using the
STM32F101xx, STM32F102xx and STM32F103xx microcontrollers
Introduction
This user manual describes the CEC library using the STM32F10xxx microcontroller family.
Consumer electronic control (CEC) is a feature of the HDMI interface 1.3 standard (high
definition multimedia interface), which is used to transmit audio/video data for multimedia
consumer products such as HDTV, DVDs, satellite receivers etc.
This library contains the following functions for a basic CEC communication:
Send/Receive CEC Start bit
Send/Receive CEC ACK bit “logical 0”
Send/Receive CEC data bit
Send/Receive CEC data byte
Send/Receive CEC data frame
Note that the provided CEC library supports only messages addressed to a single device
and not broadcast messages (please refer to HDMI - CEC specification).
March 2009
Rev 1
1/23
273868917.002.png
Contents
UM0685
Contents
1
CEC library description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2
CEC communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1
CEC frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2
Hardware considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3
CEC library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1
CEC low level functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.1 CEC_Init function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.2 CEC_NVIC_Configuration function . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.3 CEC_Wait100us function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.4 CEC_TimingDelay_Decrement function . . . . . . . . . . . . . . . . . . . . . . . 9
3.2
CEC medium level functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.1 CEC_SendStartBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.2 CEC_ReceiveStartBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.3 CEC_SendAckBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.4 CEC_ReceiveAckBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.5 CEC_SendDataBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.6 CEC_ReceiveDataBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.7 CEC_SendByte function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2.8 CEC_ReceiveByte function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3
CEC high level functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3.1 CEC_SendFrame function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3.2 CEC_ReceiveFrame function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4
How to run the CEC demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1
Example of hardware connections between the three
evaluation boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2
CEC demo guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3
CEC send/receive information display on the LCD . . . . . . . . . . . . . . . . . 19
4.4
Send subscreen information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.5
Receive subscreen information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2/23
273868917.003.png
UM0685
Contents
6
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3/23
273868917.004.png
List of tables
UM0685
List of tables
Table 1. STM32F10xxx CEC library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Table 2. CEC_Init function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 3. CEC_NVIC_Configuration function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 4. CEC_Wait100us function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 5. CEC_TimingDelay_Decrement function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 6. CEC_SendStartBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 7. CEC_ReceiveStartBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 8. CEC_SendAckBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 9. CEC_ReceiveAckBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 10. CEC_SendDataBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Table 11. CEC_ReceiveDataBit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Table 12. CEC_SendByte function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Table 13. CEC_ReceiveByte function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Table 14. CEC_SendFrame function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Table 15. CEC_ReceiveFrame function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 16. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4/23
273868917.005.png
UM0685
List of figures
List of figures
Figure 1. CEC frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 2. CEC Hardware requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 3. Receive start bit flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 4. Receive data bit flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 5. CEC connections between the three STM3210B-EVAL boards . . . . . . . . . . . . . . . . . . . . . 18
Figure 6. LCD screenshot after reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 7. LCD screenshot of a successful send transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 8. LCD screen shot of a failed send transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 9. LCD screenshot of a successful receive transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 10. LCD screenshot of a detected frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 11. LCD screenshot of a failed receive transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5/23
273868917.001.png
Zgłoś jeśli naruszono regulamin