AVR-CDC-SPI.pdf

(328 KB) Pobierz
AVR-CDC-SPI
1 z 3
Virtual COM Port over Low-Speed USB
AVR-CDC
Home About CDC-232 CDC-IO CDC-SPI Driver Download FAQ Reference
>
About
CDC-SPI
CDC-232
Usage
The SPI (Serial Peripheral Interface Bus) is a standard for a synchronous serial communication between devices.
Devices communicate in master-slave mode where the master controls the data transfer. After generating eight shift-
clocks by the master, byte data are exchanged with the slave. SPI bus is adapted for many devices such as
microcontrollers, EEPROM, sensors..
Schematics
CDC-IO
Usage
Schematics
Sample Program
CDC-SPI
Usage
Schematics
SPI Data Exchange
Sample Program
The CDC-SPI is a damn COM-SPI bridge over the low-speed CDC protocol. The AVR receives byte data stream from
the host PC via USB and sends them to MOSI line. At the same time, it returns data stream received from MISO.
Driver
CDC Protocol
Usage
Windows
Mac OS
The installation is the same as CDC-232. The baudrate is arbitrary. Send binary data from terminal software or from
your application on PC through the virtual COM port.
Linux
FAQ
Device Recognition
The CDC-SPI has two slave-selectors (ATtiny45 version has one selector). /SS0 is controlled by SendBreak signal
from the host, and /SS1 by DTR. It may control four slave devices if these lines are decoded.
Communication Problem
Others
>
Download
CDC-SPI Implementation on ATtiny45
>
Reference
Schematic s
The registers on SPI lines are for short protection. Use higher value(3-10Kohms) when connecting to the slave with
different Vcc.
The Reset pin is used as the slave selector in ATtiny45 version. It disables further SPI downloading.
CDC-SPI for ATtiny45-20
The clock speed is selectable in ATtiny461 and ATtiny2313 version.
413532890.002.png 413532890.003.png
2 z 3
copyright (c)2011 Osamu Tamura @
Recursion Co., Ltd. All rights reserved.
CDC-SPI for ATtiny2313-20
There are four SPI modes (clock polarity and phase) supported in ATmega version. See the datasheet in detail.
CDC-SPI for ATmega8/48/88-20
Sample Program
It's sometimes necessary to test the actual SPI protocol before embedding a device into system. This is a simple test
program to check the SPI sequence. It just switches the /SS lines and send/receive data through virtual COM port.
This is an example to access to EEPROM 93C46 (AT93C46D).
Testing EEPROM (93C46)
C:\cdcspi.2010-02-06\spitest\release>spitest 13
CDC-SPI Tester by Osamu Tamura
com13 < ss0 0
com13 < ss0 1
com13 < 2 60 ; EWEN
com13 > FF FF
com13 < ss0 0
com13 < ss0 1
com13 < 3 1 0 ; READ $01
com13 > FF FF FF ; = FF
com13 < ss0 0
com13 < ss0 1
com13 < 2 81 73 ; WRITE $01 <= 73
com13 > FF FF FF
com13 < ss0 0
com13 < ss0 1
com13 < 3 1 0 ; READ $01
com13 > FF FF 73 ; = 73
com13 < ss0 0
413532890.004.png 413532890.005.png
3 z 3
com13 < ss0 1
com13 < 3 81 ; ERASE $01
com13 > FF FF
com13 < ss0 0
com13 < ss0 1
com13 < 3 1 0 ; READ $01
com13 > FF FF FF ; = FF
com13 < ss0 0
com13 < ss0 1
com13 < 2 0
; EWDS
com13 > FF FF
com13 < ss0 0
com13 < q ; quit
One of the most familiar SPI implementations is the AVR's serial downloader. With this SPI bridge, you can easily
program the AVR chips. This is an example of the AVR writer. It enables writing to the SPI programmable
ATtiny/ATmega devices (AT90*** are not supported).
Downloading to ATmega8
C:\cdcspi.2010-02-06\spiprog\release>spiprog -c13 -f8FFF spimega8.hex
CDC-SPI AVR Programmer Ver. 0.5 by Osamu Tamura
Signature: 1E-93-07 (Flash 8KB, Page 32words)
LockBits: FF
FuseBits: FF-8F-FF
2226 bytes loaded.
Device erased.
Writing ................................... done.
Verifying ................................... done.
Writing FuseBits [8F-FF] ... done.
2240 bytes programmed successfully.
Since the CDC-SPI was designed as a general purpose COM-SPI bridge, it takes 8 bytes transfer to program one byte
flash data. If you are just interested in AVR downloading, consider other projects (e.g. USBasp).
All the source code, hex files, schematics and sample programs are in download page.
413532890.001.png
Zgłoś jeśli naruszono regulamin