понедельник, 19 декабря 2011 г.

usbasp собственная сборка

Собрал свой клон usbasp(http://www.fischl.de/usbasp/). Схематически является полным аналогом этого программатора, а вот внешний вид достаточно оригинален. Основа для платы всё тоже что использовалось для сборки платы под eeprom.
Сначала хотел собрать это творение на attiny но в виду того что цена в нашем магазине электроники на них примерно одинаковая то решил что раз в наличие atmega8 то на ней и буду собирать.
 


Программатор полностью собран и проверен. Прошивку контроллера делал с помощью 5проводков и параллельного порта
shiz@jane ~/avr-dev/usbasp.2011-05-28/bin/firmware $ make
avrdude -c stk200 -p atmega8 -F -B 200 -U hfuse:w:0xC9:m -U lfuse:w:0xEF:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9307
avrdude: reading input file "0xC9"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xC9:
avrdude: load data hfuse data from input file 0xC9:
avrdude: input file 0xC9 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xEF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xEF:
avrdude: load data lfuse data from input file 0xEF:
avrdude: input file 0xEF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

avrdude -c stk200 -p atmega8 -F -B 1 -U flash:w:usbasp.atmega8.2011-05-28.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "usbasp.atmega8.2011-05-28.hex"
avrdude: input file usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: writing flash (4700 bytes):

Writing | ################################################## | 100% 1.33s

avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against usbasp.atmega8.2011-05-28.hex:
avrdude: load data flash data from input file usbasp.atmega8.2011-05-28.hex:
avrdude: input file usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: input file usbasp.atmega8.2011-05-28.hex contains 4700 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.97s

avrdude: verifying ...
avrdude: 4700 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


 По окончании прошивки программатор свободно работает в windows и linux.

Для проверки подключил и отключил девайс.






Ниже дан консольшот нового девайса.
Dec 19 14:06:56 jane kernel: [ 9611.616022] hub 1-0:1.0: hub_resume
Dec 19 14:06:56 jane kernel: [ 9611.616067] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0000
Dec 19 14:06:56 jane kernel: [ 9611.647039] hub 3-0:1.0: state 7 ports 2 chg 0004 evt 0000
Dec 19 14:06:56 jane kernel: [ 9611.647055] hub 3-0:1.0: port 2, status 0301, change 0000, 1.5 Mb/s
Dec 19 14:06:56 jane kernel: [ 9611.749023] usb 3-2: new low speed USB device number 35 using uhci_hcd
Dec 19 14:06:56 jane kernel: [ 9611.894980] usb 3-2: default language 0x0409
Dec 19 14:06:56 jane kernel: [ 9611.908979] usb 3-2: udev 35, busnum 3, minor = 290
Dec 19 14:06:56 jane kernel: [ 9611.908985] usb 3-2: New USB device found, idVendor=16c0, idProduct=05dc
Dec 19 14:06:56 jane kernel: [ 9611.908989] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Dec 19 14:06:56 jane kernel: [ 9611.908993] usb 3-2: Product: USBasp
Dec 19 14:06:56 jane kernel: [ 9611.908996] usb 3-2: Manufacturer: www.fischl.de
Dec 19 14:06:56 jane kernel: [ 9611.909930] usb 3-2: usb_probe_device
Dec 19 14:06:56 jane kernel: [ 9611.909938] usb 3-2: configuration #1 chosen from 1 choice
Dec 19 14:06:56 jane kernel: [ 9611.912081] usb 3-2: adding 3-2:1.0 (config #1, interface 0)
Dec 19 14:06:56 jane kernel: [ 9611.912175] usbserial_generic 3-2:1.0: usb_probe_interface
Dec 19 14:06:56 jane kernel: [ 9611.912181] usbserial_generic 3-2:1.0: usb_probe_interface - got id
Dec 19 14:06:58 jane kernel: [ 9614.008024] hub 1-0:1.0: hub_suspend
Dec 19 14:06:58 jane kernel: [ 9614.008037] usb usb1: bus auto-suspend
Dec 19 14:06:58 jane kernel: [ 9614.008041] ehci_hcd 0000:00:1d.7: suspend root hub
Dec 19 14:07:08 jane kernel: [ 9624.250042] hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0004
Dec 19 14:07:08 jane kernel: [ 9624.250058] uhci_hcd 0000:00:1d.1: port 2 portsc 008a,00
Dec 19 14:07:08 jane kernel: [ 9624.250071] hub 3-0:1.0: port 2, status 0100, change 0003, 12 Mb/s
Dec 19 14:07:08 jane kernel: [ 9624.250077] usb 3-2: USB disconnect, device number 35
Dec 19 14:07:08 jane kernel: [ 9624.250081] usb 3-2: unregistering device
Dec 19 14:07:08 jane kernel: [ 9624.250084] usb 3-2: unregistering interface 3-2:1.0
Dec 19 14:07:08 jane kernel: [ 9624.250146] usb 3-2: usb_disable_device nuking all URBs
Dec 19 14:07:09 jane kernel: [ 9624.354021] hub 3-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x100
Dec 19 14:07:10 jane kernel: [ 9625.500024] usb usb3: suspend_rh (auto-stop)
Dec 19 14:07:11 jane kernel: [ 9627.008026] hub 3-0:1.0: hub_suspend
Dec 19 14:07:11 jane kernel: [ 9627.008038] usb usb3: bus auto-suspend
Dec 19 14:07:11 jane kernel: [ 9627.008042] usb usb3: suspend_rh
Полный вид собранного девайса с проводами для подключения к программируемым устройствам.










написал простейшую программу для atmega8535 и прошил её новособранным программатором

jane firmware # avrdude -c usbasp -p atmega8535 -e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9308
avrdude: erasing chip

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

jane firmware # avrdude -c usbasp -p atmega8535 -U flash:w:test-atmega8535.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9308
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "test-atmega8535.hex"
avrdude: input file test-atmega8535.hex auto detected as Intel Hex
avrdude: writing flash (96 bytes):

Writing | ################################################## | 100% 0.47s



avrdude: 96 bytes of flash written
avrdude: verifying flash memory against test-atmega8535.hex:
avrdude: load data flash data from input file test-atmega8535.hex:
avrdude: input file test-atmega8535.hex auto detected as Intel Hex
avrdude: input file test-atmega8535.hex contains 96 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.42s



avrdude: verifying ...
avrdude: 96 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
На фото виден результат работы.












Для работы тестовая плата берёт питание от программатора.

На видео отображён процесс прошивки тестовой платы и работа простейшей программы.






Ниже представлен фотолог сборки программатора:















Вот и всё. Огромное спасибо авторам usbasp и v-usb, а также сайту easyelectronics.ru за предаставленную информацию и исходные коды.