DIY编程器网

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 5367|回复: 4
打印 上一主题 下一主题

IsoJtagISP AVR Programmer

[复制链接]
跳转到指定楼层
楼主
发表于 2011-10-29 13:25:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
IsoJtagISP AVR Programmer

*Update 24/04/07:
Updates to the firmware again, I found a major issue with the crystal changing code, the header that automatically calculated to usart speeds wasn't working right, the compiler didn't round off the maths as I expected it to. Fixed by calculating the the speeds in excel and copy into the header for each crystal speed needed.
Large update to the ISP code, now Block Mode rogramming is supported for high speed programming. Thanks to www.mikrocontroller-projekte.de for the AVR910 compatible code with the support, I've ported the latest version to the isojtagisp by changing the code to compile in gcc rather than avr studio, changing all the memory and port locations to suit the atmega16 and adding the hooks into the isojtagisp bootloader.
*Update 21/11/06:
Improvements to V2.0 layout, there is no longer any need for a crystal at all. Clock is provided by the USB chip at a stable 12MHz.
Improvements to the clock speed modifications in the code, allows for port speed to be changed in AVR Studio and reduces loss of synchronization errors.
* Update 15/08/06 :
New PCB layout 1.5 with full jtag programming header for programming on-board micro, extra target power led. New smaller double sided layout 2.0 with same new features. Hardware & firmware compatible with original IsoJtag still.
New firmware 1.5 with support for different crystal frequencies - patches atmel jtag firmware as it's loaded. Now flashes activity led while waiting at boot for new jtag firmware. Reports ATmega16 to AVRProg when updating JTAG to remove confusion. Still completely back compatible with original IsoJtag and previous version of IsoJtagISP.
-----------------------------------------------------------------------------------------------------------------------------------
The IsoJtagISP is an optically isolated usb programmer for Atmel AVR's that combines a JTAG programmer/debugger and an ISP programmer. In JTAG mode it is fully compatible with Atmel's 'JTAG ICE', and can be used any way the AVR product can, including programming and debugging with AVR Studio.In ISP mode it is compatible with the AVR910 Application note, and can be used from AVR Studio via the AVR Prog program to program devices compatible with ISP programming.
I'd also like to recommend AvrOspII for programming in ISP mode, it's much more user friendly and has better device support than AVR Prog.
It has the benefits of usb connection (great for laptops without serial ports) and is completely isolated from the target micro. This protects your valuable computer from mis-wiring of the target board, with my previous programmer I blew up a serial port on old laptop, a usb port on new laptop and 2 usb-serial cables, before designing my original IsoJTAG programmer. The IsoJtagISP is electrically identical to the IsoJTAG, the pcb layout has simply been optimized. The ISP programmer has been implemented completely in firmware. The firmware consists of a bootloader to load the atmel JTAG firmware from AVR Studio, and the ISP firmware, which is based on the AVR910 application note programmer, which I ported to the JTAG hardware and the ATmega16. The bootloader effectively dual-boots between the JTAG and ISP software. The Bootloader header from the IsoJTAG is now used to select between JTAG and ISP modes. When in JTAG mode the programmer is receptive to JTAG firmware upgrade for the first few seconds of power while the activity led if flashing. Run AVRPROG is this time to upgrade. When in ISP mode run AVRPROG at any time to program the target micro. Schematic Click for full sized image.

