FabFTDI - Copy.html 10.7 KB
Newer Older
Prashant Patil's avatar
Prashant Patil committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>FabFTDI</title>
</head>

<body>
<h1>FabFTDI: A Do-It-Yourself FTDI Cable (i.e. USB to Serial Converter) </h1>
<h1>&nbsp;</h1>
<h1>1 Introduction </h1>
<p>FabFTDI is DIY version of FTDI cable that can be made in fablab and this page descirbes how to make it. &nbsp;The FabFTDI uses an Atmega16U2 microcontroller and is based on USbtoSerial example of LUFA library. Figure below shows the schematic diagram of the FabFTDI:</p>
<img src="FabFTDI_Schematic.png" width="900" height="560" alt=""/>
<p><em>Schematic circuit diagram of FabFTDI</em></p>
<p>&nbsp;</p>
<p>The FabFTDI is powered through USB port which provides 500mA at 5V. The USB data line D+/D- is used to communicate with the microcontrolle's USB controller. Since the data lines operate at 3.3V, two voltage limiting zener diodes are used to limit the voltage in these pins. The D- line is pulled-up to the 5V through 1.5K resistor to indicate to the host computer that the connnected device is a low-speed USB device. The USB controller needs a precise clock, therefore, an external 16MHz crystal is used as a precise clock source. The LED and the corresponding resistor R4 is optional but if used can be used as visual indication of data communication. The FabFTDI is a USB 2.0 Full-speed device and support upto&nbsp;38400bps of serial communication. The Unix and Mac OS doesn not require any drivers, however, a driver is required for windows operating system (more on this later). </p>
<h1>2 Fabrication of FabFTDI</h1>
<h2>2.1 FabFTDI Using ATTiny102</h2>
<p>ATTiny102 is a low-cost 8-pin micro-controller with in-built UART. This version of the FabFTDI uses V-USB for software-only implementation of a low-speed USB device and is based on V-USB CDC example. Figure below shows the schematic diagram of the circuit</p>
<h3>2.1.1 Schematic Circuit Diagram</h3>
<img src="FabFTDIAttiny102/FabFTDITSchematic.png" width="800" height="430" alt=""/>
<p>Figure below shows the routed board. </p>
<h3>2.1.2 Board Design</h3>
<img src="FabFTDIAttiny102/FabFTDIBoard.png" width="800" height="298" alt=""/>
<h3>2.1.3 Board Fabrication and Assembly</h3>
<ol>
  <li>Download the PNG files for trace and board outline from links below - FabFTDI traces (1000dpi) FabFTDI board outline (1000dpi) </li>
  <li>Use the standard PCB milling process to fabricate PCB. </li>
  <li>You will need following components: Attiny45, two 3.3V Zener diode, 0.1uF capacitor, two 49ohm resistors, two 470ohm resistors, 1K resistor, 499ohm resistor, 2x3 pin header and 1x6 pin header. </li>
  <li>Make sure to solder zerner diode in the right orientation. The anode (A) should be connected to GND and cathode (C) should be connected to D- or D+. </li>
  <li>If there is any access copper left in front of the middle two pads of USB footprint in the board, remove it using a knife and apply some solder to all the pads of USB lines as shown below-</li>
</ol>
<h3>2.1.4 Programing Fuses &amp; Firmware</h3>
<ol>
  
  <li>Download the firmware file from <a href="Firmware/default/cdctiny45.hex">here</a>. Flash it using the following command (replace avrisp2 with usbtiny if you are using fabisp)<br />
    <br />
    sudo avrdude -p t45 -c avrisp2 -P usb -U flash:w:cdctiny45.hex:i <br />
  <br />
  </li>
  
  <li>Flash fuses using following commands<br />
    <br />
    <ul>
      <li>sudo avrdude -p t45 -c avrisp2 -U lfuse:w:0xF1:m</li>
      <li>sudo avrdude -p t45 -c avrisp2 -U hfuse:w:0xCE:m</li>
      <li>sudo avrdude -p t45 -c avrisp2 -U euse:w:0xFF:m<br />
      </li>
    </ul>
  </li>
