75 lines · plain
1===================================================2spi_butterfly - parport-to-butterfly adapter driver3===================================================4 5This is a hardware and software project that includes building and using6a parallel port adapter cable, together with an "AVR Butterfly" to run7firmware for user interfacing and/or sensors. A Butterfly is a $US208battery powered card with an AVR microcontroller and lots of goodies:9sensors, LCD, flash, toggle stick, and more. You can use AVR-GCC to10develop firmware for this, and flash it using this adapter cable.11 12You can make this adapter from an old printer cable and solder things13directly to the Butterfly. Or (if you have the parts and skills) you14can come up with something fancier, providing circuit protection to the15Butterfly and the printer port, or with a better power supply than two16signal pins from the printer port. Or for that matter, you can use17similar cables to talk to many AVR boards, even a breadboard.18 19This is more powerful than "ISP programming" cables since it lets kernel20SPI protocol drivers interact with the AVR, and could even let the AVR21issue interrupts to them. Later, your protocol driver should work22easily with a "real SPI controller", instead of this bitbanger.23 24 25The first cable connections will hook Linux up to one SPI bus, with the26AVR and a DataFlash chip; and to the AVR reset line. This is all you27need to reflash the firmware, and the pins are the standard Atmel "ISP"28connector pins (used also on non-Butterfly AVR boards). On the parport29side this is like "sp12" programming cables.30 31 ====== ============= ===================32 Signal Butterfly Parport (DB-25)33 ====== ============= ===================34 SCK J403.PB1/SCK pin 2/D035 RESET J403.nRST pin 3/D136 VCC J403.VCC_EXT pin 8/D637 MOSI J403.PB2/MOSI pin 9/D738 MISO J403.PB3/MISO pin 11/S7,nBUSY39 GND J403.GND pin 23/GND40 ====== ============= ===================41 42Then to let Linux master that bus to talk to the DataFlash chip, you must43(a) flash new firmware that disables SPI (set PRR.2, and disable pullups44by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and45(c) cable in the chipselect.46 47 ====== ============ ===================48 Signal Butterfly Parport (DB-25)49 ====== ============ ===================50 VCC J400.VCC_EXT pin 7/D551 SELECT J400.PB0/nSS pin 17/C3,nSELECT52 GND J400.GND pin 24/GND53 ====== ============ ===================54 55Or you could flash firmware making the AVR into an SPI slave (keeping the56DataFlash in reset) and tweak the spi_butterfly driver to make it bind to57the driver for your custom SPI-based protocol.58 59The "USI" controller, using J405, can also be used for a second SPI bus.60That would let you talk to the AVR using custom SPI-with-USI firmware,61while letting either Linux or the AVR use the DataFlash. There are plenty62of spare parport pins to wire this one up, such as:63 64 ====== ============= ===================65 Signal Butterfly Parport (DB-25)66 ====== ============= ===================67 SCK J403.PE4/USCK pin 5/D368 MOSI J403.PE5/DI pin 6/D469 MISO J403.PE6/DO pin 12/S5,nPAPEROUT70 GND J403.GND pin 22/GND71 72 IRQ J402.PF4 pin 10/S6,ACK73 GND J402.GND(P2) pin 25/GND74 ====== ============= ===================75