Flashlight Firmware Repository

2239 posts / 0 new
Last post
Texas_Ace
Texas_Ace's picture
Offline
Last seen: 21 hours 33 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas
Tom E wrote:

I use Win w/ATMEL Studio 7. I copy all the header files (.h files) into the same folder where the main source code is – much easier to track and control, for me that is… I’ve built Bistro successfully. I believe I have it all working fin under 1 solution with 1 project. I could ZIP up the complete Studio 7 solution and post it on my google driver, with the proper AVRDude BAT files, if you want — when I get home – @work now.


 

Interesting, when I tried to compile in Atmel 7 it just spit out errors. When I tried the exact same files in linuix it worked perfect. Never could figure out the issue so just stuck with linux, it was not worth the time to mess with atmel, I prefer Atom for messing with the code anyways.

BTW, I have not seen anyone on here mention it but it is possible to use Atmel studio to flash things with AVRdude without having to actually mess with avrdude directly.

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

Been using ATMEL since the beginning - never a problem, but of course I've worked with dozens of dev environments and compilers for years (ok - several decades), so I can usually find & fix compiler/linker related issues quickly.

If you still want to use/try ATMEL 7, just dnld one of my complete zips.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 year 1 week ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

I use Atmel Studio 7 to compile, and avrdude to flash.

I just copy/paste the commands from a txt file, so if I need different ones for the 25 can somebody help with those.

Tom, that would be great. I am totally clueless on how to use the header and bat files.

I haven’t even looked at the code for bistro, I’m hoping it’s still easy to remove things. I like simplicity, but I just noticed LVP is nonfunctional on the modified version of blf-a6

But really step by step would be great. Like currently I do this:
1. pull open c file in wordpad
2. alter mode groups/turbo timer (by comparing to similar lights I have that had good levels)
3. copy code to new project in Atmel7
4. compile to hex
5. copy command line to avrdude
6. flash

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

Hey guys. I hate to barge in but I see your active conversation and I’m in a bind.

I am getting error message: program enable: target doesn’t answer. 1 Initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.

I’m trying to flash Bistro onto pds triple stack but I get the this error. I think it might be related to using a different attiny25 than I was using before, but I’m unsure. Any help?

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

This is the chip I am using:
AVR AVR® ATtiny Microcontroller IC 8-Bit 20MHz 2KB (1K x 16) FLASH 8-SOIC

Serp
Serp's picture
Offline
Last seen: 7 months 4 weeks ago
Joined: 01/14/2014 - 11:29
Posts: 626
Location: Ukraine

ToyKeeper, a couple of questions about the Bistro-mini firmware.
1. Do you have Bistro-mini project for AVR Studio?
2. What a piece of code responsible for the brightness in the Moonlight and the low mode?
3. Will LED glow in the Moonlight if we take the driver for 1050 & 1400 mA?
4. I tried to open your C-file in AVR Studio but received entirely errors at compile time. In what program it is made?
Thanks

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA
Serp wrote:
ToyKeeper, a couple of questions about the Bistro-mini firmware. 1. Do you have Bistro-mini project for AVR Studio? 2. What a piece of code responsible for the brightness in the Moonlight and the low mode? 3. Will LED glow in the Moonlight if we take the driver for 1050 & 1400 mA? 4. I tried to open your C-file in AVR Studio but received entirely errors at compile time. In what program it is made? Thanks

I use avr studio and it works with her file. There are a number of other files that it needs to compile. Such as tkvoltage.h and others. To adjust moon mode change the value of the first entry for the 7135 in the ramping table

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

I change the first value in all columns to 0. Then I have an “off” mode for silent switch activation

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

Hhmm, that's not a real part#, I think?? It should say TINY25 or TINY25V right on the top of it - pretty sure. Those specs are correct though, for a 25.

You are checking for a 25 device though, not a 13A - guess so if you've done 25's before...

Is that the only new 25 you have? If you have more, try "air" clipping one and see if it works. If you have a grnd/short on any of the traces/connections connected to the MCU pins, it causes problems. I've done "air" clipping before, and it always works.

Serp - you need all the required header files to compile it. I didn't try yet, but not sure where they are all at in the repository.

TK works in unix/linux only, last I understood, so doesn't use ATMEL Studio.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 year 1 week ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Luddite question: if I don’t want to use the .h file, can I just add all the “defines” back into the main bistro .c ?

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA
Tom E wrote:

Hhmm, that’s not a real part#, I think?? It should say TINY25 or TINY25V right on the top of it – pretty sure. Those specs are correct though, for a 25.


You are checking for a 25 device though, not a 13A – guess so if you’ve done 25’s before…


Is that the only new 25 you have? If you have more, try “air” clipping one and see if it works. If you have a grnd/short on any of the traces/connections connected to the MCU pins, it causes problems. I’ve done “air” clipping before, and it always works.


Serp – you need all the required header files to compile it. I didn’t try yet, but not sure where they are all at in the repository.


TK works in unix/linux only, last I understood, so doesn’t use ATMEL Studio.

hmm. yesterday i reflowed three boards. one texas advenger and two triple stacks. i used one chip from the old batch and two from the new. All three give me the same error. this would make me think its the connections, but i tested two boards that i built last week with the same old chips and they all register fine. Man this stuff is confusion. ill start checking for solder bridges and stuff, but all three from yesterday? Maybe i used too hot of a reflow temperature and burned the chips. Also, i have one new chip left. i will dig that out and try the air clipping.

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

Of course! I thought bout that, actually, but I work/edit right in the Studio environment - works just like Microsoft Visual Studio, which I use every day @work, because it actually is Microsoft Visual Studio btw. So, I just add the header files to the project and they are very easy to work with inside the editing environment.

If you use my solution/project files as-is, that's what you would get.

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

oh ya. i am using the tiny25. Air clipping my last unprogramed chip gave me the same error. So i am getting the error on all unprogrammed chips and not on any that i have already programmed. i guess it has to be my programmer then. i will try and rewire it now.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 year 1 week ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Btw, where is bistro TripleDown? Didn’t see it in the bistro folder?

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

Tripledown
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/tiny25/files/...

It’s under the tiny25 directory. Kind of confusing

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 21 hours 33 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas
pilotdog68 wrote:
Btw, where is bistro TripleDown? Didn’t see it in the bistro folder?

It is confusing getting around in that repo, it is in the tiny25 section: http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/tiny25/files/...

EDIT: LR beat me to it.

Serp
Serp's picture
Offline
Last seen: 7 months 4 weeks ago
Joined: 01/14/2014 - 11:29
Posts: 626
Location: Ukraine

LightRider, Tom E thanks. I will try to find the necessary files. But for me it is very unclear done this Page https://launchpad.net/flashlight-firmware
Can I ask you to make an archive of the project for AVR Studio 4, or 5, or any other. With the right file … Sad

PS Is this what I need? http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/convoy/files/...

LightRider
LightRider's picture
Offline
Last seen: 2 years 7 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

After everything… All I needed was a computer restart. As a longtime windows user I should have known better. Facepalm

serp: I’m not very knowledgeable with this stuff so I cant give you a step by step. how far have you gotten. have you ever flashed custom firmware prior to this?

the bistro mini .c file should be ready to go as is except you need to alter the directory of the files called for in all of the “include” commands that use “example file”. the include commands that use < and > do not need to be addressed.

I’m not confident with this stuff but maybe it will help some?

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

Only Studio 7 - that's all I have/use. I try to keep current with the latest version on it. I find it confusing as well.

 

Well, what I should do is make a working/tested bistro and bistro-mini Studio 7 solution, so two complete working ones (I believe I have the bistro done already).

I looked at the "mini" source quickly this morn and wasn't sure bout the bistro-mini.c and tk-attiny.h combination, because the mini source has the #define for "ATTINY 13" commented out, so looks like F_CPU never gets set. Ultimate test though is to compile/link and see if it works. Looks like guys have already built it successfully, so it must work, I would think.

Also not sure of her technique on detecting long/short presses, without an OTC, but maybe she doesn't detect that? Not sure how the UI works again.... My fault... Not sure if the mini version uses ON time memory or OFF time memory...

Serp
Serp's picture
Offline
Last seen: 7 months 4 weeks ago
Joined: 01/14/2014 - 11:29
Posts: 626
Location: Ukraine

I myself rewriting firmware for the flashlight. Few understand this. Maybe Monday will try to deal better with this new firmware.
On fonarevka.ru I mostly used Tamagotchi
bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/head:/Tamagotchi/7135×8v2/README
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/downloa...

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 8 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

pilotdog68 wrote:
Alright guys, I need some help. Talk to me like I’m a total noob.

I am still using 13a’s, but I have found a few bugs in my version of blf-a6 that was adapted for Triple channel. So I figure now is as good a time as any to try bistro on a 25. I haev not even used the new system of config files or whatever they are called, I just alter the c file for every build and have a library of the ones I have used in other lights.

So, step by step, how do I configure bistro and flash to a 25, assuming I am already setup to flash hex files to 13’s?


Let’s see…

It’s probably easiest to copy the .h files into the same directory as the .c file, as already mentioned. Or copy the whole repository and add “..” and “../..” to the include path, wherever AVRstudio sets that option.

You’ll probably want to modify tk-calibration.h with values specific to your driver. This is basically voltage and OTC readings, as measured by the tools in the battcheck/ directory. Once you have the right values for your driver, it’s a good idea to keep a copy of that file somewhere for later use.

You may also want to calculate a new output ramp. The command line for this should be in a comment just above the current ramp, for easy reference.

As for getting everything built in Windows, I really don’t know. I haven’t used Windows since the 1990s. It sounds like others here have already answered a lot of that though.

pilotdog68 wrote:
I just noticed LVP is nonfunctional on the modified version of blf-a6

It’s possible that could be caused by calibration values instead of actual logic bugs. Each person’s drivers seem to need slightly different values. The battcheck/README file should explain how to get the numbers it needs.

LightRider wrote:
I am getting error message: program enable: target doesn’t answer. 1 Initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.

The “double check connections” bit is probably correct. That error only happens when the MCU doesn’t respond, meaning that there’s probably a physical connection issue. It could have a pin shorted, could be rotated 180 degrees, could have a pin not making contact, etc. There could even be solder hiding under the MCU where it’s not visible.

Or it could also mean the chips were severely under-clocked at some point and aren’t running fast enough to respond at the expected rate. I did that once, before I knew it would effectively brick the chip. Sad

Serp wrote:
1. Do you have Bistro-mini project for AVR Studio?
2. What a piece of code responsible for the brightness in the Moonlight and the low mode?
3. Will LED glow in the Moonlight if we take the driver for 1050 & 1400 mA?
4. I tried to open your C-file in AVR Studio but received entirely errors at compile time. In what program it is made?

1. I don’t have anything for AVRstudio unless a project’s author includes those files.
2. The brightness is controlled by a ramp. IIRC, it’s called RAMP_FET in bistro-mini. Normally this would be a long list of 64 values per channel, but to save space it’s only 7 now.
3. No.
4. It doesn’t matter what program made it; it’s using the C99 language standard and avr-gcc tools+libraries.

pilotdog68 wrote:
Luddite question: if I don’t want to use the .h file, can I just add all the “defines” back into the main bistro .c ?

You could replace each “include” line with the contents of the file it points at, and it would be literally the same as what the compiler does. But it’s usually easier to just copy the header files into the same directory as the C file.

Texas_Ace wrote:
It is confusing getting around in that repo, it is in the tiny25 section

Sorry about that. I normally don’t merge things into trunk until they’re fairly stable, and nobody except me had tested bistro-tripledown last time I touched it. But it can probably merge into trunk now that it has been used by more than just me.

The non-trunk branches are usually for development. Like, branch from trunk to a dev branch, make new features there for as long as it takes, then merge back into trunk after it’s all tested and working. Bistro-tripledown never quite got that final step.

The exception is a few project-specific stable maintenance branches, like blf-a6-final, which is frozen at the time the product released and only receives updates if/when the actual product is updated. Those are basically “stable releases”.

Tom E wrote:
the mini source has the #define for “ATTINY 13” commented out, so looks like F_CPU never gets set

I’ve been leaving those in for reference, but commented out by default. This is because the build script sets that variable, allowing a single source file to compile perfectly on multiple MCUs with no changes. Here are the relevant parts of bin/build.sh:
...
export ATTINY=13
export MCU=attiny$ATTINY
...
export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -DATTINY=$ATTINY -I.. -I../.. -I../../.."
...
run $CC $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
...
run avr-size -C --mcu=$MCU $PROGRAM.elf | grep Full

So, if I use “build.sh” it compiles for attiny13, if I use “build-25.sh” it compiles for attiny25, and similar for “build-45.sh” and “build-85.sh” and any other MCUs we end up adding. No need to change the source for each MCU.

Tom E wrote:
Also not sure of her technique on detecting long/short presses, without an OTC, but maybe she doesn’t detect that? Not sure how the UI works again…. My fault… Not sure if the mini version uses ON time memory or OFF time memory…

It uses the SRAM decay “noinit” trick to measure offtime, since the Convoy drivers have no OTC.
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 8 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

Okay. All pending updates to bistro, bistro-tripledown, and bistro-mini (biscotti) are merged into trunk. And I marked the tiny25 branch as merged (and thus not shown by default) since it’s merged and no longer in active development. Now the only branches visible by default are trunk, sandbox, and three stable releases for specific products.

Hopefully that’ll help make things a bit simpler and easier. Smile

Of course, there are a bunch of other things to catch up on too…

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

K, I just compiled/built bistro-tripledown successfully. Prog mem is 1976 bytes, 96.5% used.

Not sure where the source code for the mini version is now? Gone from the old link, not yet in the main trunk? bistro and bistro-tripledown are there though.

Help?

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 8 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

Tom E wrote:
Not sure where the source code for the mini version is now? Gone from the old link, not yet in the main trunk? bistro and bistro-tripledown are there though.

Sorry, I finally renamed it from bistro-mini to biscotti. It should be there, but it’s under bistro/biscotti instead of bistro/mini.

http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/h...

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

K, see it. thanx!

Edit: Just got biscotti compiled/linked - prog mem is 1022 bytes smile.

 


 

This is a direct link to the bistro tripledown in ATMEL Studio V7, complete solution/project: https://drive.google.com tripledown AS7.zip

Note: it hasn't been run or tested, just compiled/linked!

 

This is a direct link to the biscotti in ATMEL Studio V7, complete solution/project: https://drive.google.com biscotti AS7.zip

Note: it hasn't been run or tested, just compiled/linked!

 

 

 

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 21 hours 33 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas

Every time I try to get into the repository code it gives me a 404 error?

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

This works for me: https://code.launchpad.net/~toykeeper/flashlight-firmware/trunk

But "browse the code" is broken. Looks like it's down, inaccessible right now.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 21 hours 33 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas
Tom E wrote:

This works for me: https://code.launchpad.net/~toykeeper/flashlight-firmware/trunk


But “browse the code” is broken. Looks like it’s down, inaccessible right now.

Yeah, same thing I am experiencing. I was trying to grab the battcheck hex for the tiny25 so I could calibrate the Avenger drivers for the 22k R1. I tried flashing the one I have but get nothing, the driver works fine with bistro.

Tom E
Tom E's picture
Offline
Last seen: 8 hours 13 min ago
Joined: 08/19/2012 - 08:23
Posts: 13569
Location: LI NY

You mean bistro-tripledown?

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 21 hours 33 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas
Tom E wrote:

You mean bistro-tripledown?

Yeah, bistro-tripledown works fine but the battcheck.hex I have does nothing. I am going to try reflashing it and another driver just to be sure.

Pages