| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
AP083201.EXE available additional file Emulating asynchronou
Top Searches for this datasheetAP083201 AP083201.EXE available additional file Emulating asynchronous serial interface (USART) on-chip synchronous serial interface (SSC) Abstract: solution presented this paper attached source files emulates most important USART functions using on-chip synchronous serial communication channel (SSC). code focused C513, will C500 derivatives. Beyond level software drivers test shell delivered. This shell allows quick test software drivers emulator starter demo board. Author: Boelderl-Ermel, Semiconductor Group 09/98, Rel. Emulating USART Interface On-Chip Introduction. General Operation Hardware Environment. Supported Features. Required Resources External Routing Principles Emulation 2.4.1 USART Write 2.4.2 USART READ. USART Emulation Software Description Software Structure. Main Program Emulation Subroutines Baud Rate Calculation Load Measurement. Performance Limitations. Make File. Support KitCON-513 Evaluation Board AP0832 ApNote Revision History Actual Revision Rel.01 Previous Revision: none Page Page (Subjects changes since last release) actual Rel. prev. Rel. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Introduction C500 microcontroller family provides usually only on-chip asynchronous serial communication channel (USART). second USART required, emulation missing interface help avoid external hardware solution with additional electronic components. solution presented this paper attached source files emulates most important USART functions using on-chip synchronous serial communication channel (SSC) with performance KBaud half duplex mode overhead less than C513 with MHz. implementation this performance limit chip. pure implementation assembler will result strong reduction load therefore increase maximum speed interface. addition, microcontrollers like C505 will speed interface factor because optimized architecture compared with C513. Moreover, this solution lays stress using on-chip hardware resources possible. more excessive consumption those resources will result higher maximum speed emulated interface. restricted performance microcontroller compatible solution provided only; internal register based programming interface replaced subroutine calls. attached source files also contain test shell, which demonstrates exchange information between on-chip HW-USART emulated SSC-USART three external wires different operation modes. based C513 (Siemens microcontroller). table with load measurements presented give indication fraction performance required software emulating USART. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip General Operation Hardware Environment Supported Features following enumeration summarizes features on-chip USART emulated software routines SSC: data frames with variable baud rate, half duplex communication, baud rates between fosc/512 fosc/128 C513 with crystal following enumeration lists functions C500 on-chip USART, which could cloned technical limitations performance restrictions: shift register with fixed baud rate fosc/12, data frames, multiprocessor communication feature, full duplex communication. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Required Resources emulate USART interface software routines on-chip requires some resources, which listed following table: Table Resource Requirements Resource Number required pins Number interrupt pins Interrupt Priority Timer Additional On-Chip Modules Program Memory (Emulation routines only) Data Memory (Emulation routines only) Emulated USART (Timer Mode Byte Byte Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip External Routing external wire connecting data input with External0 Interrupt required activate Start transmitted external communication partner. test boards with C513 processor on-chip USART also used `external party'. Figure External Routing Transmission Lines Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Principles Emulation algorithms required emulating data transmission depend transfer direction. 2.4.1 USART Write USART Write initiated pulling down SSC-STO output (USART Start Bit) starting timer loaded with time required baud rate. timer interrupt service routine starts `Master Mode' writing data bits transmitted into SSC-STB buffer enables SSC-STO output `Alternate Function'. USART Stop automatically generated SSC-STO output going `High' idle mode. There explicit transmission stop bit. restarting write cycle second time, there higher baudrates) much delay caused microcontroller compared bittime that additional wait-until-stopbit-finished necessary. application which sensitive this point modified user. Figure Schematic Diagram Emulating USART Write Operation using on-chip Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip 2.4.2 USART READ USART READ initiated USART Start arriving SSC-SRI input pin, which externally connected External Interrupt pin. correlated interrupt service routine starts timer loaded with time required baud rate. timer interrupt service routine starts `Master Mode' writing dummy byte (0xFF) into SSC-STB buffer, which simultaneously starts receive shift register sampling data bits. Although dummy byte 0xFF really shifted SSC-STO pin, external communication partner's receive will triggered, because transmitted message byte does contain interpreted Start Bit. final USART Stop provided external communication partner completely ignored. Data Frame Start Stop USART Ext. Interrupt Timer starting operation Figure Schematic Diagram Emulating USART Read Operation using on-chip Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip USART Emulation Software Description Software Structure emulation software written split into files: uss_emul.c contains level software drivers (subroutines interrupt services) emulate USART with on-chip SSC. This file directly added user's application software directory included make file. uss_test.c demonstrates start, control finish emulation. complete file (test shell) used check level software drivers real application. Afterwards, user copy required statements calling individual USART functions into application code segments. uss_defi.h holds definitions declarations related emulation software (uss_test.c, uss_emul.c). Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Main Program main program (uss_test.c) implemented state machine handles several test cases. USSC_INIT_ _EMULATED_ _USART_READ USSC_FINISH_ _EMULATED_ _USART_W RITE USSC_HW _USART_ RITE_OUT ussc_flag_hw _ssc_ready ussc_byte_number USSC_BUFFER _LENGTH USSC_W HILE_ _SSC_ _READS_IN USSC_W LE_USART_ READS_IN ussc_flag_ _hw_usart_ _read_ready ussc_flag_hw _ssc_ready ussc_flag_hw _ssc_ready ussc_flag_hw_ssc_ _write_collision ussc_flag_hw _ssc_ready ussc_byte_number USSC_BUFFER _LENGTH USSC_SSC_ RITE_ _COLLISION USSC_W HILE_ _SSC_ RITES_OUT ussc_flag_ _hw_ssc_ _ready ussc_flag_hw _usart_read_ready ussc_byte_number USSC_BUFFER _LENGTH USSC_SSC_ RITE_OUT USSC_FINISH_ _EMULATED_ _USART_READ USSC_INIT_ _EMULATED_ _USART_W RITE Figure State Machine Diagram test program "uss_test.c" Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip first test case verifies emulated USART data reception from external source: first state `USSC_INIT_EMULATED_USART_READ' emulated USART interface initialized with baud rate supported (fosc/128). communication partner serves on-chip HW-USART which same baud rate. second state `USSC_HW_USART_WRITE_OUT' starts on-chip HW-USART prepares dummy byte used activate after reception HWUSART start bit. third state `USSC_WHILE_SSC_READS_IN' flag polled indicating data reception SSC. User application code executed during read operation included here instead wasting times only running polling loop. After finishing transmission whole message containing programmable number bytes state machine proceeds next state. last state starts with rearrangement order input message string, because message sent USART interface transmitted with first while works with first. last subroutine disables hardware modules required data transmission. second test case communication started with altered transmission direction. operates data source provides on-chip HW-USART with message string. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Emulation Subroutines file uss_emul.c contains subroutines interrupt services required controlling USART emulation: `ussc_init_ussc_hw initializes required auxiliary hardware modules like Timer, External Interrupt input programming their control registers. `ussc_rearrange_bit_order copies programmable number bytes message string, rearranges order every byte stores them back original location. `ussc_write_out prepares data transmission pulling down SSC- enable input SSC-STO output `low' state, which interpreted communication partner Start transmission. Furthermore timer started switching Start after time activating data transmission. timer load value achieving `one time' calculated formula presented chapter 3.4. maximum baud rate Start handled timer interrupt routine Interrupt Service Delay being longer than time. Therefore, time generated executing some `NOP' statements before starting directly. `ussc_disable_ussc_hw()' disables required auxiliary hardware modules like Timer, External Interrupt input setting their control registers respectively. `ussc_int0_interrupt_service()' started `Low' level SSC-SRI pin, which externally wired interrupt0 pin. `Low' level interpreted USART Start announcing arrival further data bits. Therefore timer started activate reception after time interval. Finally interrupt0 service disabled avoid undesired reactions incoming data bits. maximum baud rate Start handled timer interrupt routine Interrupt Service Delay being longer than time. Therefore, time generated executing some `NOP' statements before starting directly. starts HW-SSC writing byte into output buffer. next statement switches SSC-STO output without intermediate spike alternate function. Timer0 disabled reloaded with time. called after completion data transfer Data Collision Error. case transfer completion event received data byte stored array `ussc_ssc_receive_buffer' Transfer Completion Flag reset. External Interrupt enabled again prepared handling Start next data byte reception. case starting transmission while data reception already running global error flag WCOL reset. Baud Rate Calculation Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Data transmission USART interface requires identical baud rate generated both communication partners. This achieved selecting suitable clock oscillator base frequency corresponding prescaler factor. baud rate required HW-SSC controlled BRSx bits register SSCCON: SSC_ Baud_ Rate fosc **BRS initial load value timer (`One Time') handling Start calculated presented next formula stored constant (USSC_BIT_TIME_xxxx_BAUD) file `uss_defi.h': One_ Bit_ Time_ using_ timer0 *(256 Interrupt_ Service_ Delay) fosc emulated USART read operations term `Interrupt_Service_Delay' takes into account Interrupt Response Time External Interrupt0 after receiving Start Bit, Interrupt Response Time Timer0 Overflow including execution time statements corresponding interrupt service routine before starting HW-SSC. emulated USART write operations term `Interrupt_Service_Delay' takes into account Interrupt Response Time Timer0 Interrupt after transmitting Start execution time statements corresponding interrupt service routine before starting SSC. exact value `Interrupt_Service_Delay' extracted analyzing assembler program listing. Table Calculated Interrupt Service Delays Baud Rate External Interrupt Delay Timer0 Int. Delay fosc (fosc MHz) (fosc MHz) 93.750 Read 93.750 Write 46.875 Read 46.875 Write 23.437 Read 23.437 Write avoid timer0 load statement within interrupt service routine preparing timer with exact value emulated USART read operation arithmetical mean calculated load values read write operation used common timer0 load constant which defined constant (USSC_BIT_TIME_xxxx_BAUD) file `uss_defi.h'. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip "test shell" (uss_test.c) communication system designed using USART emulated on-chip USART. They both connected each other. These both peripherals implemented C513 device. after initializing speed USART emulated initialization speed on-chip hardware USART necessary well. reload values timer configured HW-USART baud rate generator calculated presented next formula: reload values timer configured HW-USART baud rate generator calculated presented next formula: USART_ Baud_ Rate_ using Timer2 fosc 65536 TH2,TL2) Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Load Measurement Emulating hardware module software subroutines decreases processor performance available user application software. load analysis shows fraction processor performance required emulating routines. processor load generated emulation software defined Load Time spent emulating interrupt service routines 100% Total amount time transmitting receiving bytes execution time required interrupt service routines emulating USART calculated analyzing compiler object module listing. next table presents load measurement results USART emulation on-chip running with different baud rates. Table Load Measurement Values USART emulation on-chip C513 Crystal Frequency Baud Rate Load 23.437 6.5% 48.368 13.0% 93.750 18.0% Attention: load value increases with falling clock generator frequencies. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Performance Limitations most severe limitation seen READ mode maximum baud rate. incoming Start triggers external interrupt related interrupt service routine start on-chip directly because interrupt service delay same order magnitude time 93.75 KBaud. Moreover this application note attempt on-chip hardware resources possible. This effort results higher demand software performance. addition having look C500 derivatives taken care about fact that e.g. C505 twice performance than C513. solution using C505 will result twice maximum baudrate than C513. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Make File file uss_make.bat contains statements start Keil C51compiler, linker locator. (Versions: V5.10, V3.52, V2.1) paths source file compiler library directories must modified user respect individual file structure personal computer. Make-File started typing `uss_make.bat' window switched directory containing this batch file. Semiconductor Group AP083201 09.98 Emulating USART Interface On-Chip Support KitCON-513 Evaluation Board KitCON-513 Evaluation Board starter (order Siemens Semiconductors www) which helps general approach C513. Generally speaking printed circuit board which lets load software down C513. After that C513 executes that code verified. starter delivered with C513 romless device C513 EEPROM device. advised firstly make C513 romless device load (program) code down C513 EEPROM device After that devices (romless EEPROM) have changed programmed code executed on-chip EEPROM. Using "test shell" usa_test.c SW-USART C513 EEPROM communicates with chip HW-USART C513 EEPROM device. port pins occupied HW-SSC HW-USART easily connected setting jumpers KitCON application area connector: next table presents port pins externally wired: Table Port pins externally wired KitCON-513 Evaluation Board HW-SSC-SRI HW-SSC-STO (P1.3) (P1.4) HW-USART-RXD (P3.0) HW-USART-TXD (P3.1) Ext. Interrupt (P3.2) Note: HW-SSC-SLK (P1.2) used testing purpose (e.g. scanning HW-SSC operation respect HW-USART Write timing). After pressing restart button test program runs endless loop. Semiconductor Group AP083201 09.98 Other recent searchesUDZS10B - UDZS10B UDZS10B Datasheet Tc100 - Tc100 Tc100 Datasheet NC7WBD3125 - NC7WBD3125 NC7WBD3125 Datasheet ML9352 - ML9352 ML9352 Datasheet MGF0952P - MGF0952P MGF0952P Datasheet DF005S - DF005S DF005S Datasheet CH-8002 - CH-8002 CH-8002 Datasheet AD8180 - AD8180 AD8180 Datasheet AD8182 - AD8182 AD8182 Datasheet AD8180R - AD8180R AD8180R Datasheet AD8182R - AD8182R AD8182R Datasheet
Privacy Policy | Disclaimer |