Texas Avenger "TA" Driver series - Triple channel + Bistro or Narsil + Clicky or E-switch - The Ultimate open source driver!

I have serious problems with the TA Bistro on a Tiny85

when the driver rests at room temperature and I turn it on its working OK
but after a couple of seconds the long presses get extreemly short so the short presses dont work its like the long presses are way too short when like longer than 20milliseconds its registered as long press

MCU flashed with this
avrdude -c usbasp -p t85 -u -Uflash:w:TA_Bistro_85.hex -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

Strange, I would have to look at the fuses I used but pretty sure they were the same as what narsil uses. I have not noticed any issues running bistro on the tiny85 but also not sure what lights have the tiny85 and which the tiny25.

The most likely candidate is the OTC cap. Are you using the same cap for the tiny25 and tiny85?

I can’t think of any reason why the timing would change over time except heat, is it getting hot?

I changed the OTC, no change
I tried the fuses in your TA Bistro file for 85 and Narsil fuses

it seems to be changing fast after I get it to power or it is above 27°C

Very strange, all the other components on the driver are the same as the tiny25 versions that work fine?

What do you mean it changes fast once you get it to power?

So if you keep the temperature low it works fine?

Are you using the included hex files from the TA bistro or one you compiled yourself?

I would try flashing the pre-made hex file and even the stock bistro from TK’s repo and see if the results are any different.

yeah I put that board to the side after an hour unhappy

I needed to compiule a hex, with modegroup 18 changed turbo in front of Strobe

just had one other strange board,
turned out on the top side below one AMC7135 the ground made contact to the hole going to MCU pin 5 and PWM of top side AMCs,
as there was not enough solder mask to cover it so the back of the AMC had made contact to it

Yeah, a short will cause issues. If you have the same issues with all the drivers that use your compiled version, try flashing the pre-made versions. I have tested and use those myself so I know they work.

I did flash your bistro hex on all other drivers
this one is different as I am out of Tiny 25 and have to change one modegroup and do a temp cal

it works fine with your hex premade files, so there must be an issue in my compiled version
could you mail me #your atmel studio 5 project containing Bistro?

I set the tk-attiny.h for attiny 85 and changed that one modegroup
added
#elif (ATTINY == 85)
// TODO: Use 6.4 MHz instead of 8 MHz?
#define F_CPU 8000000UL
#define EEPSIZE 512
#define V_REF REFS1
#define BOGOMIPS (F_CPU/3200)

fuses
avrdude -p attiny85 -c usbasp -u -Uflash:w:TA_Bistro_85.hex:a -U lfuse:w:0xe2:m -U hfuse:w:0xde:m -U efuse:w:0xff:m

Basically for next batch I want to have also more Tiny 85, so i can programm TA Bistro or Narsil on them

Voltage sag is another issue with OTCs. I had one that sagged so bad that once I put it in boost I couldn’t get it out. Almost every press, no matter how fast, resulted in so low values the light always did a cold start. When I finally got it out of boost, changing modes back and forth was fine, as long as I didn’t go back into boost.

Ah, if it works with the pre-made hex then it must indeed be in the atmel compile settings.

I would send you mine but like I said, I don’t use atmel anymore, it was just too much of a hassle to get it to work right.

I use linux to compile now and it never complains or has an issue and generally gives me smaller file sizes as well. I saw no reason to try atmel again.

You can setup a linux install on a USB flash drive to take care of flashing things or use a virtual machine, which is what I have been doing recently. It allows me to save the state of the machine and easily access it anytime without having to either reboot or have all the code up in my normal linux install.

I’ve now updated my 841 driver thread with some info about the new design: Mike C drivers: v8 series, ATtiny1634 based.

In that snippet of code above, I found the definition of BOGOMIPS there is not correct for 8 Mhz. A value of 2000, what it was originally, works perfect. It's used in the _delay_ms() function in tk-delay.h.

I fixed in my local latest version of NarsilTriple, but in Narsil it's correct.

I wrote a timing test loop to test/confirm this. NarsilTriple is slow in all delays by 25% - programmed delays of 10 seconds actually take 12.5 seconds. I first noticed it recently when battery status blink outs were noticeably slower on some of my lights, then traced it down to this.

I posted bout it here: https://budgetlightforum.com/t/-/32545/1348, but no one responded to this.

Not sure you guys are aware of this, or are having this issue. It's subtle, not easily noticeable.

This is the test code I added - 1 sec on, 1sec off loop:

   //----------------------------------
   // Timing Test
   //----------------------------------
   while (1)
   {
      if (rampState != 0)
         break;
  TurnOnBoardLed(1);
  
  if ((onboardLedEnable == 0) || (twoDigLedOnly == 0))
     SetOutput(BLINK_BRIGHTNESS);
  
  _delay_ms(1000);
  
  TurnOnBoardLed(0);

  SetOutput(0,0,0);
  _delay_ms(1000);
  
  if (rampState != 0)
     break;

}

So made some progress on merging Narsil 2 channel and 3 channel, so I have one source code base now with a header file called setups.h. In setups.h, you define all the board configuration settings and other compile time user option settings.

It's compiling now for 2 channel and 3 channel, with indicator LED enabled or disabled, and using R1/R2 or internal V1.1 ref for voltage monitoring.

Totally untested, but it compiles.

Next to do is actually try it...

Some Details:

It has the more advanced, simplified version of the configuration settings UI that's in the 2 channel latest version of Narsil, v1.3. One new feature is ability to set the temperature threshold for thermal stepdown. There's probably a couple more tweaks as well in LVP and thermal stepdown, results from more recent testing.

Testing will take some time - may need to actually build up a couple boards, etc.

Very nice, I was hoping this would happen.

Thanks! TK responded about the BOGOMIPS setting, and she sees it's been wrong. Said she just corrected it, updated in the source code control repository.

Got it working well on a triple. I'm calling it NarsilM for multi-channel. Below is the setups.h file that has all the settings.

Currently you can't have the combo of: 3 channels, R1/R2 voltage reading, and an Indicator LED. If you do, it will give you a nice warning message and not compile.

This is the test:

#if OUT_CHANNELS == 3
 #ifdef VOLT_MON_R1R2
  #ifdef ONBOARD_LED
   #error SETUPS.H ERROR - Cannot set both R1/R2 voltage monitoring and Onboard LED for 3 channels!!
  #endif
 #endif
#endif
/****************************************************************************************
 * Setups.h
 * ========
 *
 * Created: 4/30/2017 9:27:32 AM
 *  Author: Tom E
 ****************************************************************************************/
#ifndef SETTINGS_H_
#define SETTINGS_H_

//------------- Driver Board Settings -------------------------------------
//
#define OUT_CHANNELS 3 // define the output channels as 1, 2 or 3

#define VOLTAGE_MON // Comment out to disable - ramp down and eventual shutoff when battery is low
//#define VOLT_MON_R1R2 // uses external R1/R2 voltage divider, comment out for 1.1V internal ref

// For voltage monitoring on pin #7, only uncomment one of the two def's below:
//#define USING_220K // for using the 220K resistor
#define USING_360K // for using a 360K resistor (LDO and 2S cells)

#define D1_DIODE 2 // Drop over rev. polarity protection diode: 0.2V normally, 0.3V for Q8

// For 2 channel (FET+1) boards:
//#define USING_3807135_BANK // (default OFF) sets up ramping for 380 mA 7135's instead of a FET

// For 3 channel (triple) boards:
//#define TRIPLE_3_7135 // Configure for 3 7135's
#define TRIPLE_8_7135 // Configure for 8 7135's

#define ONBOARD_LED // Enable the LED support

//
//------------- End Driver Board Settings ---------------------------------

#define STARTUP_LIGHT_OFF
#define STARTUP_2BLINKS // enables the powerup/startup two blinks
//#define BLINK_ONLY_IND_LED // blink the Ind. LED, not the main LED for: startup blinks, config settings, Enter/Exit lockout blinks

// Temperature monitoring setup
//-----------------------------
// Temperature Calibration Offset -
#define TEMP_CAL_OFFSET (-11)
// -2 try for the Manker U21 (LJ)
// -2 works for the Warsun X60 (robo) using the 17 mm DEL driver
// -1 try this for proto #1, OSHPark BLF Q8 driver
// 3 about right for BLF Q8 proto #2 and #3, reads ~20 for ~68F (18C)
// -12 this is about right on the DEL DDm-L4 board in the UranusFire C818 light
// -11 On the TA22 board in SupFire M2-Z, it's bout 11-12C too high,reads 35C at room temp, 23C=73.4F
// -8 For the Manker U11 - at -11, reads 18C at 71F room temp (22C)
// -2 For the Lumintop SD26 - at -2, reading a solid 19C-20C (66.2F-68F for 67F room temp)

#define DEFAULT_STEPDOWN_TEMP (54) // default for stepdown temperature (50C=122F, 55C=131F)
// use 50C for smaller size hosts, or a more conservative level (SD26, U11, etc.)
// use 55C to 60C for larger size hosts, maybe C8 and above, or for a more aggressive setting

#define TEMP_ADJ_PERIOD 2812 // Over Temp adjustment frequency: 45 secs (in 16 msec ticks)
//-----------------------------

#define RAMPING_REVERSE // (default ON) reverses ramping direction for every click&hold

#define RAMP_SWITCH_TIMEOUT 75 // make the up/dn ramp switch timeout 1.2 secs (same as IDLE_TIME)

//#define ADV_RAMP_OPTIONS // In ramping, enables "mode set" additional method for lock-out and battery voltage display, comment out to disable

#define TRIPLE_CLICK_BATT // enable a triple-click to display Battery status

#define SHORT_CLICK_DUR 18 // Short click max duration - for 0.288 secs
#define RAMP_MOON_PAUSE 23 // this results in a 0.368 sec delay, paused in moon mode

// ----- 2/14 TE: One-Click Turn OFF option --------------------------------------------
#define IDLE_TIME 75 // make the time-out 1.2 seconds (Comment out to disable)

// Switch handling:
#define LONG_PRESS_DUR 24 // Prev Mode time - long press, 24=0.384s (1/3s: too fast, 0.5s: too slow)
#define XLONG_PRESS_DUR 68 // strobe mode entry hold time - 68=1.09s (any slower it can happen unintentionally too much)
#define CONFIG_ENTER_DUR 160 // Config mode entry hold time - 160=2.5s, 128=2s

#define LOCK_OUT_TICKS 14 // fast click time for enable/disable of Lock-Out, batt check,
// and double/triple click timing (14=0.224s, was 16=0.256s)

#ifndef VOLT_MON_R1R2
#define BATT_LOW 30 // Cell voltage to step light down = 3.0 V
#define BATT_CRIT 28 // Cell voltage to shut the light off = 2.8 V
#endif

#define ADC_DELAY 312 // Delay in ticks between low-batt ramp-downs (312=5secs, was 250=4secs)

#define BATT_CHECK_MODE 80
#define TEMP_CHECK_MODE 81
#define FIRM_VERS_MODE 82
#define SPECIAL_MODES 90 // base/lowest value for special modes
#define STROBE_MODE SPECIAL_MODES+1
//#define RANDOM_STROBE SPECIAL_MODES+2 // not used for now…
#define POLICE_STROBE SPECIAL_MODES+2
#define BIKING_STROBE SPECIAL_MODES+3
#define BEACON_2S_MODE SPECIAL_MODES+4
#define BEACON_10S_MODE SPECIAL_MODES+5

// Custom define your blinky mode set here:
#define SPECIAL_MODES_SET STROBE_MODE, POLICE_STROBE, BIKING_STROBE, BEACON_2S_MODE, BEACON_10S_MODE
//#define SPECIAL_MODES_SET STROBE_MODE, POLICE_STROBE, BEACON_2S_MODE, BEACON_10S_MODE

#endif /* SETTINGS_H_ */

So basically, for the 3 channel Narsil, you can use the same user manual as the latest BLF Q8 manual here:

PDF format: BLF Q8 V1.3a Manual on google drive

You changed low voltage to 3.0-2.8V, in manual it states still 3.2V ramp down

The comments on startup blinks / no light / turbo are not indicating all 3 options availiable

As well startup to moon mode or last memorized mode would be nice to have

You did put timed and thermal stepdown in one configuration point,
I think this is a stepback, having temperature protection lus a timed stepdown has its purpose on small triples
Also the 30s stepdown is missing was useful for small triples and quads

Ok, then don't use it. Sorry I spent all this time which I thought would help you out and resulted in nothing but disappointment..

I don't know what else to say in responding to this.

I really like that new setup. pretty easy to understand and figure out and allows the same firmware to be used for multiple setups.

I think it is great!

Why do you think I am disappointed, there was no offence in my post I just pointed out some points that were changed or could be optimized?

I just noticed some minor inconsistences in the new manual compared to the old and new firmware.

First is you changed the low Voltage levels but its still the old ones in manual, easy to fix this.

The Thermal and timed stepdown got put in one point, my opinion is that it reduced the options people may need for small triples.
30s and other turbo timeouts got removed or changed.
Add here turbo timer plus thermal protection would be a great improvement

When I build those drivers people that bought them asked me for an option that the light can come up at moon or last memorized mode,
atm there are no blinks, 2 blinks and turbo availiable, add here one or 2 options would improve the drivers UI with dual switch lights like Convoy L6.

Not sure if the advanced setting in v1.4 could give mode memory on power on.
If it was that way why not implement this in the config file as switch that can be compiled in
6 Power switch modes w/mem: 1=disable, 2=enable 1

I just put a TA driver running Narsil in a Skilhunt H02 what a great driver.

Thank you so much for making this available TA, my hat’s off to you sir :face_with_monocle: