STAR Firmware by JonnyC - Source Code and Explanation

1335 posts / 0 new
Last post
WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 1 year 7 months ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town

priest77 wrote:
That was the problem, I was using value 1 for 7135. Now it starts with a single short click.
Thanks! I’ve changed it to 0,92,4,15,125,255 so it will start with 92, the mode I am using most. Now it is perfect Smile

interesting…never thought of that…a med/hi as 1st mode, then back thru to moon on up…

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

One more beginner question Smile

How can I get rid of the noise, especial in medium mode?

Tom E
Tom E's picture
Offline
Last seen: 1 day 21 hours ago
Joined: 08/19/2012 - 08:23
Posts: 15041
Location: LI NY

My default setup is 9.4 kHz - "Fast PWM" at 18-19 kHz should be noise free, but I never tried it - everyone else is using it though, seems like. If you have a solid ground for the driver, nothing else you can do I would think, accept to try Fast PWM. With Fast PWM, you probably need to raise the moonlight PWM 5 value even higher, maybe 8 or 9? Not sure...

Ohh - by setting mode #1 to a medium level kind of breaks the auto battery level detection/savings, because the way JC wrote this, as the battery drains low, he auto drops down modes, so it's expecting modes to start low and go higher.

WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 1 year 7 months ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town

oh, I didn’t think of that…get a weak battery then drop to lowest of low mode

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

But it will still shut the light off at 2.80v, am I right?

P.S. Will fast-PWM (18 kHz) drain battery faster or it won’t be noticeable?

Tom E
Tom E's picture
Offline
Last seen: 1 day 21 hours ago
Joined: 08/19/2012 - 08:23
Posts: 15041
Location: LI NY

priest77 wrote:
But it will still shut the light off at 2.80v, am I right? P.S. Will fast-PWM (18 kHz) drain battery faster or it won't be noticeable?

Yes, 2.8v cutoff should still work (accept in my last BLF17DD board build -- duuni wut is wrong... Cry)

Don't think PWM rate will have any effect on power drawing, ie battery drain time.. Shouldn't, cant see how - I'm no expert though.

JonnyC
JonnyC's picture
Offline
Last seen: 8 months 3 weeks ago
Joined: 01/14/2011 - 19:12
Posts: 1148
Location: Green Bay, WI - USA

Tom E wrote:

Ohh - by setting mode #1 to a medium level kind of breaks the auto battery level detection/savings, because the way JC wrote this, as the battery drains low, he auto drops down modes, so it's expecting modes to start low and go higher.

Yeah, sorry about that :-/

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

RMM wrote:

Regular clicky STAR with strobe added 

STARSTROBE1.0.c


I can’t flash this one, I am getting this error at the end:
Quote:
avrdude: ERROR: address 0×0410 out of range at line 65 of star.hex avrdude: write to file ‘star.hex’ failed avrdude done. Thank you.
priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

Did anybody tried to flash this STARSTROBE1.0.c?
I’ve tried the .hex file that @WarHawk-AVG compilled for me but I get the same error. Sad
I want to know it anybody tried it and succeed?

Tom E
Tom E's picture
Offline
Last seen: 1 day 21 hours ago
Joined: 08/19/2012 - 08:23
Posts: 15041
Location: LI NY

Well the Tiny13A has 1K ROM/flash, and an address of 0x410 is 16 bytes past the address range. Maybe with certain combo of compile options, you went over the 1K limit?

0x400 (hex) is 1024 decimal (1 K)

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

I compile it like all other .hex files, following this instructions and all works nice except for that STARSTROBE1.0.c .
Now I tried to compile STAR On-time memory v1.1 and I flashed it without any problem :~

Here is a screenshot of STARSTROBE1.0.c error:

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 2 years 2 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

Hey smart people I’m having an issue I can’t get rid of- first I thought it was limited to my E12 with a tiny10 running a baby FET but I’m now getting it on my TC300 with a BLF17DD v2 running with a zener mod and MT-G2…

When the light is off (I’ve changed the default to no memory without soldering the star) it will come on in moonlight PWM =1, true “moonlight mode” (also set in the programming to default on without soldering star, not just low set to 1)and at initial start up it works fine but when cycling up threw the modes when it rolls around back to moonlight there is an extremely bright flash after turbo. Like I said at first I was thinking it had to do with the baby FET I have on the tiny10 but now it’s doing it on a 17dd that started with completely different code, not just a rewrite.

Other variables to mention are 1 WDT tick before mode is memorized, on-time and fast PWM.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

Tom E
Tom E's picture
Offline
Last seen: 1 day 21 hours ago
Joined: 08/19/2012 - 08:23
Posts: 15041
Location: LI NY

priest77 - dunno, haven't dlnd'd and tried that source code. Did this come from JC or RMM? Maybe they know? Wonder if the Dev Studio versions are the same - what you use and they used, or something like optimization settings for the build. If you used same source with nothing edited, then could be the tools you are using are generating compiled code that's not as efficient or optimized as they did.

I use Atmel Studio 6.0, or newer.

HarleyQuin
HarleyQuin's picture
Offline
Last seen: 1 year 1 month ago
Joined: 03/29/2013 - 04:47
Posts: 588

@priest77
afaik different compiler might produce different hex file sizes while compiling the same source code.
0×0410 means your hex file is larger than 1024 byte which is max for Attiny13a, as Tom E wrote.
Atmel Studio shows the size in the bottom window (scrolling up a bit) after compiling, so you can see if it is too large before flashing.
You might try reducing the code slightly by removing unneeded features, as you are only slightly above 1kB.

Oshpark Boards:
HQ ProgKey: Universal Driver Programming Key . Boost: HQ 15mm/17mm programmable boost driver with ATtiny13A
46mm Triple-Channel: BLF SRK FET v3 . 17mm Linear: HQ10D / HQ4D / HQ4S . Contact Boards: 22/24/26mm

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

You are both right. I’ve installed latest version Atmel Studio 6.2 and now it tells me this:

Quote:

Error 1 Program Memory Usage : 1076 bytes 105.1 % Full (Memory Overflow)

Data Memory Usage : 50 bytes 78.1 % Full GccApplication1 0 0 GccApplication1

Now I am not sure what code part can be removed.
I want to remove the feature of “Star 3 = H-L if connected”

Tom E
Tom E's picture
Offline
Last seen: 1 day 21 hours ago
Joined: 08/19/2012 - 08:23
Posts: 15041
Location: LI NY

I run Atmel Studio 6.2, just downloaded STARStrobe1.0.c, created a new solution and project (actually just copied and renamed an existing one), build output below. The key info is these two lines:

Program Memory Usage : 1012 bytes 98.8 % Full

Data Memory Usage : 50 bytes 78.1 % Full

It's big but just fits. I'd carefully check the compiler and linker arguments. It says below it's using vers 4.8.1. Also, you must use the "Optimize for size" setting of -Os.

 

------ Rebuild All started: Project: STARStrobe, Configuration: Release AVR ------

 Build started.

Project "STARStrobe.cproj" (Clean target(s)):

Target "Clean" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Compiler.targets" from project "C:\Tiny13a Projects\STARStrobe\eswitch\STARStrobe.cproj" (entry point):

Using "RunCompilerTask" task from assembly "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll".

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils

C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils\make.exe clean

rm -rf STARSTROBE.o  

rm -rf STARSTROBE.d  

rm -rf "STARStrobe.elf" "STARStrobe.a" "STARStrobe.hex" "STARStrobe.lss" "STARStrobe.eep" "STARStrobe.map" "STARStrobe.srec" "STARStrobe.usersignatures"

Done executing task "RunCompilerTask".

Done building target "Clean" in project "STARStrobe.cproj".

Done building project "STARStrobe.cproj".

Build succeeded.

------ Rebuild All started: Project: STARStrobe, Configuration: Release AVR ------

Build started.

Project "STARStrobe.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Compiler.targets" from project "C:\Tiny13a Projects\STARStrobe\eswitch\STARStrobe.cproj" (target "Build" depends on it):

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils

C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils\make.exe all

Building file: .././STARSTROBE.c

Invoking: AVR/GNU C Compiler : 4.8.1

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=attiny13a -c -std=gnu99 -MD -MP -MF "STARSTROBE.d" -MT"STARSTROBE.d" -MT"STARSTROBE.o" -o "STARSTROBE.o" ".././STARSTROBE.c"

Finished building: .././STARSTROBE.c

Building target: STARStrobe.elf

Invoking: AVR/GNU Linker : 4.8.1

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-gcc.exe" -o STARStrobe.elf STARSTROBE.o -Wl,-Map="STARStrobe.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=attiny13a 

Finished building target: STARStrobe.elf

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "STARStrobe.elf" "STARStrobe.hex"

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "STARStrobe.elf" "STARStrobe.eep" || exit 0

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "STARStrobe.elf" > "STARStrobe.lss"

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "STARStrobe.elf" "STARStrobe.srec"

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-size.exe" "STARStrobe.elf"

text data bss dec hex filename

1012 0 50 1062 426 STARStrobe.elf

Done executing task "RunCompilerTask".

Using "RunOutputFileVerifyTask" task from assembly "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll".

Task "RunOutputFileVerifyTask"

Program Memory Usage : 1012 bytes 98.8 % Full

Data Memory Usage : 50 bytes 78.1 % Full

Done executing task "RunOutputFileVerifyTask".

 Done building target "CoreBuild" in project "STARStrobe.cproj".

Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').

Target "Build" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Avr.common.targets" from project "C:\Tiny13a Projects\STARStrobe\eswitch\STARStrobe.cproj" (entry point):

Done building target "Build" in project "STARStrobe.cproj".

 Done building project "STARStrobe.cproj".

 Build succeeded.

 ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

 

Tom E
Tom E's picture
Offline
Last seen: 1 day 21 hours ago
Joined: 08/19/2012 - 08:23
Posts: 15041
Location: LI NY

To correct the Optimization setting to "-Os" in Atmel Studio 6.2, do the following:

  • on the menu bar, click on Project, then {project name} Properties
  • click on Toolchain on the left, then click on Optimization on the list, under AVR/GNU C Compiler
  • change Optimization Level to "Optimize for size"
RMM
RMM's picture
Offline
Last seen: 1 year 10 months ago
Joined: 07/23/2013 - 13:47
Posts: 4006
Location: USA

Sorry for not specifying, I do have my compiler optimization set to -Os

Mountain Electronics : batteries, Noctigon, and much more! What's new? 

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

@Tom E
It worked now!
avrdude done. Thank you. Smile

WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 1 year 7 months ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town

priest77 did it install correctly?

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

Yes, now I have STARSTROBE1.0.c on my UF-T20.
I’ve tried to add STROBE as additional mode but it seems there is no room for it, I’ve got something like 100.2 % Memory Overflow.
Then I’ve just changed the Medium mode value to 254 and put it to be the last one, and I am using it like that.

WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 1 year 7 months ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town

priest77 wrote:
Yes, now I have STARSTROBE1.0.c on my UF-T20.
I’ve tried to add STROBE as additional mode but it seems there is no room for it, I’ve got something like 100.2 % Memory Overflow.
Then I’ve just changed the Medium mode value to 254 and put it to be the last one, and I am using it like that.
Oh…make us a video it in operation please
priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

This is the order I have:

Quote:
MOON 6 (soldered 2nd star and lowered from 8 to 6)
LOW 40
MODE_HIGH_W_TURBO 100
TURBO 255
STROBE 254

Here is the video:

Is there any way to make STROBE some kind hidden?

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 2 years 2 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

priest77 wrote:
This is the order I have:
Quote:
MOON 6 (soldered 2nd star and lowered from 8 to 6)
LOW 40
MODE_HIGH_W_TURBO 100
TURBO 255
STROBE 254

Here is the video:

Is there any way to make STROBE some kind hidden?

You know you can change it so moon is default on so you dont need to have the star soldered, that makes it so you dont have so unsolder it every time you want to reflash.

this is the code to set it to default moon on (you can ignore my added comments, its so I remember what I change stuff from)

#ifdef MODE_MOON if ((PINB & (1 << STAR2_PIN))> 0) { // Stock is ==, ( > for moon default to on, soldering star will disable moon) modes[mode_cnt++] = MODE_MOON; }

There is no way that I know to make modes not in the normal cycle but if you change to memory off you wouldnt have to cycle threw it every time.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

Thanks! That was giving me headache at the beginning I was trying to flash it with the star soldered…
This is much better than soldering and unsoldering every time.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 2 years 2 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

Just noticed it changed that to a smiley, if you got quote my reply you can copy it from there correctly.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 1 year 7 months ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town
Cereal_killer wrote:
Just noticed it changed that to a smiley, if you got quote my reply you can copy it from there correctly.
Add an extra space between the > and the ) otherwise it thinks you want a smiley
priest77
priest77's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

I’ve done it with “quote”

Microa
Offline
Last seen: 18 hours 24 min ago
Joined: 06/29/2011 - 21:20
Posts: 251

How can I disable the turbo time out? Should I just comment out #define TURBO_TIMEOUT ?

WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 1 year 7 months ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town

Microa wrote:
How can I disable the turbo time out? Should I just comment out #define TURBO_TIMEOUT ?

Yes

Just add // in front of the line then compile the .hex

Pages