How To Build a Flashlight With Perfect Modes (picture heavy)

863 posts / 0 new
Last post
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 4 min ago
Joined: 01/12/2013 - 14:40
Posts: 10143
Location: (469219) 2016 HO3

It makes me happy that the last sentence is: “In case of most flashlight drivers it is much simpler to write the new firmware from scratch.”

That’s exactly the reason I haven’t messed with Atmel assembly code. Smile

T18
Offline
Last seen: 5 months 1 week ago
Joined: 02/14/2016 - 15:29
Posts: 1163

Hello, I have been following a page that is guiding me through the equipment needed to flash drivers, I am an absolute beginner.
The page I have been getting much information from like the link to this page actually and is called AVR Drivers on Flashlight Wiki and my question is only about the price of a USBasp.
I have found one at Hobby King, for $3.99 and have seen others for a bit more but not much less than this, I think this is about middle of the road,
I am hopeful that someone could please perhaps take a quick glance and tell me if maybe this is to cheap and perhaps what is a reasonable price range ?
This is the link to the, USBasp AVR Programming Device for ATMEL Processors
Thank you very much..

Tom E
Tom E's picture
Offline
Last seen: 20 hours 5 min ago
Joined: 08/19/2012 - 08:23
Posts: 12423
Location: LI NY

Why wouldn't you get this one - well proven, known, used by many: https://www.fasttech.com/products/0/10000022/1002900-atmega-attiny-51-avr-isp-usbasp-usb-programmer

It's referenced all over the place. The USBAVR V2.0 labeling is important. Dunno what the Hobby King is exactly. As mentioned just a couple posts above, please refer to Hoop's thread: http://budgetlightforum.com/node/36216. Lots of ref info in the OP there.

 

SIGShooter
SIGShooter's picture
Offline
Last seen: 2 hours 28 min ago
Joined: 07/14/2013 - 02:10
Posts: 1856
Location: northern california

I bought the one Tom mentioned a month ago and it’s been working fine for me.

9mm/40cal/45cal bullets and large/small pistol primers available for sale in San Francisco Bay area

T18
Offline
Last seen: 5 months 1 week ago
Joined: 02/14/2016 - 15:29
Posts: 1163

Thank you Tom and SigShooter, that is exactly what I will do today, absolutely..
I might have saved myself a few hours by just asking here outright but didn’t want to bother anyone.
Thank you again and have a wonderful day.. oh, also, Tom thank you for the lead and link to Hoops thread, very helpful as always, along with SigShooter’s endorsement, fantastic, that’s solved..!
One thing I knew was Hobby King is a China company but has Stateside warehouses and that one I pointed out was in Oregon warehouse, so it would have gotten here quicker, but quicker is not always better..
Thanks all,

Tom E
Tom E's picture
Offline
Last seen: 20 hours 5 min ago
Joined: 08/19/2012 - 08:23
Posts: 12423
Location: LI NY

smile - yea, think someone bought something similar a while back, wound up being wired differently - think it was actually an old design compared to the V2.0 - think they ended up buying the 2.0 anyway.

T18
Offline
Last seen: 5 months 1 week ago
Joined: 02/14/2016 - 15:29
Posts: 1163

Tom E wrote:

smile - yea, think someone bought something similar a while back, wound up being wired differently – think it was actually an old design compared to the V2.0 – think they ended up buying the 2.0 anyway.


That would most certainly have been my luck and would have been such a disappointment and right out of the gate,
So I am glad I used my head for more than a hat rack and decided to ask first.
I still have an old list you had given me in a post a long time back, but it was only the names of required equipment and that was it, but I’ve been sitting on that info Tom and finally decided to move ahead after watching the work you’ve been doing and wanting some of the UI’s available but no means to flash them to my lights, So thank you very much Tom
Chupo_cro
Chupo_cro's picture
Offline
Last seen: 2 years 10 months ago
Joined: 08/08/2013 - 10:51
Posts: 4
Location: Hrvatska

T18 wrote:
Hello, I have been following a page that is guiding me through the equipment needed to flash drivers, I am an absolute beginner. The page I have been getting much information from like the link to this page actually and is called AVR Drivers on Flashlight Wiki and my question is only about the price of a USBasp. I have found one at Hobby King, for $3.99 and have seen others for a bit more but not much less than this, I think this is about middle of the road, I am hopeful that someone could please perhaps take a quick glance and tell me if maybe this is to cheap and perhaps what is a reasonable price range ? This is the link to the, "USBasp AVR Programming Device for ATMEL Processors":https://www.hobbyking.com/en_us/usbasp-avr-programming-device-for-atmel-... Thank you very much..

If you have a PC with parallel port you can build a programmer in less than 15 minutes. Just connect a few wires and 4 resistors as shown here and then you can use Ponyprog which has much friendlier user interface than avrdude + some GUI, especially when working with fuses. I've been using such a 'programmer' for years without a single issue.

Chupo_cro

T18
Offline
Last seen: 5 months 1 week ago
Joined: 02/14/2016 - 15:29
Posts: 1163

Chupo_cro wrote:

T18 wrote:
Hello, I have been following a page that is guiding me through the equipment needed to flash drivers, I am an absolute beginner. The page I have been getting much information from like the link to this page actually and is called AVR Drivers on Flashlight Wiki and my question is only about the price of a USBasp. I have found one at Hobby King, for $3.99 and have seen others for a bit more but not much less than this, I think this is about middle of the road, I am hopeful that someone could please perhaps take a quick glance and tell me if maybe this is to cheap and perhaps what is a reasonable price range ? This is the link to the, USBasp AVR Programming Device for ATMEL Processors Thank you very much..

If you have a PC with parallel port you can build a programmer in less than 15 minutes. Just connect a few wires and 4 resistors as shown here and then you can use Ponyprog which has much friendlier user interface than avrdude + some GUI, especially when working with fuses. I’ve been using such a ‘programmer’ for years without a single issue.


That is really great.. Thank You Chupo..!!
I should be able to use a Parallel DB25 M/2F Y-Splitter so I can keep using my printer, I think this is a DB25 parallel, well it’s stock with system so generic, thinking out loud sorry, and with your recommendations that should work perfectly and doesn’t appear complicated at all, thanks again greatly appreciated. Wow, that is some really great information you linked, thanks once again..
Chupo_cro
Chupo_cro's picture
Offline
Last seen: 2 years 10 months ago
Joined: 08/08/2013 - 10:51
Posts: 4
Location: Hrvatska

T18 wrote:
That is really great.. Thank You Chupo..!! I should be able to use a Parallel DB25 M/2F Y-Splitter so I can keep using my printer, I think this is a DB25 parallel, well it's stock with system so generic, thinking out loud sorry, and with your recommendations that should work perfectly and doesn't appear complicated at all, thanks again greatly appreciated. Wow, that is some really great information you linked, thanks once again..

I am glad you find it useful. After the first launch of Ponyprog under Setup > Interface Setup select Parallel, AVR ISP I/O and probably LPT1 and everything else unchecked. Then run Setup > Calibration and that's it. Be careful with the fuse bits not to lock the µC by disabling the internal oscillator (checked = programmed = zero). If you by accident disable the internal oscillator then you will have to connect the external crystal or use high voltage programmer to reprogram the fuses to reenable the internal oscillator so you could use ISP programming again.

Chupo_cro

T18
Offline
Last seen: 5 months 1 week ago
Joined: 02/14/2016 - 15:29
Posts: 1163

Chupo_cro wrote:

T18 wrote:
That is really great.. Thank You Chupo..!! I should be able to use a Parallel DB25 M/2F Y-Splitter so I can keep using my printer, I think this is a DB25 parallel, well it’s stock with system so generic, thinking out loud sorry, and with your recommendations that should work perfectly and doesn’t appear complicated at all, thanks again greatly appreciated. Wow, that is some really great information you linked, thanks once again..

I am glad you find it useful. After the first launch of Ponyprog under Setup > Interface Setup select Parallel, AVR ISP I/O and probably LPT1 and everything else unchecked. Then run Setup > Calibration and that’s it. Be careful with the fuse bits not to lock the µC by disabling the internal oscillator (checked = programmed = zero). If you by accident disable the internal oscillator then you will have to connect the external crystal or use high voltage programmer to reprogram the fuses to reenable the internal oscillator so you could use ISP programming again.


I have cut and pasted this to my note book, and I’d bet this would have been something I surely would have messed up since I believe I am accident prone Silly ,
So thank you again, you’ve been so helpful..!
caramba
caramba's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 11/09/2016 - 14:43
Posts: 383

That sounds cool

Can you use an old Jetdirect with parallel ports?

Chupo_cro wrote:
If you have a PC with parallel port you can build a programmer in less than 15 minutes. Just connect a few wires and 4 resistors as shown here and then you can use Ponyprog which has much friendlier user interface than avrdude + some GUI, especially when working with fuses. I’ve been using such a ‘programmer’ for years without a single issue.
Chupo_cro
Chupo_cro's picture
Offline
Last seen: 2 years 10 months ago
Joined: 08/08/2013 - 10:51
Posts: 4
Location: Hrvatska

caramba wrote:
That sounds cool Can you use an old Jetdirect with parallel ports?

Unfortunately I don't think that might work because PonyProg uses direct I/O access and it doesn't work well even with PCI parallel adapter card. In that case it is not possible to select AVR ISP I/O option and AVR ISP API option has to be used resulting in very slow programming speed (minutes instead of seconds). On the other hand, a 'real' parallel port works really well. I have both USBasp programmer and JTAG ICE debugger and I can use USBasp with both the PC and Raspberry Pi and I can program AVRs even directly (without programmer) using Raspberry Pi's I/O lines but I mostly use parallel port + PonyProg. I use USB programmers only when parallel port is occupied by CNC machine.

Chupo_cro

caramba
caramba's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 11/09/2016 - 14:43
Posts: 383

Thanks for the explanation. Smile

HighEfficiency
HighEfficiency's picture
Offline
Last seen: 2 years 6 months ago
Joined: 02/05/2014 - 11:33
Posts: 74
Location: USA

Ran into a new problem running a reflash of STAR, although I suspect my problem has nothing to do with STAR.

Have not updated any drivers or or changed the pinouts on the USBASP. They’re all soldered and in great shape. No shorting between pins either.

Any ideas?

avrdude -p t13 -c usbasp -u -Uflash:w:TaskLightAlkaline28.65.130.250.hex:a -Ulfuse:w:0×75:m Ha-Uhfuse:w:0xFF:m

HighEfficiency
HighEfficiency's picture
Offline
Last seen: 2 years 6 months ago
Joined: 02/05/2014 - 11:33
Posts: 74
Location: USA

Solved the above issue with a reboot but have run into a new problem.

At the end of programming I’m now getting the following message:
avrdude: verifying …
avrdude: verification error, first mismatch at byte 0×0000 0×00 != 0×09
avrdude: verification error; content mismatch
avrdude done. Thank you.

After this, the driver does not output any power.

Really stumped here. Trying to program the same piece of code I successfully programmed a few times in January.

Tom E
Tom E's picture
Offline
Last seen: 20 hours 5 min ago
Joined: 08/19/2012 - 08:23
Posts: 12423
Location: LI NY

The verification is critical to get to pass. I've gotten this error many times, always could get it resolved with re-clipping, cleaning the clip and I/O pins w/isop. alcohol, retrying, etc.

HighEfficiency
HighEfficiency's picture
Offline
Last seen: 2 years 6 months ago
Joined: 02/05/2014 - 11:33
Posts: 74
Location: USA

Critical indeed. Thanks for your input.

Tough to believe but another reboot and the problem went away. Nothing like have to reboot a PC twice just to program the thing!

thulfiqar
thulfiqar's picture
Offline
Last seen: 2 weeks 1 day ago
Joined: 04/10/2016 - 09:06
Posts: 171
Location: Baghdad

isn’t this method easier than using a usbasp?

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 4 min ago
Joined: 01/12/2013 - 14:40
Posts: 10143
Location: (469219) 2016 HO3

Usually the chips are reflashed without unsoldering them from the driver PCB. For example, on a BLF Q8, remove the two driver screws, tilt the driver out, and the MCU should be exposed. It’s easy to clip onto and reflash without soldering anything.

thulfiqar
thulfiqar's picture
Offline
Last seen: 2 weeks 1 day ago
Joined: 04/10/2016 - 09:06
Posts: 171
Location: Baghdad
ToyKeeper wrote:
Usually the chips are reflashed without unsoldering them from the driver PCB. For example, on a BLF Q8, remove the two driver screws, tilt the driver out, and the MCU should be exposed. It’s easy to clip onto and reflash without soldering anything.

Great, so if I use a SOP8 Clip + and Ardiono uno in isp mode then I can Upload Firmwares normally ?
This method seems simpler, Correct me if I’m wrong Smile

Lexel
Lexel's picture
Offline
Last seen: 5 hours 17 min ago
Joined: 11/01/2016 - 08:00
Posts: 5573
Location: Germany
thulfiqar wrote:
isn’t this method easier than using a usbasp?

The USBasp is simply the same, just with a clip you snap on the chip, if you bend the MCU legs for less wide pads the clip holds without any pressure

it makes not much difference if the chip is soldered or not to flash a MCU with the clip,
while for SOP8 you need a special adapter to flash it like in the video
also flashing Narsil with LVP and Temperature calibrated you need 2-4 flashes in total

Pages