Bill of Materials
DescriptionDesignatorQuantityValue
Capacitor Ceramic
C1, C2
2
15pF
Capacitor Electrolytic
C7
1
100uF
Capacitor
C8, C9, C10, C11
4
100nF
Typical INFRARED GaAs LED
D1
1
LED 3mm red
Typical INFRARED GaAs LED
D2, D3
2
LED 3mm green
Header, 3-Pin
J    I
1
3 pin header
Header, 5-Pin, Dual row, Right Angle
JP1
1
IDC Header 10pin
Header, 5-Pin, Dual row
JPJTAG
1
5x2 headers
SMD Resistor
R1, R2
2
1k 0603
Resistor
R3
1
1k
SMD Resistor
R4, R5, R6
3
10k 0603
Resistor
R7, R9, R11, R14
4
470R
SMD Resistor
R8, R10, R12, R13
4
470R 0603
Atmel AVR ATmega16/32
U1
1
ATmega16
USB-Serial
U2
1
FT232R
Optoisolator
U3, U4, U5, U6
4
6N137S
Header, 6-Pin
USB Jack
1
USB B Socket
Crystal
Y1
1
7.3728MHz or scrap box value similar. (set in firmware)
For IsoJtagISP 1.5 (single sided layout) the parts listed as SMD (0603) are replaced by normal through hole versions.
PCB
IsoJtagISP 1.5: IsoJtagISP 2.1: Top Layer (viewed from top)

Bottom Layer (viewed from bottom)


Keep in mind that the pcb here has a very fine pitch, the usb chip in particular has pads with only 0.25mm between them. If you don't have a method of making a board (other then asking a professional board house to do it - expensive) consider getting our eBook, which details how we make the boards here.
IsoJtagISP 1.5 IsoJtagISP 2.1
pdf layouts at correct size 1:1 Bottom Layer (tracks)
Top Overlay gerber and excellon2 drill: IsoJtagISP_gerb_ex.zip
pdf layouts at correct size 1:1 Track Artwork
Overlays gerber and excellon2 drill: IsoJtagISP_gerb_ex.zip

Firmware
The firmware is written in AVR studio with WinAVR installed. The bootloader is written in C, the ISP firmware is written in gcc assembler. Don't worry about the hex files below being a older version than the source, the only change in the source was making the crystal frequency easier to set, there's no change in the resulting program.
IsoJtagISP_2.5.hex for 7.3728MHz Crystal (V2.1 firmware is identical to V1.5 for 7.3728MHz crystal)
IsoJtagISP_2.5.hex for 8.0MHz Crystal (use on any hardware before V2.1)
IsoJtagISP_2.5.hex for no crystal (USB chip clocked for V2.1 hardware)
FTDI Mprog and template to set up ftdi serial chip for the project.
IsoJtagISP_1.51_source.zip
IsoJtagISP_2.5_source.zip
If you want to rebuild it for a different frequency crystal (only tested at above frequencies) open the project file in AVR Studio, look in crystal.h. If your frequency is already listed as a define at the top of the file, uncomment out your speed and comment all the other freq defines. If your speed isn't there then add a new define line for your speed, and open up crystal_calc.xls from the source folder (excel spreadsheet, I use openoffice). Change your speed in there, and copy the block in the spreadsheet down the bottom of crystal.h. You should now be able to recompile the project. The patching code is only enabled when the value is set to something other than 7372800, which is the original default setting. The only problem I've found when running at a different cystal is that a serial port speed of 115200 often doens't work (depending on particular frequency). In normal operation this isn't an issue, I've never found a need to change the port speed at all from the default (19200) except for a bug in avr studio, that can result in synchronization errors. I'll discuss this in detail later.
Building
Many of the parts for this programmer can be sourced at your local electronics shop (my primary being jaycar in australia). The difficult items are likely to be the 7.3ish crystal, the usb chip and the micro.
Any of the ATmega16's in the tqfp44 package will work here. If you want to buy a few micro's (I use the atmega16's extensively, they're a good chip) the best supplier I've found is Avnet. Give them a ring, they sell the 'ATmega16-16ac' for about AUD$4.50 +gst&postage and will usually sell me about 10 quite happily. It's a heck of a lot better than giving RS components about AUD$20 per chip. Otherwise they can be bought quite reasonably from DigiKey in the US.
The usb chip FT232R (ssop 28 package) can be bought from Dontronics in Australia or Mouser in the US. You could also get the micro from Dontronics but they're expensive.
The 6N137S Opto-Isolators can be replaced with 6N137 version (non-surface mount) if you can't find the 'S' ones. Both parts are the same size and shape, except that the non-surface mount one has straight pins to go through a pcb, but a quick bend with pliers and trim to size will make them work perfectly well. If you find another opto in the same package that is sold as a high speed opto, you can check the datasheets for both and compare, there are probably plenty of other devices that can work. Feel free to email me with a part number and I'll let you know if I think it'll work. Note that basic optos generally don't work because they are too slow. The chip layout & orientation can be verified against this or the images above:
IsoJtagISP 1.5 Assembly.pdf
IsoJtagISP 2.0 Assembly.pdf
The biggest barrier to building this programmer is programming the onboard micro. I originally designed it for myself, and as I was already using a jtag programmer I used that to program the micro for this. The 10 pin header in the middle of the board is for this purpose. If you already have a serial or parallel ISP style programmer it can be used to program the micro, but it's up to you to tack wires onto the pcb to do so. The pins required are the reset line and some of the lines going to the opto's. I assume that if you have one of these programmers you also know which pins to conenct it to. As mentioned earlier the board is designed to use my IsoJtagISP firmware. Once the bootloader has been programmed the fuses need to be set appropriately. Check with your programming software to find out how to do this. If you are building V2.1 and above, without a crystal, the important fuses are "external clock", "boot-reset", "boot-size 1024 words"
In Avr Studio it looks like this (for no crystal):

If you are using a crystal then they are "external high freq. crystal", "boot-reset", "boot-size 1024 words". If you're using ponyprog the fuses should look like this (for crystal):
If you don't have any means of programming the micro drop me an email at andrew@floppyspongeonline.com and I should be able to send you a programmed micro for the cost of the micro and postage.
Drivers:
Once the board's finished and the micro's programmed , the next step is to get the drivers installed. Use a jumper (like used on pc motherboards) to set the "J    I" jumper to J (for JTAG). Plug the programmer into your pc with the usb lead. The power led should come on. You will need the VCP driver for the ftdi usb chip available here. I've had reports from one user that his Windows 2000 computer occasionally has a 'blue screen' error when the programmer is plugged in while booting. I haven't been able to reproduce this problem myself, but if you have issues simply make sure the programmer isn't plugged into your computer while it is booting, or contact FTDI for assistance as the driver is their software.
FT232R Settings:
If you're building without a crystal you will need to program the ft232r chip to send out the clock for the micro. Luckily this is easy, as FTDI provide a program to do this over the serial port. So plug in the programmer, download MProg from the sources section above, run the program, then find read and parse in the menus to check that it finds the programmer. As long as it does, open up the template that's in the mprog folder, and you should be able to go to program in the menus to flash the settings into the ft232r chip. It should now be ready to go, so unplug and replug the programmer, windows will re-detect it as an isojtagisp.
Port Settings :
Once the driver's loaded you have to make sure it is running a low enough com port that AVR Prog can detect it. For this it needs to be between COM1 and COM4. To do this go to device manager by clicking on start menu, go to run, and type (or copy&paste) devmgmt.msc . With the programmers usb plugged in go to "Ports (COM & LPT)" and there should be a "USB Serial Port" in the menu (hopefully only one of them, if there is more try re-plugging the programmer a couple of times to identify which one is it). If the com port in brackets after the name isn't either COM1, 2, 3 or 4 right click on it and go to properties. Go to the "port settings" tab and click the "Advanced" button. The first item in this dialog lets you change the port that the virtual com port is using. Hopefully you don't have too many other real or virtual com ports in use, if any of 1-4 are free select them, or select one that says it is "in use" if there isn't an item in the ports menu of device manager currently running on that number. Once that is done unplug the programmers' usb and re-plug it in. If you're using windows older than xp or have problems later you may need to reboot your computer as well. Once that's done start up AVR Studio. Cancel out of any project wizard or anything else that comes up when it starts.
JTAG ICE Firmware:
Unplug the programmer, and then re-plug it in and go to 'tools' menu, 'AVR Prog...', while the activity led of the programmer is flashing. With no JTAG firmware on the programmer it will stay in this state indefinitely, but once the firmware is loaded you only get a few seconds at power-on if you need to update in the future. You should now get the AVR Prog programming dialog come up. If it gives an error 'no supported board can be found' you've got a problem. Try unplugging and re-plugging the programmer and/or unplug any other usb serial devices if you have them and try again. If still no-go, check the com port it is running on again, and check the programmer pcb carefully for faults and try reprogramming the bootloader and the fuses again. Once you've got the programming dialog up, program the micro it with Upgrade.ebn which can be found in C:\Program Files\Atmel\AVR Tools\JTAGICE (with a standard AVR Studio installation). Hit program and wait for it to finish. This will take some time, 5 to 10 minutes. It should finish without an error and then hit exit. Occasionalyl for me I get a box pop up saying "flushing" in between programming and verifying, it can be ignored so hit ok. If it comes up with an error it's not the end of the world. Try programming again and get in touch with me if it error's again. You've now got a fully operational jtag programmer for working with avr micro's. For further information on how to use it I suggest looking for documentation on the 'AVR JTAG ICE' on atmel's website and on avrfreaks. In JTAG mode you can program and debug any of atmel's micro's that have onboard jtag programming. Remember the power-on boot wait in jtag mode, when it's first plugged in to usb you have to wait for the activity led to stop flashing before the jtag is ready to use.
The Synchronization Problem:
There is an annoying quirk when running the programmer on non-standard frequencies that can't handle the top serial speed, 115200Kb/s, such as 8Mhz and 12MHz. For some reason in AVR Studio, when you run the jtag ice programming util (to set fuses, lock bits, etc.) if the page it first comes up with is fuses, lockbits or board, avr studio momentarily changes the port speed to 115200 and the programmer drops out, leaving you with a synchronization error. If it starts up on the program, advanced or auto page it's fine though, and stays at the selected speed (default 19200). So if you get a synch error, simply select one of the ok pages (program, advanced or auto), close te jtag ice window, and start it again. Then it works fine. As long as you get into a habit of just leaving the jtag ice screen on one of the ok pages it's never an issue. I've sent an email to Atmel to try to get this issue sorted out, as there is no good reason for their software to change the port speed like that. When you make your circuit with a micro on it (the target micro) add a 10 pin IDC style header to the circuit and wire it to the target micro's pins as labelled in the pinouts below (ie. pin 1 of the prog header goes to the TCK pin of the target micro, which is pin 21 on a mega16).
JTAG Programming header pinout (looking from above):


1: TCK 2: GND
3: TDO 4: VCC
5: TMS 6:
7: VCC 8:
9: TDI 10: GND
One of each of the VCC and GND pins can be left unconnected, as long as you have one of each powered. This can simplify pcb layout significantly in some cases. To use ISP mode set the J | I header to I and re-plug the programmer. Go to AVR Prog from AVR Studio, Tools menu.
ISP Programming header pinout (Note this is NOT a standard pinout used by atmel):

1: SCK 2: GND
3: MISO 4: VCC
5: RESET 6:
7: VCC 8:
9: MOSI 10: GND
In ISP mode you should be able to program:
AVRProg (as of 4.12 sp2) AvrOspII (as of 0.360)


  • AT90S1200
  • AT90S2313
  • AT90S4414
  • AT90S4433
  • AT90S2333
  • AT90S8515
  • ATmega8515
  • ATmega8515 BOOT
  • ATmega103
  • ATmega603
  • ATmega128
  • ATmega128 BOOT
  • ATmega64
  • ATmega64 BOOT
  • AT90S2323
  • AT90S2343
  • ATtiny12
  • ATtiny15
  • ATtiny19
  • ATtiny28
  • ATtiny26
  • ATmega161
  • ATmega161 BOOT
  • ATmega163
  • ATmega83
  • ATmega163 BOOT
  • ATmega83 BOOT
  • AT90S8535
  • ATmega8535
  • ATmega8535 BOOT
  • AT90S4434
  • AT90C8534
  • AT90C8544
  • ATmega32
  • ATmega32 BOOT
  • ATmega16
  • ATmega16 BOOT
  • ATmega8
  • ATmega8 BOOT
  • ATmega169
  • ATmega169 BOOT


  • AT86RF401
  • AT89S51
  • AT89S52
  • AT90CAN128
  • AT90CAN32
  • AT90CAN64
  • AT90PWM2
  • AT90PWM3
  • AT90S1200
  • AT90S2313
  • AT90S2323
  • AT90S2343
  • AT90S4414
  • AT90S4433
  • AT90S4434
  • AT90S8515
  • AT90S8515comp
  • AT90S8535
  • AT90S8535comp
  • ATmega103
  • ATmega103comp
  • ATmega128
  • ATmega1280
  • ATmega1281
  • ATmega16
  • ATmega161
  • ATmega161comp
  • ATmega162
  • ATmega163
  • ATmega165
  • ATmega168
  • ATmega169
  • ATmega2560
  • ATmega2561
  • ATmega32
  • ATmega323
  • ATmega325
  • ATmega3250
  • ATmega329
  • ATmega3290
  • ATmega406
  • ATmega48
  • ATmega64
  • ATmega640
  • ATmega644
  • ATmega645
  • ATmega6450
  • ATmega649
  • ATmega6490
  • ATmega8
  • ATmega8515
  • ATmega8535
  • ATmega88
  • ATtiny11
  • ATtiny12
  • ATtiny13
  • ATtiny15
  • ATtiny22
  • ATtiny2313
  • ATtiny24
  • ATtiny25
  • ATtiny26
  • ATtiny261
  • ATtiny28
  • ATtiny44
  • ATtiny45
  • ATtiny461
  • ATtiny84
  • ATtiny85
  • ATtiny861

