← Documents Documentation/spi/butterfly.rst GitHub 원문 ↗

Linux 6.18.37 · SPI

spi_butterfly 병렬 포트 어댑터 드라이버

AVR Butterfly를 병렬 포트 bitbang SPI controller로 연결하는 케이블, ISP·DataFlash·USI 두 번째 버스의 핀 배선과 firmware 설정을 설명합니다.

Source pathDocumentation/spi/butterfly.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

butterfly.rst:1-74

AVR Butterfly를 병렬 포트 bitbang SPI controller로 연결하는 케이블, ISP·DataFlash·USI 두 번째 버스의 핀 배선과 firmware 설정을 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ===================================================
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
14 can come up with something fancier, providing circuit protection to the
15 Butterfly and the printer port, or with a better power supply than two
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.
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"
28 connector pins (used also on non-Butterfly AVR boards). On the parport
29 side this is like "sp12" programming cables.
30
31 ====== ============= ===================
32 Signal Butterfly Parport (DB-25)
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 ====== ============= ===================
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
47 ====== ============ ===================
48 Signal Butterfly Parport (DB-25)
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 ====== ============ ===================
54
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:
63
64 ====== ============= ===================
65 Signal Butterfly Parport (DB-25)
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
71
72 IRQ J402.PF4 pin 10/S6,ACK
73 GND J402.GND(P2) pin 25/GND
74 ====== ============= ===================
75

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

프로젝트와 활용 범위

1-20

`spi_butterfly`는 병렬 포트 어댑터 케이블을 제작해 AVR Butterfly와 함께 사용하는 하드웨어·소프트웨어 프로젝트다. Butterfly는 AVR microcontroller, 센서, LCD, flash, toggle stick 등을 갖춘 약 20달러짜리 배터리 구동 카드다. AVR-GCC로 firmware를 개발하고 이 어댑터 케이블로 flash할 수 있다.

오래된 printer cable을 Butterfly에 직접 납땜해 어댑터를 만들 수 있다. 부품과 기술이 있다면 Butterfly와 printer port 보호 회로를 넣거나, printer port signal pin 두 개보다 나은 전원 공급 장치를 갖춘 형태로 만들 수도 있다. 비슷한 케이블은 breadboard를 포함한 여러 AVR board와 통신하는 데도 사용할 수 있다.

이 방식은 단순한 ISP programming cable보다 강력하다. 커널 SPI protocol driver가 AVR과 상호작용할 수 있고 AVR이 interrupt를 발생시키게 할 수도 있다. 이후 protocol driver는 이 bitbanger 대신 실제 SPI controller에서도 쉽게 동작해야 한다.

spi_butterfly 구성
요소역할
Parallel port adapter cableLinux 병렬 포트를 Butterfly 신호에 연결
AVR Butterflyfirmware, 사용자 인터페이스, 센서 실행
spi_butterfly driver병렬 포트를 bitbang SPI controller로 제공
Kernel SPI protocol driverAVR 또는 DataFlash와 프로토콜 수준 통신

프로젝트를 이루는 하드웨어와 소프트웨어 요소다.

개발에서 실제 컨트롤러로 이동
spi_butterfly bitbangerKernel SPI protocol driverAVR firmware / peripheral
Real SPI controllerKernel SPI protocol driver

같은 protocol driver를 bitbang 환경에서 검증한 뒤 실제 SPI controller로 옮길 수 있다.

===================================================
spi_butterfly - parport-to-butterfly adapter driver
===================================================

This is a hardware and software project that includes building and using
a parallel port adapter cable, together with an "AVR Butterfly" to run
firmware for user interfacing and/or sensors.  A Butterfly is a $US20
battery powered card with an AVR microcontroller and lots of goodies:
sensors, LCD, flash, toggle stick, and more.  You can use AVR-GCC to
develop firmware for this, and flash it using this adapter cable.

You can make this adapter from an old printer cable and solder things
directly to the Butterfly.  Or (if you have the parts and skills) you
can come up with something fancier, providing circuit protection to the
Butterfly and the printer port, or with a better power supply than two
signal pins from the printer port.  Or for that matter, you can use
similar cables to talk to many AVR boards, even a breadboard.

This is more powerful than "ISP programming" cables since it lets kernel
SPI protocol drivers interact with the AVR, and could even let the AVR

첫 번째 SPI 버스와 DataFlash chip select

21-50

첫 케이블 연결은 Linux를 AVR과 DataFlash chip이 있는 SPI bus 및 AVR reset line에 연결한다. firmware를 다시 flash하는 데 필요한 전부이며, 핀은 Butterfly가 아닌 AVR board에서도 쓰이는 표준 Atmel ISP connector pin이다. 병렬 포트 쪽 구성은 `sp12` programming cable과 비슷하다.

첫 번째 SPI·ISP 케이블 배선
SignalButterflyParport DB-25
SCKJ403.PB1/SCKpin 2/D0
RESETJ403.nRSTpin 3/D1
VCCJ403.VCC_EXTpin 8/D6
MOSIJ403.PB2/MOSIpin 9/D7
MISOJ403.PB3/MISOpin 11/S7,nBUSY
GNDJ403.GNDpin 23/GND

