What the goal is
|
| |
|
|
|
Inpired by the AVR Doper Projekt
project I also wanted to build such a device. But a smaller one, with
less features. Most other authors make their PCB layout first, and
then choose a case for it. So they end up with a (most of the time)
to large case.
|
|
Thats why I start with a case first. I use a case of vendor
PAC TEC, of type
PP-2AA.
|
| |
|
|
|
This case has a useful size and it looks also nifty. The battery box
inside bothers and must be cut out. But the cover of this battery
box is very useful: You can gain access to the devices inside without
disassembling everything everytime.
|
Schematic
|
|
Most of the schematics was predefined as I wanted to use the generic
firmeware for it. To make the firmware happy, many signals must be
connected to processor pins as expected by the firmware. Some small things I
changed anyway. First of all: I add some ESD protection. I also changed
the polarity of one signal and added an additional enable signal to
my signal drivers. And I choose a different signal assignment of the
ISP connector.
|
|
Schematic as Postscript
|
|
Nobody should omit ESD protection in his schematic. Others complains
about their broken devices, because they forgotten this protection.
|
ISP Connector
|
|
Warning: This project uses a different signal assignment for the ISP
connector. But its only important for the 10 pin type at target's side.
|
|
The 10 pin connector at the MiniDoper has the following signal assignment. A
triangle marks Pin 1 on this connector.
|
| |
|
|
Signal directions from MiniDoper's sight.
| Pin | Signal | Signal | Pin |
| 1 | MISO (in) | VTG (in/out) | 2 |
| 3 | SCK (out) | MOSI (out) | 4 |
| 5 | RST (out) | GND (pas) | 6 |
| 7 | 2nd SCK | TxD (out) | 8 |
| 9 | N.C. | RxD (in) | 10 |
N.C. Not Connected. Don't
use this pin for any active signal nor for any powersupply.
|
|
|
Find below the signal assignment of the ISP connector of the target
system to match the signals of the MiniDoper.
|
| |
|
|
Signal assignment on a 0.100" header connector at target's side.
Signal directions also from target's sight.
| Pin | Signal | Signal | Pin |
| 1 | MISO (out) | VTG (in/out) | 2 |
| 3 | SCK (in) | MOSI (in) | 4 |
| 5 | RST (in) | GND (pas) | 6 |
| 7 | N.C. | RxD (in) | 8 |
| 9 | N.C. | TxD (out) | 10 |
N.C. Not Connected. Don't
use this pin for any active signal nor for any powersupply.
|
|
|
I choose the different signal assignment to support two connector
types with one connector at MiniDoper's side. The regular ISP connector
is the 6 pin one. But I also wanted to use the nice feature of
embedding a UART interface in the USB data stream. So again a warning:
The 10 pin connector does not use the standard signal
assignment, the 6 pin connector does.
|
The best feature of this device is its USB interface. Many host systems
do not support a serial interface anymore and these ugly USB to serial
adapters no one likes to use (IMHO).
But on the other hand this device supports a serial line to the
target processor and its data flows through the USB (currently one
direction only, from target to host). And there is no need anymore
to place any level shifters or large connectors. Simply place the
10 pin connector and you are done.
|
|
The USB support in this device is achieved in software only. There is
no need for an additional USB interface device. Some resistors and
diodes do the electrical job, software does the rest.
|
Layout
|
The PCB uses two layers. The device count is low, so there was the
chance to create a PCB with one layer only. But why? Its more fun to
use two copper planes with real vias and you can create a better layout.
This job was done with the CAD program Eagle-V4.
Note: The files here are in Postscript format.
|
Device Positions Top Layer
Copper Plane Top Layer
Copper Plane Bottom Layer
Device Positions Bottom Layer
|
And as an Eagle binary file:
PCB as an EAGLE file
|
Bill Of Material
|
These devices are required
| Type |
Value |
Footprint |
Quantity |
Name(s) |
| TTL |
74HC126 |
SO14 |
1 |
IC2 |
| CAPACITOR |
100n |
C0805 |
6 |
C15 C16 C2 C3 C6 C7 |
| CAPACITOR |
10p |
C0805 |
7 |
C10 C11 C12 C13 C14 C8 C9 |
| CAPACITOR |
22p |
C0805 |
2 |
C4 C5 |
| CAPACITOR |
4u7 |
ELC-2.5 |
1 |
C1 |
| CRYSTAL |
12MHz |
HC49/S |
1 |
XT1 |
| DIL3_SWITCH |
DIL3 |
DIL06 |
1 |
SW1 |
| DIODE |
BAV99 |
SOT23 |
10 |
D10 D11 D12 D13 D14 D15 D5 D7 D8 D9 |
| DIODE |
Z3V6 |
DIODE1 |
2 |
D2 D3 |
| DIODE |
Z5V1 |
DIODE1 |
1 |
D16 |
| CONNECTOR |
Header 10 |
HEADER_2x5_2_54 |
1 |
X2 |
| LED |
RED |
SOT23 |
3 |
D1 D4 D6 |
| CPU |
ATmega8/DIL28 |
DIL28 |
1 |
IC1 |
| SOCKET |
Socket_DIL28 |
DIL28 |
1 |
X3 |
| FUSE |
125mA |
mini_fuse |
1 |
F1 |
| NPN_TRANSISTOR |
BC547 |
TO-92-CBE |
1 |
Q1 |
| RESISTOR |
10k |
R0805 |
5 |
R10 R5 R6 R7 R9 |
| RESISTOR |
150R |
R0805 |
3 |
R11 R17 R2 |
| RESISTOR |
1k |
R0805 |
4 |
R12 R13 R14 R8 |
| RESISTOR |
22k |
R0805 |
1 |
R16 |
| RESISTOR |
2k2 |
R0805 |
1 |
R1 |
| RESISTOR |
33k |
R0805 |
1 |
R15 |
| RESISTOR |
68R |
R0805 |
2 |
R3 R4 |
| BEAD |
BEAD |
LBEAD |
7 |
L1 L2 L3 L4 L5 L6 L7 |
| SINGLE_INLINE_2_54 |
SIL5 |
HEADER_1x5_2_54 |
1 |
X1 (optional) |
| CASE |
PP-2AA |
|
1 |
|
| CABLE |
USB |
|
1 |
Note: like the cable of a USB mouse |
| CABLE |
Ribbon Cable |
|
10cm |
Note: 10 wires, 0.05" grid |
| PCB |
EAGLE file |
|
1 |
|
|
Some ordering information:
- Case: PAC TEC, PP-2AA
(www.pactecenclosures.com)
Ordering: Conrad Electronic, No. 523150-62
(KUNSTSTOFFGEHAEUSE 94X63X28)
Note: I found this case on their German website only.
- PCB: BetaLayout
(www.pcb-pool.com)
Size: 55.1 x 82.54 x 1.6 mm / 3.85 x 2.24 x 1.1 in
|
Assembly
|
Maybe soldering this PCB could be a pain. It depends on the experience
of the worker, because its using SMT devices! But IMHO 0805, SO16 and
SOT23 should be possible to solder by everyone. If it fails - well -
this is the job of solderwick...
Note: Do not solder the processor! It needs a socket, so
solder its socket only. The processor must be programmed externaly.
|
| |
| Top Layer |
Bottom Layer |
|
|
|
| Bottom Layer |
Ready |
|
|
|
|
Case
|
|
As I mentioned earlier, the case contains a battery box.
While its cover is very convenient, the box itself must be cut out.
But not all of the box must be cut out. There are three small fittings
be part of this box. They must be retained to hold the PCB. The PCB
itself has no devices in the area of these fittings.
|
| |
|
|
Activating
|
|
Now the tricky part. This project creates an ISP. But its processor
needs an ISP to bring life in it. Its a chicken egg problem. I have
an old stk500 evaluation board here for this job. Thats why the
processor is not soldered. But step by step. First, we need the
firmware.
|
Development Environment and Toolchain
|
Now we must meet some preconditions to compile the firmware to make the
processor happy. We need some additional tools and - the main part - a working
cross toolchain.
To build a cross toolchain and also to build the firmware I'm using
PTXdist.
How to install it is described here
PTXdist will build the toolchain first, and after that, it also builds
the firmware with this fresh toolchain.
|
MiniDoper Firmware
|
The firmare for the MiniDoper is also a PTXdist project. You can download it from
here. Extract it, setup the toolchain to
be used and now the build is - thanks to PTXdist - very simple:
~$ tar xf avr-mini-doper-1.1.0.tar.gz
~$ cd avr-mini-doper-1.1.0
~/avr-mini-doper-1.1.0$ ptxdist toolchain /opt/OSELAS.Toolchain-1.99.2/avr/gcc-4.3.2-libc-1.6.2-binutils-2.19/bin
~/avr-mini-doper-1.1.0$ ptxdist go
|
Maybe your path to the toolchain must be modified. For example when you are using another
revision or you installed it to a different location than the default /opt.
|
By the way: This project also builds the avrdude command line tool, to flash
the processor. When the whole project is built, you can find:
- avrdude: in sysroot-host/bin/avrdude
- firmware: in images/main.hex
|
Programming the firmware. First we must program Atmega8's Fuses:
~/avr-mini-doper-1.1.0$ sysroot-host/bin/avrdude -p atmega8 -c stk500v1 -U hfuse:w:0xc9:m -U lfuse:w:0x9f:m |
After that the firmware itself:
~/avr-mini-doper-1.1.0$ sysroot-host/bin/avrdude -p atmega8 -c stk500v1 -U flash:w:/images/main.hex:i |
|
As you can see, I used my old Atmel stk500 evaluation board
(Option -c stk500v1). Its my chicken, which creates my new
USB based ISP as its egg. This option must be changed if a different programmer
is in use.
Note: The local avrdude will be built without support for
LPT ISPs. If your programmer is LPT based, you must enable this feature first.
|
If your project is already built, you can enable the LPT support with these
steps:
~/avr-mini-doper-1.1.0$ ptxdist menuconfig |
Enable the menu entry Activate LPT support. Leave the menu
with saving the new options.
|
With these new options, the avrdude must be rebuilt.
~/avr-mini-doper-1.1.0$ ptxdist clean host-avrdude
~/avr-mini-doper-1.1.0$ ptxdist go
|
Now the local sysroot-host/bin/avrdude supports LPT programmers.
|
Near to completion
|
|
Thats it. After flashing and inserting the processor, you can solder the USB cable.
A "Knot" should be made into the cable inside the case as some kind of pull relief.
A small hole, one half in the to top case, the other in the bottom case makes it
easy to fit the cable. There are also three yet missed holes in the top case for
the status LED and a front panel.
|
|
For the front panel I have made a template,
as shown in the first picture on top of this page. Its an OpenOffice
file. It was not easy to fit the LEDs. I didn't understand case's
drawing.
|
|
You can modify the template as you like. Only the position of the
LEDs you should keep. I printed the template on some kind of photo
paper to get a perfect look. With a ticket-punch you can make the LED
holes. To inhibit any blur, use an adhesive film at its top. I used
also a two side adhesive film to stick the front panel onto the
top case.
|
Host System
|
|
Maybe you must also prepare the host where you want to run your
shiny new MiniDoper. At first USB support must be present and enabled.
I can speak for Linux only. But the MiniDoper should also run on
Windows, but I cannot test it. Back to the Linux kernel: Beside the
USB support, the HID support must be present. This is a precondition
to let your host detect the MiniDoper.
|
When the MiniDoper will be connected to the host system, the
command dmesg should show something like this:
usb 4-2: new low speed USB device using uhci_hcd and address 5
usb 4-2: configuration #1 chosen from 1 choice
drivers/usb/input/hid-core.c: ctrl urb status -75 received
hiddev96: USB HID v1.01 Device [obdev.at AVR-Doper] on usb-0000:00:1d.3-2
|
|
|
I have no clue, what the reason for this strange -75 message is.
The device works anyway.
|
The command lsusb gives me the following output
on my system, when the MiniDoper is connected:
Bus 004 Device 005: ID 16c0:05df
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.01
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x16c0
idProduct 0x05df
bcdDevice 1.00
iManufacturer 1 obdev.at
iProduct 2 AVR-Doper
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 200mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 60
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)
|
|
|
Now its possible to gain access to this device via libusb. To
do so, you need root permissions. Don't know why yet.
|
Using The MiniDoper
|
The MiniDoper's firmware is compatible with the stk500v2. Thats why, when
using the MiniDoper, you should give stk500v2 as
the programmer's ID. To let avrdude not use the default
serial interface you must overwrite the interface with
avrdoper. The first options should always look like that:
~$ avrdude -c stk500v2 -P avrdoper ....
|
The three dots are for the other parametes you may need to do the
job you want the MiniDoper to do.
|
Using the MiniDoper for debugging
|
The MiniDoper - like the original ARV-Doper - contains a serial interface to the target processor.
Now its not a big deal to get the debug output from the target AVR onto the host computer. Only
one connector on the target system is required and no more need to change the flashing and the
debugging tool anymore. With the original archive from the obdev website for the AVR-Doper comes a
small tool to read the data from the serial interface via the AVR-Doper. Due to my needs for cross
compiling I rewrote the tool and added autotools support for building the package. The sources
can be downloaded here.
Build it now like every other autotoolized package:
~$ tar xf doperterm-0.99.6.tar.gz
~$ cd doperterm-0.99.6
~/doperterm-0.99.6$ ./configure
~/doperterm-0.99.6$ make
~/doperterm-0.99.6$ make install
|
|
Trouble?
|
|
If you have some trouble when building this project, you can contact
me at:
projects at kreuzholzen dot de
|
Related things
|
Here the same approach and the result in a different case:
http://www.ulrichradig.de/home/index.php/avr/usb-avr-prog
|