butterfly 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. spi_butterfly - parport-to-butterfly adapter driver
  2. ===================================================
  3. This is a hardware and software project that includes building and using
  4. a parallel port adapter cable, together with an "AVR Butterfly" to run
  5. firmware for user interfacing and/or sensors. A Butterfly is a $US20
  6. battery powered card with an AVR microcontroller and lots of goodies:
  7. sensors, LCD, flash, toggle stick, and more. You can use AVR-GCC to
  8. develop firmware for this, and flash it using this adapter cable.
  9. You can make this adapter from an old printer cable and solder things
  10. directly to the Butterfly. Or (if you have the parts and skills) you
  11. can come up with something fancier, providing ciruit protection to the
  12. Butterfly and the printer port, or with a better power supply than two
  13. signal pins from the printer port.
  14. The first cable connections will hook Linux up to one SPI bus, with the
  15. AVR and a DataFlash chip; and to the AVR reset line. This is all you
  16. need to reflash the firmware, and the pins are the standard Atmel "ISP"
  17. connector pins (used also on non-Butterfly AVR boards).
  18. Signal Butterfly Parport (DB-25)
  19. ------ --------- ---------------
  20. SCK = J403.PB1/SCK = pin 2/D0
  21. RESET = J403.nRST = pin 3/D1
  22. VCC = J403.VCC_EXT = pin 8/D6
  23. MOSI = J403.PB2/MOSI = pin 9/D7
  24. MISO = J403.PB3/MISO = pin 11/S7,nBUSY
  25. GND = J403.GND = pin 23/GND
  26. Then to let Linux master that bus to talk to the DataFlash chip, you must
  27. (a) flash new firmware that disables SPI (set PRR.2, and disable pullups
  28. by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and
  29. (c) cable in the chipselect.
  30. Signal Butterfly Parport (DB-25)
  31. ------ --------- ---------------
  32. VCC = J400.VCC_EXT = pin 7/D5
  33. SELECT = J400.PB0/nSS = pin 17/C3,nSELECT
  34. GND = J400.GND = pin 24/GND
  35. The "USI" controller, using J405, can be used for a second SPI bus. That
  36. would let you talk to the AVR over SPI, running firmware that makes it act
  37. as an SPI slave, while letting either Linux or the AVR use the DataFlash.
  38. There are plenty of spare parport pins to wire this one up, such as:
  39. Signal Butterfly Parport (DB-25)
  40. ------ --------- ---------------
  41. SCK = J403.PE4/USCK = pin 5/D3
  42. MOSI = J403.PE5/DI = pin 6/D4
  43. MISO = J403.PE6/DO = pin 12/S5,nPAPEROUT
  44. GND = J403.GND = pin 22/GND
  45. IRQ = J402.PF4 = pin 10/S6,ACK
  46. GND = J402.GND(P2) = pin 25/GND