Nav:  [home][elec][pdev][usb-atmelprg] > [levelcv]
 
Go:  [index] [circuit] [firmware] [software] [levelcv] [openocd]

USB-AtmelPrg: External 3.3V Level Converter

Overview

In order to programm devices which run at 3.3V (either SPI-based ones like AVRs or JTAG-based ones like CPLDs), the input and output signal levels need appropriate level conversion (or level shifting) because a 5V input may not see HIGH at 3.3V and a 3.3V device may be damaged by a 5V signal.

Features:

  • Support for SPI-based devices (AVRs) as well as JTAG-based ones (e.g. CPLDs).
  • Two 9-pin Sub-D connectors (male and female) allow easy integration into the USB-AtmelPrg cable without changing the existing hardware.
  • On-board 3.3V low-drop regulator makes 3.3V from 5V available from USB-AtmelPrg (e.g. via USB port).
  • Converts 5V to 3.3V for the 3 output signals.
  • Converts 3.3V to 5V for the input signal.
  • Can provide 3.3V to supply device to be programmed via a separate Sub-D pin.
  • Line D8 with separate mosfet to serve as inverted open-drain reset pin (used e.g. by OpenOCD).
  • Unused ("debug") lines D6, D7 on the Sub-D port are directly connected (no level processing), so open-drain reset line used by OpenOCD still works.

Bugs:

  • No tristate outputs: If in your design, the programming lines are multiplexed with other interface logic, then you need to disconnect the plug after programming.

Circuit

Download 3.3V level converter circuit schematic:
PNG image (799x579 as seen below): level-converter.png (20kb)
High-quality PDF: level-converter.pdf (95kb)
Permission to copy and use this schematic is hereby granted provided credit is given where it is due.

3.3V level converter circuit schematic [20kb]

Level Conversion

The main trick of the level conversion engine is to use the correct logic family for the applied '04 inverters:

  • In order to convert 5V to 3.3V, I use a 74VHC04 (or alternatively a 74VHC14) which has 5V-tolerant inputs when powered at 3.3V to get the appropriate 3.3V output levels.
  • For 3.3V to 5V level shifting, a 5V-powered 74HCT04 (or alternatively a 74VHCT04) will do the trick since the 'T' variants have lowered thresholds for TTL compatibility. (It turned out experimentally that a 74HCT14 Schmitt trigger works as well but looking at the input levels in the data sheet, I must discourage its application.)

Power Supply

The level converter requires a 5V supply voltage but no 3.3V supply since it generates the 3.3V itself from 5V using the LM2937 LDO regulator. Using the two switches on the board, all important power configuration options can be realised:

3V3_5V_SEL
Primary output logic level selector. This switch allows to select the secondary logic level voltage. For normal 5V to 3.3V level shifting, select the 3.3V from the LDO (lower position). When choosing the 5V line (upper position), level shifting will switched off since both input and output logic levels are then 5V. This switch should have 2 positions.
SUP_SWITCH
Selects the power supply options for the device to be programmed. This switch should have 3 positions: In the upper position, the external device to be programmed will be supplied with 5V, in the lower position it will be supplied with output logic level voltage (as chosen by 3V3_5V_SEL) and in the middle position, the external device is not supplied and has to run self-powered. Hence, you always enable the S2 switch on the USB-AtmelPrg circuit to get the level shifter powered (check the green LED MAIN_PWR as power indicator).
Then, from the point of view of the device to be programmed, the SUP_SWITCH acts like the S2 switch on the USB-AtmelPrg with the additional feature that it can provide 5V or 3.3V via pin 9. Check the red SUP_PWR LED to see if the device to be programmed has its own power supply before switching on the SUP_SWITCH.

The on-board 3.3V low-drop regulator can supply a current of up to 500mA at 3.3V when cooled appropriately.

Sub-D Interfaces

Apart from converting levels (and thereby assigning a fixed signal direction), the meaning of the 9 pins of the Sub-D connectors stays unchanged.

Here's the list for convenience; "out" means "out into device to be programmed" and "in" means "from device to be programmed to the host computer":

PinSPI (AVR)JTAGDir
1SCKTCKout
2MISOTDOin
3MOSITDIout
4RESETTMSout
5GNDGND(0V)
6(D6)(D6)(in/out)
7(D7)(D7)(in/out)
8(D8)(reset)(inverted open-drain output)
9VCCVCC(in: 5V; out: 5V/3.3V)

Level Converter Board

Level converter board [11kb]
[click to enlarge: 129kb JPG]

Top view of the level converter board: The USB-AtmelPrg must be plugged into the left (female) Sub-D connector (via a 1:1 expansion cable) and the SPI/JTAG port to the device to be programmed is available at the male connector on the right.

This is an old photo; the third switch is no longer present in the current version but instead replaced by the BS170 MOSFET (the circuit diagram above is up-to-date). The 3 switches are 3V3_5V_SEL, SUP_SWITCH and an additional one which is no longer in use (formerly reset switch). As a rule of thumb: The upper states of the used two switches refer to the 5V selection while the lower ones are for 3.3V. The corresponding LEDs are above the switches; the green LED is MAIN_PWR. The red LED on the right displays the D8 state which is used as microcontroller reset pin by OpenOCD (since the SPI reset pin is TMS in the JTAG interface).

This board is not meant to be put into a box but rather to stand on the ground on its own 4 "feet" (screws). The screw in the center holds the LM2937 which is mounted on the back on a ground plane for cooling.


[home] [site map] [Impressum] [Datenschutz/privacy policy]
Valid HTML 4.01!
Copyright © 2006-2007 by Wolfgang Wieser
Last modified: 2007-07-20 17:16:31