TM USB-SPI Driver-free USB to synchronous serial SPI slave interface Summary Mechanical Specifications USB-SPI is a single chip USB to synchronous serial SPI slave interface. It greatly simplifies the connection of personal computer to a microcontroller capable of communicating in SPI master mode. In addition to the standard 4 SPI control lines, 11 additional Virtual I/O lines have custom-defined functionality. USB-SPI uses the Human Interface Device (HID) USB profile. It does not require USB driver installation, and so is compatible with present and future Windows, Linux and Mac operating systems. Applications USB-SPI is firmware for the PIC18LF2455 and USB SPI slave for connection to SPI host devices PIC18F14K50 microcontrollers. It requires only a few discrete components and is available 28-pin DIL and 20- USB data transfer for consumer products pin SSOP packages. USB industrial control For SPI master applications (to control SPI slave Firmware Factory USB Product Family devices), our expandIO-USB product is more suitable. USB-232 asynchronous serial interface Features TEAleaf-USB security and authentication dongle Suitable for connection to SPI master devices expandIO-USB I/O expander Single chip solution USB-SPI synchronous serial interface True HID plug and play - No drivers required USB-I2C synchronous serial interface USB 2.0 compatible USB-TakeOff managed power take-off, wakeup and charge controller Achievable data transfer rates up to 600K baud USB-DAQ data logger Max SPI clock rate 1MHz USB-FileSys USB embedded file system 32-bit serial number 128-byte FIFO receive buffer Table 1. Electrical Specifications 128-byte FIFO transmit buffer Operating voltage (20 pin / 28 pin) 1.8V/2.7V5.5V Operating voltage 1.8V 5V Typical/max supply current, Vdd = 5.0 10mA / 21mA Operating Temperature -40C to +85C 11 auxiliary I/O pins, configurable as digital I/O, Refer to base microcontroller data sheet for further information 10-bit A-to-D, USB status VID, PID, product descriptor and I/O configuration Firmware Factory Ltd may be specified at program time or at runtime rd 2 Marshall St, 3 Floor PIC18F14K50-based DIL, SSOP packages London W1F 9BB, UK sales firmwarefactory.com PIC18LF2455-based DIL, SIOC packages support firmwarefactory.com 128-byte Rx buffer SPI Engine USB Serial 128-byte Tx buffer Engine Data 128-bAuxiliayte Tx bufferry I/O USB Status Control Outputs Inputs p1 of 9 26-Aug-10 USB-SPI HW144-7 www.hexwax.comand 0, and 1,1, 0,1, 1,0, 0.0, respectively). Refer Basic Operation to table 3. The maximum permitted clock rate is 1MHz. To the electronic system (device), USB-SPI looks like a Table 3. SPI Modes SPI serial slave device. To the PC (host), it looks like a MODE CPOL CPHA Description Human Interface Device (HID) with which it may A* 1 1 SCK idle high exchange information using simple commands. 3 Data changes on SCK high-to-low 1,1 Data read on SCK low-to-high Using the HID USB profile means that no driver B 0 1 SCK idle low installation is required and immediate compatibility is 1 Data changes on SCK low-to-high assured on Windows, Linux and OS systems. 0,1 Data read on SCK high-to-low Additionally, software can find the device automatically C 1 0 SCK idle high without needing to know which virtual COM port it is 2 Data changes on SCK low-to-high occupying. 1,0 Data read on SCK high-to-low D 0 0 SCK idle low 0 Data changes on SCK high-to-low Pin Functions 0,0 Data read on SCK low-to-high * = default configuration The pin functions are shown in table 2. The function of the virtual I/O pins is reconfigurable, so their default Vpp, PGC, PCD settings are also shown. Note that the output pins are in a tri-state condition until ~20s after power-on. TEAclipper programming pins. Refer to the Delivery and Programming section for details. Note that the Vpp Table 2. Device Pinout pin may be subject to voltages as high as 12V during DIL SSOP Name Description programming. 1 4 VIO0 Virtual I/O / *Reset (in) Vpp TEAclipper Vpp VIO pins 5 5 VIO1 Virtual I/O / *Tx Ind (out) 6 6 VIO2 Virtual I/O / *Rx Ind (out) The VIO pin functions can be reconfigured as detailed in 11 7 VIO3 Virtual I/O / *Tx/Rx Ind (out) the customization section. The default functions are 7 8 SS Slave Select input (Active low) shown in table 2. The pins can be configured as follows. 18 9 MISO Slave serial data output No Function 12 10 VIO4 Virtual I/O / *All-Systems-Go (out) 22 11 SCK Slave serial data clock input The pin is a digital input that has no effect. To minimize 13 12 VIO5 Virtual I/O / *Suspend (out) power consumption, it should be biased high or low. 21 13 MOSI Slave serial data input This setting is available on all VIOs. 17 14 VIO8 Virtual I/O / *Tx Buffer Empty (out) 23 15 VIO9 Virtual I/O / *Send (int) Reset 24 16 VIO10 Virtual I/O / *Rx Buffer Not Full (out) 14 17 Vusb USB supply filter The pin is an active low reset input. Resetting the 15 D- USB data - device effectively implements the soft detach function. 18 27 PGC TEAclipper PGC This setting is available on VIO0 only. 16 D+ USB data+ 19 USB Power Sense 28 PGD TEAclipper PGD 8,19 20 Vss Power ground reference If the device is capable of operating while not plugged 20 1 Vdd Power positive input into a USB port, a USB Power Sense input should be 9 3 OSC1 Oscillator output provided. This pin should indicate that a voltage is 10 2 OSC2 Oscillator input detected on the V+ pin of the USB connector. It is used * = default configuration = active low to reduce power consumption by entering into a sleep mode when the USB is not present, and also to ensure The pin functions are described in detail below. that the USB engine correctly initializes when the device is plugged in. The SPI port is not operational during Vss, Vdd, Vusb sleep. This setting must be on VIO9. Vss is the power supply ground reference. Vdd should Self Power Sense be connected to a regulated supply, for example the USB bus power. Vusb should be connected, via a If the device is capable of operating while not plugged 470nF capacitor, to Vss. See for example C8 in figure 2. into a USB port, a Self Power Sense input may be provided. This pin should indicate when the device is OSC1, OSC2 not drawing power from the USB bus and can help the OSC1 and OSC2 should be connected to a 12MHz PC manage its power budget. This setting is available parallel cut crystal circuit with 22pF capacitors. It may on any VIO pin. be replaced with a 12MHz resonator with 0.25% total Tx Indication tolerance. Output for connecting to a transmit indication LED. It SCK, MOSI, MISO, SS turns on for approximately 100ms when data has been SPI serial data I/O. Data is input on MOSI and output transmitted to the host. This setting is available on any on MISO if SS is asserted (active low) and the SCK VIO pin except VIO0. input is clocked. SPI can be operated in any of modes A, B, C or D (also known as modes 3, 1, 2 p2 of 9 26-Aug-10 USB-SPI HW144-7 www.hexwax.com