360 likes | 523 Views
START first foil. Agenda. USB basics Why USB Bus structure Enumeration, speed Layer model Physical interface Transfer, transaction, packet. USB - ISDN Terminal Adapter (TA) Standard TA (PC ISDN card) - USB TA Endpoints usage, ISDN data format Hardware implementation, Buffering
E N D
Agenda • USB basics • Why USB • Bus structure • Enumeration, speed • Layer model • Physical interface • Transfer, transaction, packet • USB - ISDN Terminal Adapter (TA) • Standard TA (PC ISDN card) - USB TA • Endpoints usage, ISDN data format • Hardware implementation, Buffering • B-channel performance • Layer model USB TA PC ISDN card • D-channel signalization through USB • D-channel performance • Hardware platform, tools • SAB-C541U
ISDN USB based Microcontroller in Telekom Peripherals for PC's ...the interfacing solution
Fax Analog line Modem Analog line Internet Service provider has to offer an ISDN connection ISDN line ISDN Line ISDN line Standard ISDNPC Card (TA) 64Kbit/s Standard ISDN PC Card ISDN Terminal Adapter (TA)Digital Communication ...connect to ISDN
Enhanced SW on PC same ISDN PC Card Fax Analog line ISDN Line Modem Analog line ISDN Line ISDN line Standard ISDN PC Card ISDN TA "Modem""Connecting the Digital to the Analog World" Standard ISDN PC Card ...connect to ISDN
IPAC (PSB2115) PCI Bus Example for a Passivelow-cost ISDN PC-Card (TA) ISDN ...connect to ISDN
"Passive" USBlow-cost ISDN TA SAB-C541 IOM-2 IPAC (PSB2115) ISDN ...connect to ISDN
USBTransfer types • Control (e.g.: configuration, messages) • bursty, host initiated (bus management, configuration) • guaranteed bandwith of max. 10% • error-free data delivery guaranteed • Interrupt (e.g.: mouse, joystick....) • small bursty, low bandwidth required • error-free data delivery guaranteed • polling is used (by host) to check for "interrupt events” • polling intervall programmable. From 1ms to 255ms (FS) 10ms to 255ms (LS) • Isochronous (e.g.: audio, telephony.....) • for data which need to be periodically sent • predictable latency on data delivery. • no error check, error-free data delivery is not guaranteed • Bulk (e.g.: printer, scanner, still camera.....) • non periodic, bursty, ideal for large amounts of data • error-free data delivery guaranteed ...basics
Bulk Control Frame = 1ms Stereo Audio SOF Telephony low-speed SOF Bulk Isochronous Interrupt any lowspeed device like keyboard, mouse, etc. USB Frame Modelexample printer printer ...basics
Endpoint type Direction Number Function Control Input Output 0 device configuration (IN / OUT), device control Isochronous Input 1 B1 and B2 channel data reception Isochronous Output 2 B1 and B2 chan. data transmission Isochronous Input 3 D-channel control and D-channel data transmission Sync feedback information for EP2 Isochronous Output 4 D-channel control and D-channel data reception Implementation With a SingleUSB Interface, Endpoint Assignment ...connect to ISDN
D - channel B1 - channel B2 - channel Which data has to be transferred? IPAC ISDN Data / Address bus interrupt SAB-C541U D - OUT pipe (isochronous) D - IN pipe (isochronous) B1 / B2 - OUT pipe (isochronous) B1 / B2 - IN pipe (isochronous) ...connect to ISDN
USB Timing isAsynchronous to the ISDN Timing • every 125µs is an IOM-2 frame interrupt generated • external interrupt 1 is used to keep track of the IOM-2 data frame timing • each USB frame may contain 7, 8 or 9 IOM-2 frames • complex circular buffers are needed ...connect to ISDN
SAB-C541U USB Buffer (265 Bytes) max. 9. B1, B2 in IPAC (PSB 2115) (2 Byte every 125µs) EP1 (18 byte) IN - ISO B1 channel 1. B1, B2 in B2 channel max. 9. B1, B2 out OUT - ISO EP2 (18 byte) (2 Byte every 125µs) B1 channel 1. B1, B2 out B2 channel ISDN EP4 IN - ISO D-channel reception Internal Register OUT - ISO EP3 D-channel transmission Control EP0 Control Register USB Timing Asynchronousto ISDN Timing Interrupt controlled every 125µs transfer controlled by C'51 µC code Overview, logical connection
B1 B2 B1 B2 18 Bytes (overflow) 16 Bytes (default) 14 Bytes (underflow) -2 +2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 16 2 4 6 8 10 12 18 14 14 This is supported within the On-chip USB buffer (256Bytes) 32 Bytes Isochronous Pipes SupportingB-Channel Data transfer (EP1 + EP2) • Every B-channel ISO-pipe is defined with the length 32 Bytes • B1 and B2 are placed multiplexed into the pipe • The standard transmitted length is 16 Bytes • ISDN will feed-in 14,16 • Depending on the ISDN input • two Bytes will be added or subtracted by the HOST (PC) or 18Bytes per USB frame (1ms) ...B-channel pipes
1) USB buffer is empty and CPU buffer is filled. 2) CPU buffer is full and swapped toUSB side. USB read action enabled. 3) USB buffer is read out whileCPU writes to its own page. 5) CPU Buffer is full and swapped toUSB side. USB read action enabled. 4) USB buffer is empty, CPUbuffer is not yet full. 6) USB buffer is read out whileCPU writes to its own page. USB Dual BuffersSupport for Isochronous Pipes e.g. USB read access
SW Example to access the USB buffers included in the SAB-C541U void my_func (void) interrupt 9 {EPSEL = IN_CHANNEL_NR; /* select EP number */ B1_IN = USBVAL; /* USBVAL = SFR which passes data to the */ B2_IN = USBVAL; /* Internal USB module, */ D_CI_IN = USBVAL; /* this allows easy and fast data access */ MON_IN = USBVAL; EPSEL = OUT_CHANNEL_NR; USBVAL = B1_OUT; /* in both directions! */ USBVAL = B2_OUT; USBVAL = D_CI_OUT; USBVAL = MON_OUT; if(++int_cnt==8){ /* e.g. packet size 8 bytes */ EPBSn = EPBSn | DONE_; /* set USB buffer FULL for OUT CHANNEL */ EPSEL = IN_CHANNEL_NR; /* select endpoint for IN CHANNEL */ EPBSn = EPBSn | DONE_; /* set USB buffer FULL for CHANNEL */ int_cnt = 0; }} ...SW solution
IOM-2 Int. IN_write_ptr ISAC-S SOF Int. 14, 16 or 18 Bytes from OUT_read_ptr OUT_write_ptr B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 ISAC-S B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 B1, B2 IN_read_ptr ISAC-S OUT_read_ptr OUT_write_ptr IN_write_ptr B-channel, Circular BuffersSW Implementation IN Queue OUT Queue ISAC-S IN_read_ptr IN_read_ptr ISAC-S B1, B2 B1, B2 B1, B2 ISAC-S OUT_write_ptr IN_read_ptr B1, B2 B1, B2 ISAC-S OUT_write_ptr B1, B2 B1, B2 ISAC-S IN_read_ptr B1, B2 B1, B2 OUT_write_ptr ISAC-S ISAC-S B1, B2 B1, B2 OUT_write_ptr IN_read_ptr B1, B2 B1, B2 ISAC-S ISAC-S B1, B2 B1, B2 B1, B2 OUT_write_ptr ISAC-S IN_read_ptr ISAC-S ISAC-S ...SW solution
SOF-Interrupt IOM-2 Interrupt (1ms) (125µs) write data to read from circular Buffer USB memory OUT_Queue NO (internal RAM of C54x) USB_FIFO = ) (circular Buffer B1_IOM (DU) = IN_Queue OUT_Queue (B1) empty ? B2_IOM (DU) = IN_Queue USB_FIFO = OUT_Queue (B2) YES write to circular Buffer read data from (internal RAM of C54x ) USB memory OUT_Queue = B1_IOM (DD) USB memory NO OUT_Queue = B2_IOM (DD) IN_Queue (B1) = empty ? USB_FIFO IN_Queue (B2) = USB_FIFO YES Return from Interrupt Return from Interrupt SW Implementation; Both B-channel Directions handled parallel ...SW solution
Results, Performance RequirementsISDN B channel data transfer • Both interrupt service routines carry out two B-channels (in both directions) simultaneously • The IOM interrupt service routine is called every 125µs and has the highest priority • the maximum runtime of the IOM interrupt service routine is 64 cycles (32µs) • ~25% of the C541U computing performance is required. • The USB interrupt service routine is called every 1000µs • the maximum runtime of the USB interrupt service is ~460 cycles (230µs) • the USB interrupt service routine will be interrupted(max. twice) by the IOM interrupt service routine • 23% of the C541U computing performance is required. • As a result, the C541U will spend 49% of its computing performance on maintaining the two B-channels through the isochronous pipes. asynchronous timing Results ...connect to ISDN
Applications Applications CAPI Common ISDN Application Interface CAPI Unpredictable Delays! physical connection HOST Device USB pipes IPAC (PSB2115) IPAC (PSB2115) ISDN ISDN Register I/O Layer Models: ISDN PC Card vs. USB ISDN TA HW-Interface Virtual HW (ISDN controller) USB ISDN ISA/PCI Bus Register I/O USB-standard OS-driver Firmware on SAB-C541U ...connect to ISDN
IPAC ISDN SAB-C541U D-channelControl and Frame Transfer • The firmware supports the following D-channel related functions via specific isochronous commands: • D-channel controller and S-transceiver initialization • D-channel frame transmission • layer-1 status control • HDLC controller reset • The USB ISDN TA firmware reports the following D-channel related information via the isochronous pipe to the host • received D-channel frames • layer-1 status information • HDLC controller status information, e.g. the completion of a D-channel frame transmission ...connect to ISDN
8 Bytes D0 D1 D2 D3 D4 D5 D6 D7 D-Channel Pipes Isochronous OUT (EP4) • The 8 Bytes are filled with commands from the PC to the IPAC (via the microcontroller): • D-channel controller and S-transceiver initialization • D-channel frame transmission • layer-1 status control • HDLC controller reset ...D-channel pipes
8 Bytes D0 D1 D2 D3 D4 D5 D6 D7 [ o p t i o n a l p a r a m e t e r s ] D-Channel Pipes Isochronous OUT (EP4), details • CMD ID = command identification CMDID • Opt. parameters • data referring to command ID ...D-channel pipes
D0 D1 D2 D3 D4 D5 D6 D7 CMDID [ o p t i o n a l p a r a m e t e r s ] frag. counter (01) D7 D7 D7 (02) ext. RAM D6 D6 D6 stack (PC) D5 D5 D5 D4 D4 D4 D3 D3 D3 (01) D2 D2 D2 D1 D1 D1 (49) ID ID ID t0 t0+1ms t0+ 49ms D-Channel Pipes Isochronous OUT (EP4), example • CMD ID e.g.send data • data will be split in fragments (opt. parameters) • fragments will be buffered in device length (e.g. 49) controlledby µC (02) (49) ...D-channel pipes
8 Bytes [ i n d i c a t i o n ] D0 D1 D2 D3 D4 D5 D6 D7 CMDID SYNC feedback 16 Bytes (default) -2 +2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B2 B1 B1 B2 B2 16 2 4 6 8 10 12 14 18 D-Channel Pipes Isochronous IN (EP3), SYNC • SYNC = synchronizing feedback for B-channel OUT • 14, 16 or 18 B-channel frames 14 ...D-channel pipes
8 Bytes D0 D1 D2 D3 D4 D5 D6 D7 SYNC [ i n d i c a t i o n ] D-Channel Pipes Isochronous IN (EP3), CMD ID CMDID • CMD ID = command identification • indication = acknowledge to ISDN commands • received D-channel frames • layer-1 status information • HDLC controller status information • e.g. the completion of a D-channel frame transmission ...D-channel pipes
D0 D1 D2 D3 D4 D5 D6 D7 CMDID SYNC [ i n d i c a t i o n ] Queue element including data D0 D1 D2 D3 D4 D5 D6 D7 Layer-1 status SYC [ d a t a ] Queue element including pointer D0 D1 D2 D3 D4 D5 D6 D7 pointer SYNC [ p o i n t e r ] D-Channel IN-Pipes, details CMD ID, e.g. layer-1 status information or pool of memory blocks Pool of memory blocks Pool of memory blocks ...D-channel pipes
Memory block for temp. Storage of D-channel frame to be transmitted Isochronous Pipe Transmit FIFO data D-channel transmit data SAB-C541U Isochronous Pipe Isochronous pipe messages Queue for messages from device to USB Staus messages additional messages parameters Pool of memory blocks for temp. Storage of R-FIFO data bytes Receive FIFO data Pool of memory blocks for temp. Storage of R-FIFO data bytes Pool of memory blocks for temp. Storage of R-FIFO data bytes Frame Transmission / Reception ISDN Control Pipe IPAC Control pipe commands Data flow for the D-channel pipes
Results, D-channel handlingPerformance Requirements • The 16 kbit/sec data rate requires packets of 32 bytes • 32 bytes = size of the D-channel transmit and receive FIFOs • transferred from USB to the ISAC-S and vice versa in 16ms periods • In addition, the CPU-load for temporary storage of a D-channel frame has to be considered • One additional notification from the USB ISDN TA to the host shall be generated in each 16ms period, too • Instruction cycle is 500ns (@ 12MHz external) • max. 5000 cycles are needed to execute the sample routines. • As a result, the C541U spends only ~20% of its computing performance on maintaining the D-channel. D - channel Results ...connect to ISDN
Procedure SAB-C541U CPU-Load C541U CPU performance for handlingan USB ISDN Terminal Adapter D-channel handling, transfer of D-channel messages from USB to IPAC and vice versa ~20% B-channel data transfer from USB to IPAC and vice versa ~50% ~70% Results ...connect to ISDN
Reference Design:USB ISDN Terminal Adapter ISDN ...HW solution connects to ISDN
USB-MicrocontrollerC540U Family ...the interfacing solution
8 lines Port 0 Port 1 6 / 8 lines 1) USB PLL 8 lines Port 2 Transceiver Module 8 lines Port 3 1)P-LCC-44: 6lines; S-DIP-52: 8lines C540U / C541U Block Diagram Oscillator Watchdog RAM 256 x 8 OTP4K x 8 (C540U) 8K x 8 (C541U) OSC & Timing C500 EmulationSupport logic(E-Hooks) Prog. Watchdog Timer(C541U only) SSC (SPI) Interface(C541U only) Timer 0 LED Timer 1 LED D+ D- LED Interrupt Unit ...the interfacing solution
C540U FamilyList of Features • Enhanced 8-Bit C500-CPU • 500 ns Instruction Cycle Time @ 12 MHz CPU Clock • Two 16-bit Timer/Counters (C501 compatible T0/1) • [4kbytes in the C540U] 8 Kbytes OTP / 256 bytes RAM • USB Device Core (FS/LS speed) • Synchronous Serial Channel, Watchdog Timer [C541U only] • 30 digit. I/O Ports, 32 in SDIP52 • LED Driver capability on 3 dedicated pins, 10 mA / 4,5 to 5,5 V • Power supply voltage range: according to USB spec • Enhanced HooksTechnology • 48 MHz PLL on-chip for FS • Transceiver, D+ D-, on-chip 4kbytes in the C540U C541U only ...the interfacing solution
Microcontrollers general: ...for infos on our USB parts Infos on INTERNET http://www.siemens.de/Semiconductor/Microcontroller/ http://www.siemens.de/Semiconductor/products/ICs/34/usb.htm ...the interfacing solution