</ol>
<h2>2.2 FabFTDI Using Attiny441</h2>
<h3>2.2.1 Schematic Circuit Diagram</h3>
<img src="FabFTDI Attiny441/FabFTDSchematic.png" width="800" height="459" alt=""/>
<h3>2.2.2 Board Design</h3>
<img src="FabFTDI Attiny441/FabFTDIBoard.png" width="800" height="427" alt=""/>
<p>&nbsp;&nbsp;</p>
<h3>2.2.3 Board Fabrication and Assembly</h3>
<ol>
  <li>Download the PNG files for trace and board outline from links below - FabFTDI traces (1000dpi) FabFTDI board outline (1000dpi) </li>
  <li>Use the standard PCB milling process to fabricate PCB. </li>
  <li>You will need following components: Attiny45, two 3.3V Zener diode, 0.1uF capacitor, two 49ohm resistors, two 470ohm resistors, 1K resistor, 499ohm resistor, 2x3 pin header and 1x6 pin header. </li>
  <li>Make sure to solder zerner diode in the right orientation. The anode (A) should be connected to GND and cathode (C) should be connected to D- or D+. </li>
  <li>If there is any access copper left in front of the middle two pads of USB footprint in the board, remove it using a knife and apply some solder to all the pads of USB lines as shown below-</li>
</ol>
<h3>2.2.4 Programing Fuses &amp; Firmware</h3>
<ol>
  <li>Download the firmware file from <a href="Firmware/default/cdctiny45.hex">here</a>. Flash it using the following command (replace avrisp2 with usbtiny if you are using fabisp)<br />
    <br />
    sudo avrdude -p t45 -c avrisp2 -P usb -U flash:w:cdctiny45.hex:i <br />
    <br />
  </li>
  <li>Flash fuses using following commands<br />
    <br />
    <ul>
      <li>sudo avrdude -p t45 -c avrisp2 -U lfuse:w:0xF1:m</li>
      <li>sudo avrdude -p t45 -c avrisp2 -U hfuse:w:0xCE:m</li>
      <li>sudo avrdude -p t45 -c avrisp2 -U euse:w:0xFF:m<br />
      </li>
    </ul>
  </li>
</ol>
<h2>2.3 FabFTDI Using ATTiny45 </h2>
<h3>2.3.1 Schematic Circuit Diagram</h3>
<img src="FabFTDIAttiny45/FabFTDISchematic.png" width="800" height="452" alt=""/>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The figure above shows the schematic diagram of the FabFTDI circuit. The circuit is powered by a USB port which can provide 5V voltage and up to 500mA current.</p>
<p> A USB port has four lines: 5V, D-, D+ and GND. The line D- and D+ are called data lines and  used to for communication. These data lines can tolerate only upto 3.3V voltage, and therefore, two Zener diodes are used to limit the voltage to 3.3V. The line D- is connected to 5V using 15k (10kohm + 499ohm) which is used by the host (your computer) to determine that the connected device is a low speed device. Resistors R5 and R6 are used to protect TxD and RxD pins.</p>
<p>&nbsp;</p>
<h3>2.3.2 Board Design </h3>
<img src="FabFTDIAttiny45/Board.PNG" width="800" height="378" alt=""/>
<p>&nbsp; </p>
<p>Use the above image as a guideline for solder components.</p>
<p>If you would like to edit original eagle files, here is the link for the <a href="FabFTDI.sch">schematic</a> and <a href="FabFTDI.brd">board</a> files.</p>
<p>&nbsp;</p>
<h3>2.3.4 PCB Fabrication and Assembly</h3>
<ol>
  <li>Download the PNG files for trace and board outline from links below -
    <ul>
      <li><a href="FabFTDITrace.png">FabFTDI traces (1000dpi)</a></li>
      <li><a href="FabFTDIBG.png">FabFTDI board outline (1000dpi)</a></li>
    </ul>
  </li>
  <li>Use the standard PCB milling process to fabricate PCB.</li>
  <li>You will  need following components: Attiny45, two 3.3V Zener diode, 0.1uF capacitor, two 49ohm resistors, two 470ohm resistors, 1K resistor, 499ohm resistor, 2x3 pin header and 1x6 pin header.</li>
  <li>Make sure to solder zerner diode in the right orientation. The anode (A) should be connected to GND and cathode (C) should be connected to D- or D+. <br />
    <br />
<br />
    <br />
  </li>
  <img src="FabFTDIAttiny45/IMG_0266.jpg" width="800" height="364" alt=""/>
  <li>If there is any access copper left in front of the middle two pads of  USB footprint in the board, remove it using a knife and apply some solder to all the pads of USB lines as shown below-<br />
    <br />
<br />
    <br />
  </li>
  <img src="FabFTDIAttiny45/IMG_0272.jpg" width="800" height="724" alt=""/>
</ol>
<h3>2.3.5 Programing Fuses &amp; Firmware</h3>
<ol>
  <li>Download the firmware file from <a href="Firmware/default/cdctiny45.hex">here</a>. Flash it using the following command (replace avrisp2 with usbtiny if you are using fabisp)<br />
     <br />
  sudo avrdude -p t45 -c avrisp2 -P usb -U flash:w:cdctiny45.hex:i    <br />
  <br />
  </li>
  <li>Flash fuses using following commands<br />
    <br />
<ul>
      <li>sudo avrdude -p t45 -c avrisp2 -U lfuse:w:0xF1:m</li>
      <li>sudo avrdude -p t45 -c avrisp2 -U hfuse:w:0xCE:m</li>
      <li>sudo avrdude -p t45 -c avrisp2 -U euse:w:0xFF:m<br />
      </li>
    </ul>
  </li>
</ol>
<p>Note that the current version of firmware does not support hardware flow control using RTS/CTS. If you would like to edit the firmware, here is the link to original <a href="Firmware.zip">files</a>.</p>
<p>&nbsp;</p>
<h1>3 Testing your FabFTDI</h1>
<ol>
  <li>Connect your FabFTDI to a computer. Mac/Unix operating system should be able to detect it without any driver. For Windows, download driver from <a href="http://www.recursion.jp/prose/avrcdc/avrcdc_inf.zip">here</a>.</li>
  <li>For testing FabFTDI, we will use Neil's <a href="http://academy.cba.mit.edu/classes/embedded_programming/index.html">hello.ftdi.44.echo</a> board. Since our cable support baud rate up to 4800, we need to specify this baud rate in hello.ftdi.44.echo.c file. Open this file and change bit_delay_time = 208.3, compile and flash it into hello.ftdi.44.echo board. </li>
  <li>Next step is same as what you did in <a href="http://academy.cba.mit.edu/classes/embedded_programming/hello.ftdi.44.program.png">Embedded programming week</a>. Connect FabFTDI to hello.ftdi.44.echo and execute command<br />
    <br />
  python term.py /dev/ttyACM0 4800</li>
</ol>
<p>if you can see the typed character in term.py window echo'ing back then you have a working FabFTDI. Congratulations!!</p>
<img src="FabFTDIAttiny45/IMG_0280.jpg" width="800" height="471" alt=""/>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h1>4 Troubleshooting</h1>
<p>If things don't workout, try following things</p>
<ol>
  <li>Double check the polarity of the two Zener diodes.</li>
  <li>Consider using other USB port on your computer. </li>
  <li>Check if the FabFTDI is connected in the right orientation. Match GND pin of FabFTDI to GND pin of hello.ftdi.44.echo board.</li>
  <li>Make sure FabFTDI is plugged-in properly and not loose.<br />
  </li>
</ol>
<p>&nbsp;</p>

<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.


</body>
</html>