Purchasing IsoJtagISP
While all the plans are here and you're more than welcome to make as many as you like for personal use, some people don't have the resources to build this and as such I offer them for sale. I just want to be clear that this is a personal project and as such Floppy Sponge Automation is not responsible for any information or products offered regarding the programmer. These plans can not be used for commercial purposes (including but not limited to selling units you've built) without my express permission. Just to clear things up, you are more than welome to build and purchase these and then use them to develop products for sale, but you can't sell the actual programmers, or any part of the programmer design/firmware. At this stage other commitments mean I don't really have much time to put towards building these, but I'm more than happy to assist in other's efforts. Contact me for further information. Andrew Leech


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享分享 支持支持 反对反对
沙发
发表于 2011-10-29 19:01:26 | 只看该作者
真是好东西!有空研究一下!
板凳
 楼主| 发表于 2011-10-29 19:23:35 | 只看该作者
还提供原代码呢
地板
 楼主| 发表于 2012-5-18 16:47:09 | 只看该作者
原网站的内容不能访问了,这个是其他网站上的相关资料打包
ISO JTAG ISP programmer.rar (1.58 MB, 下载次数: 8)
5#
发表于 2020-8-25 19:40:39 | 只看该作者
好东西!谢谢共享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|文字版|手机版|DIY编程器网 ( 桂ICP备14005565号-1 )

GMT+8, 2024-12-27 15:27 , 耗时 0.098545 秒, 21 个查询请求 , Gzip 开启.

各位嘉宾言论仅代表个人观点,非属DIY编程器网立场。

桂公网安备 45031202000115号

DIY编程器群(超员):41210778 DIY编程器

DIY编程器群1(满员):3044634 DIY编程器1

diy编程器群2:551025008 diy编程器群2

QQ:28000622;Email:libyoufer@sina.com

本站由桂林市临桂区技兴电子商务经营部独家赞助。旨在技术交流,请自觉遵守国家法律法规,一旦发现将做封号删号处理。

快速回复 返回顶部 返回列表