使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库

所需积分/C币:34 2018-10-16 11:56:30 640KB PDF
收藏 收藏
举报

使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库
UM0685 Contents 6 Revision history 22 DOc D 15449 Rev 2 3/23 List of tables UM0685 List of tables Table 1. STM32F10XXX CEC library functions ■1■ Table 2. CEC Init function Table 3. CEC_ NVIC_Configuration function 6899 Table 4 CEC Wait100us function Table 5. CEC_Timing Delay_ Decrement function Table 6. CEC SendstartBit function 10 Table 7 CEC ReceivestartBit functIon 10 Table 8. CEC SendAckBit function Table 9. ceC ReceiveAckBit function 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 Senaframe function ,14 Table 15. CeC receiveFrame function ,,,15 Table 16. Document revision history 22 Doc D 15449 Rev 2 UM0685 List of fiqures List of figures Figure 1. CEC frame Figure 2. CEC Hardware requirement Figure 3. Receive start bit flowchart 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 igure 11. LCD screenshot of a failed receive transaction DOc D 15449 Rev 2 5/23 CEC library description UM0685 CEC library description The stm32F10XXX CEClib is a set of common functions for cec communication It includes the following function Table 1. STM32F10XXX CEC library functions Function name Description CEC Init CEC initialization CEC NVIC Configuration CEC NVIC configuration CEC waitl00us CEC timing for send/receive a cec bit CEC TimingDelay Decrement CEC time base generation CEC SendstartBit CEC send start bit CEC Receivestartbit CEC receive start bit CEC SendAckBit CEC send acknowledge bit CEC Receiveackbit CEC receive acknowledge bit CEC SendDatabit CEC send data bit CEC Receivedatabit CEC receive data bit CEC SendByte CEC send data byte EC ReceiveByte CEC receive data byte CEC SendFrame CEC send data frame CEC ReceiveFrame CEC receive data frame DOc D 15449 ReV 2 UM0685 CEC communication CEC communication 2.1 CEC frame The cec bus is a single-wire protocol that can connect up to 10 audiovisual devices through standard HDMI cabling The CeC transaction is made up of a start bit, a 10-bit header and a sequence of n 10-bit data blocks. The Header block and the Data blocks each contain an end-of-message(EOM) bit and an acknowledge(ACK) bit. Figure 1 shows a CEC frame format Figure 1. CEC frame 10 bits 10 bits 10 bits Start b Header block Data bock Data block n Example of Header block: Example of Data block itiator address 0x6 Destination address= OxD Data= OxE5 Header block Data block Initiator Destination EOMACK Data EOM ACK A Header block is a sequence of 10 bits the 4-bit logical address of the initiator, the 4-bit logical address of the Destination, the end-of-message(EOM) bit and the Acknowledge (ACK) bit A Data block is a sequence of 10 bits: an 8-bit field that represents the opcode or the operand, the end-of-message(EOM) bit and the Acknowledge(ACK) bit. The HDMI standard defines the opcodes and the possible number of operands for each message 2.2 Hardware considerations The physical connection to the HDMI network is straightforward. In accordance with the CEC specification, the CEc pin of the HDMI connector has to be pulled up to a 3.3 V supply voltage via a 27 kQ2 resistor(refer to Figure 2) Figure 2. CEC Hardware requirement 3.3V 27 kQ CEC device 1 CEC device 2 cEC device n i15932 DOc D 15449 ReV 2 7/23 CEC library functions UM0685 3 CEC library functions The CEC library provides three types of functions LoW level functions functions that initialize and configure peripherals to be ready for CEC communication Medium level functions: functions doing elementary CEC routines High level functions: functions sending/receiving CEC frames 3.1 CEC low level functions 3.11 cEC Init function Table 2 describes the cEC Init function Table 2 CEC Tnit function Function name CRc工nit ototype void cec_工rit(Voia) Behavior description Initializes the GPlO, system tick, NVIC and eXtI to communicate with the CEC protocol Input parameter None Output parameter None Return parameter None Required preconditions The software has to configure the different clocks and the Nvic vector table base before calling this function Example int main(void / RCC configuration * RCC Configuration( / NVIC configuration * NVIC Configuration( / cec initialization CEC_工nit(); 3.12 CEC NVIC_ Configuration function Table 3 describes the CEC_ NVIC_ Configuration function 8/23 DOc D 15449 ReV 2 UM0685 CEC library functions Table 3 CEC NVIC Configuration function Function name CEC NVIC Configuration Prototype void CEC__NVIC_Configuration(void) Behavior description Configures global interrupts of System Tick and EXTI Input parameter None Output parameter None Return parameter None The System Tick and EXTi global interrupt priorities used in the cec library Required preconditions have to have the highest interrupt level in the application The used and reserved NvIc configurations for the CEC library are SystemTick: Preemption priority =1, subpriority 1 EXTIO: Preemption priority 2, subpriority 1 3.13 CEC Wait100us function Table 4 describes the cec init function Table 4. CEC Wait100us function Function name cEc Wa1七100us Prototype oid cec Waitl0ous( Io uint32 t n'rimc) Behavior description Insert a delay in 100 us unit Input parameter nTime is the number of 100 us units to be inserted. Delay 100 us x afine Output parameter None Return parameter None Required preconditions None 3.1.4 CEC TimingDelay Decrement function Table 5 describes the cEC TimingDelay Decrement function Table 5. cec rimingDelay Decrement function Function name CEC fimingDelay Decrement Prototype void cec_TimingDelay Decrement (void) Behavior description Decrements the Timing Delay variable in the Sys T ick interrupt Input parameter None Output parameter None Return parameter None Required preconditions None DOc D 15449 ReV 2 9/23 CEC library functions UM0685 3.2 CEC medium level functions 3.2.1 CEC SenastartBit function Table 6 describes the cEC SendstartBit function Table 6 CEC SendstartBit function Function name CEC SendstartBit Prototype void CEC SendstartBit(void) Behavior description Sends the cec start bit Input parameter None Output parameter Return parameter None Required preconditions None 3.22 CEC ReceivestartBit function Table 7 describes the cec ReceivestartBit function Table7 CEC ReceivestartBit function Function name CEC Receives七axBi七 Prototype uint8 t cEC ReceivestartBit(void) Behavior description Receives the cec start bit Input parameter None Output parameter uint8_t integ Return parameter 1: if the cec start bit has been received correcthy 0: if the Cec start bit has not been received correctly Required preconditions one 10/23 DOc D 15449 ReV 2

...展开详情
试读 23P 使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库
立即下载 低至0.43元/次 身份认证VIP会员低至7折
抢沙发
一个资源只可评论一次,评论内容不能少于5个字
关注 私信 TA的资源
上传资源赚积分,得勋章
最新推荐
使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库 34积分/C币 立即下载
1/23
使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库第1页
使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库第2页
使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库第3页
使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库第4页
使用STM32F101xx,STM32F102xx和STM32F103xx微控制器的CEC(消费者电子控制)C库第5页

试读结束, 可继续读2页

34积分/C币 立即下载 >