Butterfly J403과 DB-25 병렬 포트 사이의 원문 핀 대응이다.

Linux가 이 bus의 master가 되어 DataFlash chip과 통신하려면 세 단계가 필요하다. 첫째, SPI를 비활성화하도록 PRR.2를 설정하고 `PORTB.[0-3]`을 지워 pullup을 끈 새 firmware를 flash한다. 둘째, `mtd_dataflash` driver를 설정한다. 셋째, chip select를 케이블로 연결한다.

DataFlash chip select 배선
SignalButterflyParport DB-25
VCCJ400.VCC_EXTpin 7/D5
SELECTJ400.PB0/nSSpin 17/C3,nSELECT
GNDJ400.GNDpin 24/GND

J400과 DB-25 사이에 추가하는 세 신호다.

DataFlash를 Linux master로 사용
Disable AVR SPI and PORTB pullupsConfigure mtd_dataflashWire SELECTLinux masters DataFlash SPI bus

firmware와 kernel driver, chip select 배선을 모두 준비한다.

issue interrupts to them.  Later, your protocol driver should work
easily with a "real SPI controller", instead of this bitbanger.


The first cable connections will hook Linux up to one SPI bus, with the
AVR and a DataFlash chip; and to the AVR reset line.  This is all you
need to reflash the firmware, and the pins are the standard Atmel "ISP"
connector pins (used also on non-Butterfly AVR boards).  On the parport
side this is like "sp12" programming cables.

	======	  =============	  ===================
	Signal	  Butterfly	  Parport (DB-25)
	======	  =============	  ===================
	SCK	  J403.PB1/SCK	  pin 2/D0
	RESET	  J403.nRST	  pin 3/D1
	VCC	  J403.VCC_EXT	  pin 8/D6
	MOSI	  J403.PB2/MOSI	  pin 9/D7
	MISO	  J403.PB3/MISO	  pin 11/S7,nBUSY
	GND	  J403.GND	  pin 23/GND
	======	  =============	  ===================

Then to let Linux master that bus to talk to the DataFlash chip, you must
(a) flash new firmware that disables SPI (set PRR.2, and disable pullups
by clearing PORTB.[0-3]); (b) configure the mtd_dataflash driver; and
(c) cable in the chipselect.

	======	  ============	  ===================
	Signal	  Butterfly	  Parport (DB-25)
	======	  ============	  ===================
	VCC	  J400.VCC_EXT	  pin 7/D5

AVR slave 또는 USI 두 번째 버스

51-74

다른 방법으로 AVR을 SPI slave로 만드는 firmware를 flash하고 DataFlash는 reset 상태로 유지한 뒤, 사용자 정의 SPI protocol driver에 bind하도록 `spi_butterfly` driver를 조정할 수 있다.

J405를 사용하는 USI controller는 두 번째 SPI bus로도 사용할 수 있다. 그러면 사용자 정의 SPI-with-USI firmware로 AVR과 통신하면서 Linux 또는 AVR이 DataFlash를 사용할 수 있다. 남는 parport pin이 충분하므로 SCK, MOSI, MISO, GND와 IRQ를 별도로 배선할 수 있다.

USI 두 번째 SPI 버스 배선
SignalButterflyParport DB-25
SCKJ403.PE4/USCKpin 5/D3
MOSIJ403.PE5/DIpin 6/D4
MISOJ403.PE6/DOpin 12/S5,nPAPEROUT
GNDJ403.GNDpin 22/GND
IRQJ402.PF4pin 10/S6,ACK
GNDJ402.GND(P2)pin 25/GND

원문이 제안하는 추가 DB-25 핀 연결이다.

두 버스 활용
Linux or AVRPrimary SPI busDataFlash
Linux parportUSI second SPI busCustom AVR firmware
AVR IRQParport ACK inputLinux driver

기본 DataFlash bus와 USI 기반 사용자 정의 AVR 통신을 분리한다.

	SELECT	  J400.PB0/nSS	  pin 17/C3,nSELECT
	GND	  J400.GND	  pin 24/GND
	======	  ============	  ===================

Or you could flash firmware making the AVR into an SPI slave (keeping the
DataFlash in reset) and tweak the spi_butterfly driver to make it bind to
the driver for your custom SPI-based protocol.

The "USI" controller, using J405, can also be used for a second SPI bus.
That would let you talk to the AVR using custom SPI-with-USI firmware,
while letting either Linux or the AVR use the DataFlash.  There are plenty
of spare parport pins to wire this one up, such as:

	======	  =============	  ===================
	Signal	  Butterfly	  Parport (DB-25)
	======	  =============	  ===================
	SCK	  J403.PE4/USCK	  pin 5/D3
	MOSI	  J403.PE5/DI	  pin 6/D4
	MISO	  J403.PE6/DO	  pin 12/S5,nPAPEROUT
	GND	  J403.GND	  pin 22/GND

	IRQ	  J402.PF4	  pin 10/S6,ACK
	GND	  J402.GND(P2)	  pin 25/GND
	======	  =============	  ===================