Cov txheej txheem:

Yuav Siv Raspberry Pi li cas GPIO Pins thiab Avrdude rau Bit-bang-program DIMP 2 lossis DA PIMP 2: 9 Cov Kauj Ruam
Yuav Siv Raspberry Pi li cas GPIO Pins thiab Avrdude rau Bit-bang-program DIMP 2 lossis DA PIMP 2: 9 Cov Kauj Ruam

Video: Yuav Siv Raspberry Pi li cas GPIO Pins thiab Avrdude rau Bit-bang-program DIMP 2 lossis DA PIMP 2: 9 Cov Kauj Ruam

Video: Yuav Siv Raspberry Pi li cas GPIO Pins thiab Avrdude rau Bit-bang-program DIMP 2 lossis DA PIMP 2: 9 Cov Kauj Ruam
Video: Qhia thov kyc, thiab yuav muag nyiaj pi li cas. 2024, Kaum ib hlis
Anonim
Yuav Siv Raspberry Pi's GPIO Pins thiab Avrdude rau Bit-bang-program DIMP 2 lossis DA PIMP 2
Yuav Siv Raspberry Pi's GPIO Pins thiab Avrdude rau Bit-bang-program DIMP 2 lossis DA PIMP 2

Cov no yog cov lus qhia ib qib zuj zus yuav siv Raspberry Pi li cas thiab pub dawb qhib-lus txib avrdude rau me ntsis-bang-program DIMP 2 lossis DA PIMP 2. Kuv xav tias koj tau paub nrog koj li Raspberry Pi thiab LINUX kab hais kom ua Koj tsis tas yuav tsum paub txog AVR chip programming, tab sis nws pab yog tias muaj qee yam tsis raug vim tias koj tuaj yeem nyeem cov lus avrdude thiab muaj qee lub tswv yim ntawm yuav ua li cas.

Cov txheej txheem no yuav tsum siv li 1 teev thawj zaug thiab 5 txog 10 feeb txhua lub sijhawm tom qab.

Koj yuav xav tau:

1) Raspberry Pi nrog GPIO pins thiab lub zog siv. Kuv tab tom siv Raspberry Pi Zero W nrog GPIO pins soldered rau. OS yuav tsum yog Raspberry Pi OS (yav dhau los Raspbian). Kuv tab tom siv Raspbian Lite (Ncab), uas yog yam qub. Cov lus txib no tseem yuav ua haujlwm ntawm qhov hloov tshiab kawg ntawm Raspberry Pi OS.

Mus tom ntej Kuv yuav xa mus rau Raspberry Pi li "RPi."

2) Poj niam-rau-poj niam jumper xov hlau. Tau txais ib qho ntawm txhua cov xim no: liab, dub, xiav, daj, ntsuab, ntshav. Kuv tab tom siv xim av hloov xim liab.

3) DIMP 2 lossis DA PIMP 2 nrog rau yeem 10-pin ICSP header soldered in. Kuv tab tom siv DIMP 2 ntawm no, tab sis cov lus qhia zoo ib yam rau DA PIMP 2.

4) Internet nkag mus rau RPi yog li koj tuaj yeem nruab qhov qhib qhib qhov hais kom ua avrdude.

5) Luam the.hex flash file rau koj DIMP 2 lossis DA PIMP 2. Koj tuaj yeem tsim.hex cov ntaub ntawv koj tus kheej los ntawm cov khoom siv raw, tab sis kuv yuav tsis qhia koj yuav ua li cas ntawm no.

6) Qee txoj hauv kev nkag mus rau RPi-siv kev sib txuas hauv network lossis nkag ncaj qha rau console. Koj yuav tsum muaj peev xwm khiav cov lus txib ntawm nws.

Kauj Ruam 1: Tshem AC Cov Hluav Taws Xob thiab tshem lub roj teeb 9V

Ua ntej tshaj, xyuas seb AC fais fab txuas tau txuas rau DIMP 2 lossis DA PIMP 2 thiab txuas rau hauv AC qhov hluav taws xob. Yog tias yog, DANGER: LETHAL SHOCK HAZARD. Hnav cov hnab looj tes roj hmab thiab tom qab ntawd kaw lub pob zeb tseem ceeb hloov ntawm DIMP 2 lossis DA PIMP 2. Tom qab ntawd, tshem lub hwj huam hluav taws xob los ntawm AC lub hauv paus, thiab tshem AC lub hwj chim qaum los ntawm DIMP 2 lossis DA PIMP 2. Koj tuaj yeem nqa tshem cov hnab looj tes roj hmab thaum tshem lub hwj huam AC tawm.

Tom qab ntawd, tshem lub roj teeb 9V. Lub zog yuav muab rau DIMP 2 los ntawm RPi dhau los ntawm liab (Vcc) thiab dub (GND) xov hlau. Tig lub ntsuas hluav taws xob hloov pauv ntawm DIMP 2 lossis DA PIMP 2 kom kaw thaum muaj xwm txheej.

Kauj Ruam 2: Nqa Cov Jumper Wires

Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires
Nqa Mus Rau Jumper Wires

Nrog RPi tsis muaj zog, pib nqes mus rau cov xov hlau jumper. Mus tom ntej, GPIO pins nyob ntawm Raspberry Pi thiab ICSP tus pin nyob ntawm DIMP 2 (header J3) lossis DA PIMP 2 (header J1).

Xa mus rau daim duab kuv cobbled ua ke thiab cov duab yog tias koj poob.

RPi ib feem ntawm daim duab yog los ntawm pinout.xyz.

ATMEGA48V-10PU feem ntawm daim duab yog cai 2016 Atmel Corp.

Kuv thov kev ncaj ncees siv cov duab kos no vim qhov tseem ceeb, hloov pauv ntxiv.

Dub mus ntawm GPIO tus pin 6 mus rau ICSP tus pin 10. Qhov no yog GND (Hauv av)

Daj mus ntawm GPIO tus pin 12 mus rau ICSP tus pin 9. Nov yog MISO.

Ntsuab mus ntawm GPIO tus pin 16 mus rau ICSP tus pin 1. Nov yog MOSI.

Xiav mus ntawm GPIO tus pin 18 mus rau ICSP tus pin 7. Qhov no yog SCK lossis SCLK (SClock)

Ntshav (xim av hauv kuv cov duab) mus los ntawm GPIO tus pin 32 mus rau ICSP tus pin 5. Nov yog RESET.

Liab mus los ntawm GPIO tus pin 4 mus rau ICSP tus pin 2. Qhov no yog Vcc (5V Lub Hwj Chim)

Kauj Ruam 3: Hwj chim RPi

Tam sim no, mus tom ntej thiab txhawb nqa RPi. Qhov voltmeter ntawm DIMP 2 lossis DA PIMP 2 yuav tsum muaj zog ib yam nkaus, tab sis koj yuav tsis paub nws los ntawm kev saib ntawm cov zaub. Yog tias tsis ntseeg, ntsuas qhov ntsuas hluav taws xob nrog tus liab sojntsuam ntawm tus pin 20 ntawm ATMEGA48V-10PU thiab qhov kev sojntsuam dub ntawm tus pin 4, 6, lossis 8 ntawm ICSP header. Nws yuav tsum nyob ib puag ncig 5VDC.

Kauj ruam 4: Nruab Avrdude

Kuv cov lus qhia yuav tsuas yog qhia kab lus txib. Yog tias koj muaj GUI khiav, koj yuav xav qhib Terminal kom khiav cov kab hais kom ua kab lus no.

Nkag mus raws li tus neeg siv pib ua pi. Tus password tsis raug yog raspberry

Nruab avrdude hais kom ua los ntawm kev ntaus cov hauv qab no ntawm lub davhlau ya nyob twg hais kom sai:

sudo apt-tau nruab avrdude

Kauj Ruam 5: Hloov Kho Avrdude Config File

Kho kom raug avrdude config file los ntawm kev ntaus ntawv:

sudo nano /etc/avrdude.conf

Ntxiv cov kab no rau nruab nrab ntawm cov ntaub ntawv qhov twg lwm cov programmer cov ntsiab lus yog. Qhov kuv tau ua yog theej cov programmer seem rau saum nws rau id = "linuxgpio", tom qab ntawv muab nws tso rau hauv qab no (ntawm kab 1274), tom qab ntawd kho qhov tshiab.

programmer

id = "pi_1"; desc = "Siv Linux sysfs interface rau bitbang GPIO kab"; yam = "linuxgpio"; rov pib dua = 12; txq = 24; mas = 23; mas = 18;;

Tom qab ntawv khaws cov ntawv los ntawm nias: Ctrl-O

Thiab tom qab ntawv txiav tawm nano editor los ntawm nias: Ctrl-X

Kauj Ruam 6: Rub tawm lossis Luam the.hex Flash File rau /home /pi

Luam the.hex flash file mus rau RPi. Kuv xav tias koj paub yuav ua li cas. HINT: Siv wget, curl, git, lossis scp hais kom tau txais cov ntaub ntawv los ntawm lub vev xaib mus rau RPi.

DIMP 2's.hex cov ntaub ntawv nyob ntawm no, nrog rau qhov chaws:

github.com/dchang0/dimp2

Ib qho kev hloov kho ntawm DA PIMP 2's.hex cov ntaub ntawv nyob ntawm no. Kuv tsis tau sim qhov no!

github.com/jcwren/DaPimp2

Yog tias cov ntawv saum toj no ntawm DA PIMP 2's.hex cov ntaub ntawv tsis ua haujlwm, Mikey Sklar tus thawj DA PIMP 2 tus lej qhov chaws nyob ntawm no. Koj yuav tau suav nws rau hauv kev ua haujlwm.hex cov ntaub ntawv koj tus kheej. Kuv tsis npog qhov ntawd hauv cov lus qhia no vim tias nws yuav siv sijhawm ntev (tab sis tsis nyuaj) qhia. Kuv tau ua tiav txoj haujlwm ob peb ua haujlwm DA PIMP 2 units siv cov cai no:

drive.google.com/open?id=0Bx5Als-UeiZbSUdH…

Lossis koj tuaj yeem mus rau nplooj DA PIMP 2 lub ntsiab ntawm no thiab nyem rau kab ntawv txuas rau qhov chaws.

mikeysklar.blogspot.com/p/da-pimp-battery-…

Muab cov ntawv.hex tso rau ntawm txoj kev no thiab lub npe ntawm RPi …

Rau DIMP 2:

/home/pi/dimp2.hex

Rau DA PIMP 2:

/home/pi/da_pimp2.hex

Kauj Ruam 7: Txheeb Xyuas Qhov Avrdude Tham Tau Nrog ATMEGA48V-10PU

Khiav qhov avrdude kom paub tseeb tias nws tuaj yeem tham nrog ATMEGA48V-10PU nti ntawm DIMP 2 lossis DA PIMP 2.

cd /home /pib

sudo avrdude -c pi_1 -p m48 -v

Koj yuav tau txais txog ib nplooj ntawv tso tawm. Saib qhov kawg. Yog tias koj tau txais cov lus teb zoo li no, tom qab ntawd koj tuaj yeem mus txuas ntxiv.

avrdude: AVR ntaus ntawv tau pib thiab npaj yuav lees txais cov lus qhia

Nyeem | ############################################# | 100% 0.00s

Yog tias tsis yog, tom qab ntawd qee yam tsis raug thiab koj yuav tsum xam nws tawm. Feem ntau nws yog qhov ua tsis raug, tab sis lwm qhov kev tsis txaus siab uas kuv tau pom yog tias ATMEGA48V-10PU nti yog qhov cuav. Nws zoo li tias ntau ntawm lawv muag ntawm Amazon lossis ebay yog cov cuav. Cov uas muag los ntawm Mouser lossis Digikey thiab lwm tus neeg tso cai faib khoom yog qhov tseeb.

Kauj Ruam 8: Nyem rau.hex Cov Ntaub Ntawv mus rau ATMEGA48V-10PU

Khiav qhov lus txib no los ua lub cajmeem ntawm lub nti…

Rau DIMP 2:

cd /home /pib

sudo avrdude -c pi_1 -p m48 -U nyem: w: dimp2.hex

Rau DA PIMP 2:

cd /home /pib

sudo avrdude -c pi_1 -p m48 -U nyem: w: da_pimp2.hex

Koj yuav tau txais txog ib nplooj ntawv tso tawm. Nrhiav cov kab no:

avrdude: sau flash (1528 bytes):

Sau ntawv | ############################################# | 100% 0.79s

avrdude: muaj tseeb…

avrdude: 1528 bytes ntawm flash txheeb xyuas avrdude: safemode: Fuses OK (E: FF, H: DF, L: 62)

Yog tias koj tau txais qhov no nyob deb, koj yuav tsum pom cov duab LED qhia pom zeroes rau qhov hluav taws xob. Yog tias koj pom cov zeroes, koj ua tiav! Yog tsis yog, hla mus rau kauj ruam tom ntej.

Yog tias koj pom cov zeroes, zoo kaw koj RPi nrog cov lus txib no:

sudo kaw -h tam sim no

Thaum lub teeb pom kev ntawm RPi tua (DIMP 2 lossis DA PIMP 2 tseem yuav nyob), koj tuaj yeem tshem lub hwj chim los ntawm RPi. Tom qab ntawd tshem lub xov hlau txuas ntawm RPi thiab DIMP 2 lossis DA PIMP 2.

Kauj Ruam 9: Kev daws teeb meem yooj yim Yog tias Flash tsis ua tiav

Yog tias koj tsis pom zeroes ntawm koj DIMP 2 lossis DA PIMP 2 cov zaub, tom qab ntawd nws yog lub sijhawm los daws teeb meem.

Ib zaug ntxiv, xyuas koj cov xov hlau ua ntej.

Tom qab ntawd, txheeb xyuas cov fuse xeev qhia los ntawm avrdude. Nws muaj peev xwm tias koj lub nti tuaj nrog cov fuses teeb tsa qhov sib txawv ntau dua li lub Hoobkas tsis ua haujlwm. Cov nti yuav xav tau nws cov fuses rov pib dua, uas yuav tsum muaj cov cuab yeej kho vajtse sib txawv. Qhov no yog teeb meem nrog ntau yam ntawm ATMEGA48V-10PU daim tawv muag ntawm eBay-lawv yog cov chips qub rub los ntawm cov cuab yeej pov tseg, thiab cov fuses tau teeb tsa, thiab tus muag khoom tsis thab kom rov pib dua cov fuses.

Qee lub sij hawm nti tsis yog ATMEGA48V-10PU. Nws tuaj yeem yog daim npav sib txawv tau rov ua dua tshiab. Feem ntau koj tuaj yeem qhia cov cuav no los ntawm kev ua tib zoo saib cov cim nyob rau sab saum toj thiab hauv qab ntawm cov nti. Nws ntse dua kom tau txais koj li ATMEGA48V-10PU los ntawm cov chaw muab khoom ntseeg zoo li Mouser lossis Digikey.

Pom zoo: