Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 1 | =================================================== |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 2 | spi_butterfly - parport-to-butterfly adapter driver |
| 3 | =================================================== |
| 4 | |
| 5 | This is a hardware and software project that includes building and using |
| 6 | a parallel port adapter cable, together with an "AVR Butterfly" to run |
| 7 | firmware for user interfacing and/or sensors. A Butterfly is a $US20 |
| 8 | battery powered card with an AVR microcontroller and lots of goodies: |
| 9 | sensors, LCD, flash, toggle stick, and more. You can use AVR-GCC to |
| 10 | develop firmware for this, and flash it using this adapter cable. |
| 11 | |
| 12 | You can make this adapter from an old printer cable and solder things |
| 13 | directly to the Butterfly. Or (if you have the parts and skills) you |
Stéphane Blondon | d1ad0a7 | 2021-04-06 14:31:50 +0200 | [diff] [blame] | 14 | can come up with something fancier, providing circuit protection to the |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 15 | Butterfly and the printer port, or with a better power supply than two |
David Brownell | 9c1da3c | 2006-01-21 13:21:43 -0800 | [diff] [blame] | 16 | signal pins from the printer port. Or for that matter, you can use |
| 17 | similar cables to talk to many AVR boards, even a breadboard. |
| 18 | |
| 19 | This is more powerful than "ISP programming" cables since it lets kernel |
| 20 | SPI protocol drivers interact with the AVR, and could even let the AVR |
| 21 | issue interrupts to them. Later, your protocol driver should work |
| 22 | easily with a "real SPI controller", instead of this bitbanger. |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 23 | |
| 24 | |
| 25 | The first cable connections will hook Linux up to one SPI bus, with the |
| 26 | AVR and a DataFlash chip; and to the AVR reset line. This is all you |
| 27 | need to reflash the firmware, and the pins are the standard Atmel "ISP" |
David Brownell | 9c1da3c | 2006-01-21 13:21:43 -0800 | [diff] [blame] | 28 | connector pins (used also on non-Butterfly AVR boards). On the parport |
| 29 | side this is like "sp12" programming cables. |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 30 | |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 31 | ====== ============= =================== |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 32 | Signal Butterfly Parport (DB-25) |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 33 | ====== ============= =================== |
| 34 | SCK J403.PB1/SCK pin 2/D0 |
| 35 | RESET J403.nRST pin 3/D1 |
| 36 | VCC J403.VCC_EXT pin 8/D6 |
| 37 | MOSI J403.PB2/MOSI pin 9/D7 |
| 38 | MISO J403.PB3/MISO pin 11/S7,nBUSY |
| 39 | GND J403.GND pin 23/GND |
| 40 | ====== ============= =================== |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 41 | |
| 42 | Then to let Linux master that bus to talk to the DataFlash chip, you must |
| 43 | (a) flash new firmware that disables SPI (set PRR.2, and disable pullups |
| 44 | by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and |
| 45 | (c) cable in the chipselect. |
| 46 | |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 47 | ====== ============ =================== |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 48 | Signal Butterfly Parport (DB-25) |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 49 | ====== ============ =================== |
| 50 | VCC J400.VCC_EXT pin 7/D5 |
| 51 | SELECT J400.PB0/nSS pin 17/C3,nSELECT |
| 52 | GND J400.GND pin 24/GND |
| 53 | ====== ============ =================== |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 54 | |
David Brownell | 9c1da3c | 2006-01-21 13:21:43 -0800 | [diff] [blame] | 55 | Or you could flash firmware making the AVR into an SPI slave (keeping the |
| 56 | DataFlash in reset) and tweak the spi_butterfly driver to make it bind to |
| 57 | the driver for your custom SPI-based protocol. |
| 58 | |
| 59 | The "USI" controller, using J405, can also be used for a second SPI bus. |
| 60 | That would let you talk to the AVR using custom SPI-with-USI firmware, |
| 61 | while letting either Linux or the AVR use the DataFlash. There are plenty |
| 62 | of spare parport pins to wire this one up, such as: |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 63 | |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 64 | ====== ============= =================== |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 65 | Signal Butterfly Parport (DB-25) |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 66 | ====== ============= =================== |
| 67 | SCK J403.PE4/USCK pin 5/D3 |
| 68 | MOSI J403.PE5/DI pin 6/D4 |
| 69 | MISO J403.PE6/DO pin 12/S5,nPAPEROUT |
| 70 | GND J403.GND pin 22/GND |
David Brownell | 2e10c84 | 2006-01-11 11:23:49 -0800 | [diff] [blame] | 71 | |
Mauro Carvalho Chehab | 9cdd273 | 2019-07-31 17:08:50 -0300 | [diff] [blame] | 72 | IRQ J402.PF4 pin 10/S6,ACK |
| 73 | GND J402.GND(P2) pin 25/GND |
| 74 | ====== ============= =================== |