Cov txheej txheem:

Flashing Custom Firmware to a BLF A6 Flashlight: 5 Kauj Ruam
Flashing Custom Firmware to a BLF A6 Flashlight: 5 Kauj Ruam

Video: Flashing Custom Firmware to a BLF A6 Flashlight: 5 Kauj Ruam

Video: Flashing Custom Firmware to a BLF A6 Flashlight: 5 Kauj Ruam
Video: BLF A6 - 1600 lumens budget EDC Torch 2024, Kaum ib hlis
Anonim
Flashing Custom Firmware rau BLF A6 Teeb nyem
Flashing Custom Firmware rau BLF A6 Teeb nyem

Kuv nyuam qhuav tau txais BLF A6. Nws zoo nkauj heev, tab sis kuv tsis nyiam ib yam ntawm cov pab pawg ua neej nyob, yog li kuv hloov kho qhov firmware kom siv kuv qhov kev xav tau ci ntsa iab. Cov ntaub ntawv nyuaj nrhiav, yog li kuv tso txhua yam kuv tau kawm ntawm no rau kuv tus kheej thiab lwm tus.

Khoom siv

BLF A6 (nws yuav zaum ua haujlwm nrog lwm lub teeb pom kev zoo ATtiny)

Tweezers / daim kab xev nyias nyias / txiab me me / ib yam dab tsi los kho lub rooj tsav tsheb tuav lub nplhaib

Khoos phis tawj kom nyem nrog, nyiam dua khiav Linux faib

USB ASP programmer / Arduino / qee yam uas tuaj yeem ua AVR programming (pom tseeb USB ASP programmer tau pom zoo, tab sis kuv siv Arduino)

SOIC8 clip (nws tuaj yeem ua tau yam tsis muaj, tab sis nws yog qhov zoo heev thiab tsis pom zoo txhua)

(xaiv tau) Breadboard thiab/lossis jumper xov hlau kom ua txuas tau yooj yim dua

Kauj ruam 1: Rub tawm Firmware

Cov firmware rau BLF A6 (thiab ntau lwm lub teeb nyem) muaj nyob ntawm no. Tus sau tham txog nws ntawm no. Koj tuaj yeem rub nws los ntawm kev khiav:

bzr ceg lp: ~ tus tuav khoom siv/teeb nyem-firmware/blf-a6-kawg

hauv lub davhlau ya nyob twg. (koj yuav tsum tau teeb tsa bzr)

Nco tseg: hauv kev hloov kho yav dhau los ntawm Cov Lus Qhia Kuv tau siv "bzr ceg lp: teeb nyem-firmware" hloov pauv. Kuv tau kawm txij li qhov no rub tawm qhov qub version nrog qhov tsis raug rau lub sijhawm ua lub capacitor, ua rau lub pob nyem tsis xis nyob ntev. (ua tsaug rau cov xov no ntawm Reddit)

Cov ntawv koj xav tau yog blf-a6-kawg/ToyKeeper/blf-a6. Nws muaj cov ntaub ntawv sau ua ke.hex npaj rau nyem (blf-a6.hex) thiab C code uas koj tuaj yeem hloov kho. (blf-a6.c) Yog tias koj xav nyem nyem cov khoom lag luam koj tuaj yeem hla cov kauj ruam tom ntej thiab tsuas yog siv blf-a6.hex. Qee qhov ntawm lwm cov firmware hauv qhov chaw cia khoom tej zaum yuav ua haujlwm ib yam nkaus.

Kauj ruam 2: Hloov kho Firmware

Qhib blf-a6.c hauv qhov koj nyiam cov ntawv sau lossis IDE. Cov kab uas nthuav tshaj plaws yog cov pab pawg ntawm kab 116 thiab 131. Lawv zoo li no:

// Mode group 1 #define NUM_MODES1 7 // PWM levels for the big circuit (FET or Nx7135) #define MODESNx1 0, 0, 0, 7, 56, 137, 255 // PWM qib rau qhov me me Circuit (1x7135) # txhais MODES1x1 2, 20, 110, 255, 255, 255, 255 // Kuv tus qauv: 6 = 0..6, 7 = 2..11, 8 = 8..21 (15..32) // Krono qauv: 6 = 5..21, 7 = 17..32, 8 = 33..96 (50..78) // Manker2: 2 = 21, 3 = 39, 4 = 47, … 6? = 68 // PWM ceev rau txhua hom #define MODES_PWM1 PHASE, FAST, FAST, FAST, FAST, FAST, PHASE // Mode group 2 #define NUM_MODES2 4 #define MODESNx2 0, 0, 90, 255 #define MODES1x2 20, 230, 255, 0 #define MODES_PWM2 FAST, FAST, FAST, PHASE

Rau txhua pawg, MODESN yog PWM tus nqi siv rau FET, thiab MODES1 yog PWM tus nqi siv rau 7135 hauv txhua hom. Tus lej yog nyob nruab nrab ntawm 0 thiab 255, thiab sib haum rau qhov ci ntawm lub teeb. Xav paub ntau ntxiv ntawm no. (nqes mus rau "Hom kev cai:") Kuv tsis paub tseeb tias PWM nrawm npaum li cas. Yog leej twg paub, qhia kuv hauv cov lus. FET tuaj yeem tsim lub teeb ntau dua li 7135, tab sis 7135 ua kom lub teeb ntau dua lossis tsawg dua qub los ntawm lub roj teeb lub neej, thaum FET tau tsaus dua vim nws tsis muaj roj teeb.

Ntawm no koj tuaj yeem hloov kho PWM qhov tseem ceeb los tsim cov qauv rau koj nyiam. Koj tuaj yeem hloov pauv tus lej ib yam nkaus, tab sis kuv tsis tau sim nws raws li kuv xav tau plaub hom, uas tshwm sim los ua tus lej hauv pab pawg thib ob. Kuv xav kom lub hnub qub tsaus dua, yog li kuv tau teeb tsa thawj zaug rau 0/1, thiab kuv pom hom turbo los ua qhov tsis tseem ceeb me ntsis, yog li kuv hloov nws nrog 137/255, qhov sib npaug ntawm hom rau hauv pawg xya pawg. Koj tuaj yeem hloov kho qhov seem ntawm cov cai yog xav tau, tab sis kuv tsis tau sim nws.

Thaum koj tau txais cov cai koj xav tau, koj yuav tsum suav nws rau hauv.hex cov ntaub ntawv. Yam tsawg kawg, koj xav tau gcc-avr thiab avr-libc. Yog tias koj muaj teeb meem, saib ntawm lwm qhov kev vam khom hauv cov ntawv nyeem firmware. Cov chaw cia khoom suav nrog cov ntawv tsim, tab sis kuv tsis tuaj yeem ua nws. Hloov chaw, Kuv rub tawm cov ntawv qub nrog

bzr ceg lp: teeb nyem-firmware

thiab theej cov ntawv sau qub (uas kuv tuaj yeem ua haujlwm) dua qhov tshiab. Tom qab ntawd kuv khiav:

../../bin/build.sh 13 blf-a6

hauv blf-a6 nplaub tshev. (yuav tsum muaj txoj hauv kev zoo dua los ua qhov ntawd) Qhov../../bin/build.sh hu tsab ntawv, 13 qhia meej tias nws tab tom tsim rau ATtiny13 thiab blf-a6 qhia meej tias nws yog rau BLF A6. (duh) Nws yuav tsum qhia koj tias cov lus txib nws tau ua haujlwm li cas thiab muab cov txiaj ntsig rau koj. Kuv zoo li no:

avr -gcc -Wall -g -Os -mmcu = attiny13 -c -std = gnu99 -fgnu89 -inline -DATTINY = 13 -I.. -I../.. -I../../.. -fshort -enums -o blf -a6.o -c blf -a6.cavr -gcc -Wall -g -Os -mmcu = attiny13 -fgnu89 -inline -o blf -a6.elf blf -a6.o avr -objcopy --set -section-flags =.eeprom = faib, thauj-hloov-seem-lma.eeprom = 0-tsis hloov-ceeb toom -O ihex blf-a6.elf blf-a6.hex Txoj Haujlwm: 1022 bytes (99.8% puv) Cov ntaub ntawv: 13 bytes (20.3% Tag Nrho)

Cov lus txib twb tau ua kom zoo rau qhov loj me, yog li yog nws hais tias nws ntau dua 100% puv, sim tawm lus tawm

#define FULL_BIKING_STROBE

ntawm kab 147 txhawm rau siv qhov me me me me caij tsheb kauj vab strobe. Yog tias nws tseem tsis haum, tej zaum koj yuav tau tshem ntau txoj cai nyob qhov twg. Thaum nws ua tiav kev suav sau, yuav tsum muaj cov ntawv hu ua blf-a6.hex hauv daim nplaub tshev. Nov yog koj cov ntaub ntawv sau ua ke, npaj rau nyem.

Kauj Ruam 3: Tshem Tawm Lub Teeb

Disassemble lub teeb nyem
Disassemble lub teeb nyem
Disassemble lub teeb nyem
Disassemble lub teeb nyem
Disassemble lub teeb nyem
Disassemble lub teeb nyem

Ntsia lub teeb qhov kawg ntawm lub moos. Muaj ob txoj hlua txuas ntawm no. Ib qho ze rau qhov kawg ntawm lub teeb nyem qhib lub teeb pom kev zoo thiab LED, thiab ib qho ze rau nruab nrab qhib lub rooj tsav tsheb. Koj xav tau ib qho nyob ze rau nruab nrab.

Sab hauv, koj yuav tsum pom lub roj teeb lub caij nplooj ntoo hlav thiab lub nplhaib tuav nrog ob lub qhov nyob hauv. Ntxig koj tus tweezers / tus pliers nyias / txiab rau hauv lub qhov thiab tig lawv rau lub moos. Nws nyuaj heev, thiab siv ob yam khoom sib cais tej zaum yuav tsis muab rau koj kom muaj zog txaus. Kuv siv txiab txiab rau ntawm Swiss Army Riam.

Thaum koj tau txais lub nplhaib tawm, tso tus tsav tsheb dawb. Nws tseem txuas nrog ob lub xov hlau, yog li ceev faj. Lawv tau sib dhos ua ke, yog li tig lub rooj tsavxwm ib txoj kev lossis lwm qhov kom txog thaum cov xov hlau xoob. Thaum koj tau txais kev tso cai txaus, tig lub rooj tsavxwm. Koj xav tau nws kom lub nti nrog "TINY13A" ntawm nws siab dua thiab nkag tau yooj yim dua. Yog tias nws nyob ntawm qhov tsis raug, tig nws mus rau lwm txoj kev. Tshem lub caij nplooj ntoo hlav hauv qab. Qhov no yuav ua kom nws nyob ib ntus thiab ua kom yooj yim dua rau ntawm lub nti. Yog tias koj muaj teeb meem nrog qhov no koj tuaj yeem zaum ntswj lwm tus koom thiab tshem tawm ob lub xov hlau los ntawm lwm sab kom koj tuaj yeem tshem lub rooj tsavxwm kom tiav, tab sis kuv tsis tau sim nws.

Kauj Ruam 4: Txuas Flashing Hardware

Txuas Flashing Hardware
Txuas Flashing Hardware
Txuas Flashing Hardware
Txuas Flashing Hardware
Txuas Flashing Hardware
Txuas Flashing Hardware

Tam sim no koj siv SOIC8 clip los txuas ATtiny13 nti thiab koj tus programmer. Nrog kuv qhov SOIC8 clip, yog tias kuv muaj cov xaim liab nyob sab laug ntawm ob qho kawg, kab ntawm tus pin ze rau kuv ntawm qhov kawg clip sib xws rau kab ntawm tus pin ze rau kuv ntawm qhov txuas kawg, thaum lub txuas tau tig mus. (saib kuv daim duab zoo nkauj tshaj) Phau ntawv qhia no qhia koj siv USB ASP V2.0 programmer. Yog tias koj ua, txuas nws zoo li no:

  • Pin 1 ntawm ATtiny13 txhawm rau pin 5 ntawm USB ASP (rov pib dua)
  • Pin 4 ntawm ATtiny13 txhawm rau pin 10 ntawm USB ASP (hauv av)
  • Pin 5 ntawm ATtiny13 txhawm rau pin 1 ntawm USB ASP (MOSI)
  • Pin 6 ntawm ATtiny13 txhawm rau pin 9 ntawm USB ASP (MISO)
  • Pin 7 ntawm ATtiny13 txhawm rau pin 7 ntawm USB ASP (SCK)
  • Pin 8 ntawm ATtiny13 txhawm rau pin 2 ntawm USB ASP (VCC)

Yog tias, zoo li kuv, koj siv Arduino, koj yuav tsum tau npaj me ntsis ntxiv. Ua raws cov kauj ruam xoom thiab ob ntawm phau ntawv qhia no:

Qhib Arduino IDE thiab xyuas kom tseeb tias koj Arduino txuas nrog koj lub khoos phis tawj. Nrhiav ISP kos duab hauv Cov Ntaub Ntawv> Piv Txwv> 11. ArduinoISP> ArduinoISP thiab xa nws mus rau koj Arduino. Tom qab ntawd txuas ATtiny13 rau nws zoo li no:

  • Pin 1 ntawm ATtiny13 txhawm rau pin 10 ntawm Arduino (rov pib dua)
  • Pin 4 ntawm ATtiny13 mus rau GND ntawm Arduino (hauv av)
  • Pin 5 ntawm ATtiny13 txhawm rau pin 11 ntawm Arduino (MOSI)
  • Pin 6 ntawm ATtiny13 txhawm rau pin 12 ntawm Arduino (MISO)
  • Pin 7 ntawm ATtiny13 rau tus pin 13 ntawm Arduino (SCK)
  • Pin 8 ntawm ATtiny13 rau VCC / 5V / 3.3V ntawm Arduino (ib qho yuav tsum ua haujlwm, tab sis 5V ntseeg tau ntau dua) (VCC)

Kuv tau teeb tsa pob khoom kho vajtse ib yam nkaus, tab sis tej zaum nws tsis tsim nyog. Yog tias tsis ntseeg, sim nws. Nws yuav tsis ua mob. Tab sis tsis txhob hlawv lub bootloader vim nws yuav zaum cib koj lub teeb nyem.

Kauj ruam 5: Nyem rau nws

Txhawm rau nyem qhov firmware, koj yuav tsum nruab AVRDUDE. Txhawm rau txheeb xyuas nws ua haujlwm nrog kuv Arduino, kuv khiav:

avrdude -v -p attiny13 -c stk500v1 -P /dev /ttyUSB0 -b 19200 -n

Yog tias nws ua haujlwm, Kuv txav mus rau qhov npliag npliag qhov chaw thiab khiav:

avrdude -v -p attiny13 -c stk500v1 -P /dev /ttyUSB0 -b 19200 -u -Uflash: r: flash -dump.hex: i -Ueeprom: r: eeprom -dump.hex: i -Ulfuse: r: lfuse -dump.hex: i -Uhfuse: r: hfuse -dump.hex: kuv

Txhawm rau thaub qab ntawm cov firmware uas twb muaj lawm. Thiab kom nyem nws, los ntawm daim nplaub tshev nrog hloov kho blf-a6.hex Kuv khiav:

avrdude -v -p attiny13 -c stk500v1 -P /dev /ttyUSB0 -b 19200 -u -Uflash: w: blf -a6.hex -Ulfuse: w: 0x75: m -Uhfuse: w: 0xFF: m

Rau qee qhov laj thawj, Kuv yuav tsum tau hais qhia stk500v1 ua tus programmer, thiab nws tsis ua haujlwm tshwj tsis yog kuv tau teev qhov chaw nres nkoj thiab tus nqi baud. Yog tias koj siv Arduino thiab tsis ntseeg, sim txuas koj li ATtiny13 los ntawm Arduino thiab xa cov duab kos hauv Arduino IDE siv cov teeb tsa ntawm no. Nws yuav ua tsis tiav, tab sis nws yuav tsum hais dab tsi hais kom ua nws siv hauv lub qhov rai console. Koj tuaj yeem luam tus cwj pwm rau hauv koj cov lus AVRDUDE.

Yog tias koj siv USB ASP programmer, hloov chaw:

avrdude -v -p attiny13 -c usbasp -n

Kom pom tias nws ua haujlwm thiab:

avrdude -v -p attiny13 -c usbasp -u -Uflash: r: flash -dump.hex: i -Ueeprom: r: eeprom -dump.hex: i -Ulfuse: r: lfuse -dump.hex: i -Uhfuse: r: hfuse-dump.hex: kuv

Txhawm rau thaub qab thiab:

avrdude -v -p attiny13 -c usbasp -u -Uflash: w: blf -a6.hex -Ulfuse: w: 0x75: m -Uhfuse: w: 0xFF: m

Kom nyem nws.

-Uflash: w: blf-a6.hex hais txog cov ntaub ntawv nws tau flashing. Hloov blf-a6.hex nrog koj lub npe cov ntaub ntawv yog tias nws txawv.

-Ulfuse: w: 0x75: m thiab -Uhfuse: w: 0xFF: m yog cov fuses. Koj li yuav yog qhov sib txawv, yog li ob zaug xyuas qhov tseem ceeb hauv teeb nyem-firmware/bin/flash-tiny13-fuses.sh.

Yog tias nws muab qhov yuam kev tawm ntawm qhov tsis sib xws, nws txhais tau tias cov duab loj dhau kom haum rau ntawm lub nti thiab koj yuav tsum tshem qee qhov ntawm cov cai. Yog tias nws ua tiav zoo, nws yuav tsum tso saib qee qhov kev nce qib, tom qab ntawd hais tias "avrdude ua tiav. Ua tsaug."

Yog tias nws hais tias "daim ntawv kos npe tsis raug" thiab lub jumper ntawm koj tus programmer tau teeb tsa rau 3.3v, sim teeb nws rau 5v.

Tom qab koj tau flashed nws, rov sau koj lub teeb nyem thiab pom tias nws ua haujlwm. Kuv tau ua, tab sis lub sij hawm poob yog tawm rau ib txhia ̶r̶e̶a̶s̶o̶n̶.̶ qhov ntev Presses yuav tsum tau hais txog peb lub vib nas this es tsis txhob ̶1̶.̶5̶.̶ kuv ̶d̶o̶n̶'̶t̶ paub yog hais tias ̶i̶t̶'̶s̶ ib yam dab tsi ua nrog rau qhov Arduino los yog vim ̶I̶'̶v̶e̶ siv tsis ncaj ncees lawm tej chaw ̶s̶o̶m̶e̶w̶h̶e̶r̶e̶.̶ yog tias koj muaj tej lub tswv yim, ̶ qhia rau kuv paub nyob rau hauv lub ̶c̶o̶m̶m̶e̶n̶t̶s̶.̶

Kho: Kuv kho nws. (saib cov kauj ruam 1)

Pom zoo: