Alternative ESC firmware (reflashing)

Grifo
Posts: 3
Joined: Tue May 21, 2013 11:31 am

Re: Alternative ESC firmware (reflashing)

Post by Grifo »

Hi all,

I have MT3506 motor with F-30 Hobbyking esc reflashed with MWii firmware.
Why so many people remove BEMF capacitors? What's the benefit?
...because I also read about people that don't take care about this, there is some issues?

Thanks
Grifo

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Alternative ESC firmware (reflashing)

Post by Gimbal »

Q: I did notice on an MT3506 and a Turnigy/Keda 2213 1050KV motor that the throttle seems to have some bumps, with either normal or complementary PWM.¶

I would guess you have BEMF filter caps still in place. It does not like them any more


http://code.google.com/p/wii-esc/wiki/WiiESCv20FAQ

sorg
Posts: 34
Joined: Mon Apr 08, 2013 2:49 pm

Re: Alternative ESC firmware (reflashing)

Post by sorg »

Hi!

I just flashed my rctimer 20A (simonk version) to wii-esc.

The process went fine. I just tested the quad on a jig for the moment, but I already feel a smoother behaviour.
However, I have the feeling that the motors are louser than with simonk. (there is a treeble sound, like a whistle) that was not there before.

Is that normal ?

sorg
Posts: 34
Joined: Mon Apr 08, 2013 2:49 pm

Re: Alternative ESC firmware (reflashing)

Post by sorg »

Further to my first test yesterday, I ran today additional test on my bench.
- I noticed than the max throttle is significantly lower than with simonk. (for my test bench i use a computer PSU wich is very current limited, and usually i trigger the PSU safety at 60% of the throttle. With the Wii-ESC firmware, i have never triggered the safety,even at fullthrottle. I understand that wii-esc has a better efficiency but I doubt it is the only reason.
After further investigation, i have the feeling that this is related to the multiwii PID settings: With wii-esc I am able to have higher settings and the gyro mode is rock stable. however, when i look at the throttle output of each motor (in multiwiiconf) it vary a lot (typically between 1200 and 2000 at full throttle),wich is normal with high PID settings, but this means that theaverage throttle is not as high as when i set a lower P.
Not sure if I am clear and if you noticed the same.

- I have not removed the "BEMF capacitors". Is that necessary ?
Where are they on my ESC?
http://mk1.ti1ca.com/lw5gerfy-1024.jpg

sim
Posts: 18
Joined: Tue Oct 18, 2011 11:40 pm

Re: Alternative ESC firmware (reflashing)

Post by sim »

sorg wrote:I just flashed my rctimer 20A (simonk version) to wii-esc.

The process went fine. I just tested the quad on a jig for the moment, but I already feel a smoother behaviour.
However, I have the feeling that the motors are louser than with simonk. (there is a treeble sound, like a whistle) that was not there before.

Is that normal ?

Hi! Yes, this is normal, as wii-esc is using SDM modulation instead of a fixed frequency.

sorg wrote:- I have not removed the "BEMF capacitors". Is that necessary ?
Where are they on my ESC?
http://mk1.ti1ca.com/lw5gerfy-1024.jpg

Not sure about your first question, as the endpoints should be the same unless you have set them differently. The RCTimer ESCs (and pretty much anything other than BlueSeries/Mystery/F-series) don't have any sense filtering capacitors, so nothing to remove.

sorg
Posts: 34
Joined: Mon Apr 08, 2013 2:49 pm

Re: Alternative ESC firmware (reflashing)

Post by sorg »

sim wrote:Not sure about your first question, as the endpoints should be the same unless you have set them differently.



Thank you for your answers.

I have definitly less power with wii-esc than with simonk firmware.
I am not able to tak-off anymore.
My settings, are correct, i think:

Code: Select all

#define MINTHROTTLE 1088 
#define MAXTHROTTLE 2008
#define MINCOMMAND  1008
#define EXT_MOTOR_RANGE


I have flashed with the wi--esc firmware with extended range eeprom settings.

Zenman
Posts: 7
Joined: Tue Jul 16, 2013 4:46 pm

Re: Alternative ESC firmware (reflashing)

Post by Zenman »

In the Configuration Editor does selecting "Enable Braking" activate Complimentary pwm for bs_nfet.hex or is it already anabled by default and this is an entirely different type of breaking? I'm trying Wii Esc for the first time and I'm very happy with it so far, I'm just not sure if complimentary pwm is active.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

Zenman wrote:In the Configuration Editor does selecting "Enable Braking" activate Complimentary pwm for bs_nfet.hex or is it already anabled by default and this is an entirely different type of breaking? I'm trying Wii Esc for the first time and I'm very happy with it so far, I'm just not sure if complimentary pwm is active.

AFAIK if you flash your ESC with appropriate flash COMP_PWM will be active (breaking means actual breaking to stop prop in the air when TH is on zero).

Regards
Andrej

antslake
Posts: 11
Joined: Sat Jun 08, 2013 6:17 am

Re: Alternative ESC firmware (reflashing)

Post by antslake »

Hello, I am interested in flashing some RCX 10A ESC's with the Wii Esc. These are the same as RCTimer, so I believe it will work. In the RApid Esc database, these Esc's have a note saying that the MCU gets corrupt at high currents. Well a bunch of us have been toasting our Esc's and we are trying to figure out the cause. I haven't been going over the rating, so we are not sure why.

Your thoughts?

Also, what is a configuration editor, and do I need to mess with any settings before I flash?
Anthony

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Alternative ESC firmware (reflashing)

Post by crashlander »

I'm trying to repurpose burned ESC and would like to know where to access individual Atmega ports, without actually soldering on its pins/legs? My special interest is in HobiKing F-20A and Turnigy TY-P1 (have couple of them).
I need serial TX/RX pins and some other digital I/O pins.

Best Regards
Andrej

raulmd
Posts: 23
Joined: Mon Sep 09, 2013 1:47 pm

Re: Alternative ESC firmware (reflashing)

Post by raulmd »

I am interested in loading wii-esc in Afro ESC 30A.

The fact is that I am having problems with Afro + Simonk + D3530-14 motors.

There is not a HAL for this ESC, but based on Simonk HAL, a wii-esc HAL is quite easy. I have created one, but it is not tested.

Can anyone take a look at the code and tell me if it's ok?

Thanks

Code: Select all

#ifndef _BS_NFET_H_
#define _BS_NFET_H_

//*********************
// PORT B definitions *
//*********************
#define DbgLED          5
#define DbgStr          4
#define CnFET           0
#define PORTB_INIT      0
#define PORTB_DD        (1<<CnFET)+(1<<DbgLED)+(1<<DbgStr)
#define BRAKE_PB        (1<<CnFET)

inline void DebugLEDOn()     {PORTB |= _BV(DbgLED);}
inline void DebugLEDOff()    {PORTB &= ~_BV(DbgLED);}
inline void DebugLEDToggle() {PORTB ^= _BV(DbgLED);}

inline void DebugStrOn()     {PORTB |= _BV(DbgStr);}
inline void DebugStrOff()    {PORTB &= ~_BV(DbgStr);}
inline void DebugStrToggle() {PORTB ^= _BV(DbgStr);}

//*********************
// PORT C definitions *
//*********************
#define AnRef           1
#define CpFET           3
#define BnFET           4
#define BpFET           5
#define PORTC_INIT      (1<<AnRef)+(1<<CpFET)+(1<<BpFET)
#define PORTC_DD        (1<<AnRef)+(1<<CpFET)+(1<<BnFET)+(1<<BpFET)
#define BRAKE_PC        (1<<BnFET)

//*********************
// PORT D definitions *
//*********************
#define c_comp          6
#define AnFET           5
#define ApFET           4
#define rcp_in          2
#define PORTD_INIT      (1<<ApFET)
#define PORTD_DD        (1<<ApFET)+(1<<AnFET)
#define BRAKE_PD        (1<<AnFET)


inline void ApFETOn()  {PORTD &= ~_BV(ApFET);}
inline void ApFETOff() {PORTD |=  _BV(ApFET);}
inline void AnFETOn()  {PORTD |=  _BV(AnFET);}
inline void AnFETOff() {PORTD &= ~_BV(AnFET);}

inline void BpFETOn()  {PORTC &= ~_BV(BpFET);}
inline void BpFETOff() {PORTC |=  _BV(BpFET);}
inline void BnFETOn()  {PORTC |=  _BV(BnFET);}
inline void BnFETOff() {PORTC &= ~_BV(BnFET);}

inline void CpFETOn()  {PORTC &= ~_BV(CpFET);}
inline void CpFETOff() {PORTC |=  _BV(CpFET);}
inline void CnFETOn()  {PORTB |=  _BV(CnFET);}
inline void CnFETOff() {PORTB &= ~_BV(CnFET);}

#define mux_c           0
#define mux_a           6
#define mux_b           7

inline void ACInit() {
  ACMultiplexed();
  ACSR |= _BV(ACIC);
}

inline void ACPhaseA() {
   ACChannel(mux_a);
}

inline void ACPhaseB() {
   ACChannel(mux_b);
}

inline void ACPhaseC() {
   ACChannel(mux_c);
};

//#define BEMF_FILTER_DELAY_US 22

void Board_Idle() {
};

inline void Board_Init() {
  TIMSK = 0;
  // Timer1
  TCCR1A = 0;
  TCCR1B = _BV(CS11);                 /* div 8 clock prescaler */
  PORTB = PORTB_INIT; DDRB = PORTB_DD;
  PORTC = PORTC_INIT; DDRC = PORTC_DD;
  PORTD = PORTD_INIT; DDRD = PORTD_DD;

  ACInit();
}

#endif // _BS_NFET_H_

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi raulmd,
Do you have schematic for this esc?

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

Hi!
First time posting in this forum.
I recently bought the RCTimer 30A and 45A ESC to flash with wii-esc. I have used wii-esc with good results on the RCTimer 20A before.
Of course these new ESC doesnt map with any old files, seems to be new designs so I started to make .inc for SimonK for them.
https://github.com/vizual54/tgy
rct30nfs.inc and rct45nfs.inc
I have only tested them on the bench so far and it seem like they work great for that particular motor.

I then started making a hw file for the rct30nfs for wii-esc but soon noticed that wii-esc doesnt have a implementation for having the RC input on ICP1 (PB0).
I will try to make one later on but first I wanted to get the rct45nfs to work with wii-esc.
Though it seems like I need some help translating the SimonK .inc file to wii-esc. Right now the esc only beeps once and then when I apply some throttle it just twitches a little and then the current limiter kicks in.
The .inc file for SimonK looks like this:

Code: Select all

;***************************************************************
;* For RCTimer NFS 45A all n-Channel FETs                   *
;* Original fuses are -U lfuse:w:0x2F:m -U hfuse:w:0xCA:m      *
;* By Nils Högberg                                       *
;*                                                              *
;* https://github.com/sim-/tgy                                 *
;***************************************************************

.equ        F_CPU                = 16000000
.equ        USE_INT0            = 1
.equ        USE_I2C              = 0
.equ        USE_UART            = 0
.equ        USE_ICP              = 0
.equ        MOTOR_ADVANCE        = 18      ; Degrees of timing advance (0 - 30, 30 meaning no delay)
.equ        TIMING_OFFSET        = 0

;*********************
; PORT D definitions *
;*********************
;.equ                            = 7        ; AIN1
.equ        c_comp               = 6        ; AIN0
.equ        ApFET                = 5
.equ        BpFET                = 4
.equ        CpFET                = 3
.equ        rcp_in               = 2        ; r/c pulse input
;.equ        txd                  = 1
;.equ        rxd                  = 0

.equ        INIT_PD              = 0
.equ        DIR_PD               = (1<<ApFET)+(1<<BpFET)+(1<<CpFET)

.equ        ApFET_port           = PORTD
.equ        BpFET_port           = PORTD
.equ        CpFET_port           = PORTD

;*********************
; PORT C definitions *
;*********************
;.equ                            = 7        ; ADC7
;.equ                            = 6        ; RESET
.equ        mux_a                = 5        ; ADC5
.equ        mux_b                = 4        ; ADC4
;.equ                            = 3        ; ADC3
;.equ                            = 2        ; ADC2
.equ        mux_temperature      = 1        ; ADC1 temperature input (897 from +5V, ?k NTC to gnd at ADC1)
.equ        mux_voltage          = 0        ; ADC0 voltage input (220 from Vbat, 39 to gnd, ?V -> ?V at ADC2)



.equ        O_POWER              = 10
.equ        O_GROUND             = 1

.equ        INIT_PC              = 0
.equ        DIR_PC               = 0

;*********************
; PORT B definitions *
;*********************
;.equ                            = 5        ; SCK
;.equ                            = 4        ; MISO
;.equ                            = 3        ; MOSI
.equ        AnFET                = 2
.equ        BnFET                = 1
.equ        CnFET                = 0

.equ        INIT_PB              = 0
.equ        DIR_PB               = (1<<AnFET)+(1<<BnFET)+(1<<CnFET)

.equ        AnFET_port           = PORTB
.equ        BnFET_port           = PORTB
.equ        CnFET_port           = PORTB

.MACRO RED_on
.ENDMACRO
.MACRO RED_off
.ENDMACRO
.MACRO GRN_on
.ENDMACRO
.MACRO GRN_off
.ENDMACRO


This is what the rct45nfs.h looks like right now:

Code: Select all

//***************************************************************
//* For RCTimer NFS 45A all n-Channel FETs                      *
//* Original fuses are -U lfuse:w:0x2F:m -U hfuse:w:0xCA:m      *
//* By Nils Högberg                                             *
//***************************************************************

#ifndef _RCT45NFS_H_
#define _RCT45NFS_H_

//*********************
// PORT B definitions *
//*********************
//#define DbgLED          5
//#define DbgStr          4
#define AnFET           2
#define BnFET           1
#define CnFET           0

#define PORTB_INIT      0
#define PORTB_DD        (1<<AnFET)+(1<<BnFET)+(1<<CnFET)
#define BRAKE_PB        0

inline void DebugLEDOn()     {PORTB |= _BV(DbgLED);}
inline void DebugLEDOff()    {PORTB &= ~_BV(DbgLED);}
inline void DebugLEDToggle() {PORTB ^= _BV(DbgLED);}

inline void DebugStrOn()     {PORTB |= _BV(DbgStr);}
inline void DebugStrOff()    {PORTB &= ~_BV(DbgStr);}
inline void DebugStrToggle() {PORTB ^= _BV(DbgStr);}

//*********************
// PORT C definitions *
//*********************
#define AnRef           0

#define PORTC_INIT      0
#define PORTC_DD        0
#define BRAKE_PC        0

//*********************
// PORT D definitions *
//*********************
#define c_comp          6
#define ApFET           5
#define BpFET           4
#define CpFET           3
#define rcp_in          2

#define PORTD_INIT      0
#define PORTD_DD        (1<<ApFET)+(1<<BpFET)+(1<<CpFET)
#define BRAKE_PD        0


inline void ApFETOn()  {PORTD |=  _BV(ApFET);}
inline void ApFETOff() {PORTD &= ~_BV(ApFET);}
inline void AnFETOn()  {PORTB |=  _BV(AnFET);}
inline void AnFETOff() {PORTB &= ~_BV(AnFET);}

inline void BpFETOn()  {PORTC |=  _BV(BpFET);}
inline void BpFETOff() {PORTC &= ~_BV(BpFET);}
inline void BnFETOn()  {PORTC |=  _BV(BnFET);}
inline void BnFETOff() {PORTC &= ~_BV(BnFET);}

inline void CpFETOn()  {PORTC |=  _BV(CpFET);}
inline void CpFETOff() {PORTC &= ~_BV(CpFET);}
inline void CnFETOn()  {PORTD |=  _BV(CnFET);}
inline void CnFETOff() {PORTD &= ~_BV(CnFET);}

#define mux_a           5
#define mux_b           4

inline void ACInit() {
  ACMultiplexed();
  ACSR |= _BV(ACIC);
}

inline void ACPhaseA() {
   ACChannel(mux_a);
   ACMultiplexed();
}

inline void ACPhaseB() {
   ACChannel(mux_b);
   ACMultiplexed();
}

inline void ACPhaseC() {
   ACNormal();
}

//#define BEMF_FILTER_DELAY_US 22

void Board_Idle() {
};

inline void Board_Init() {
  TIMSK = 0;
  // Timer1
  TCCR1A = 0;
  TCCR1B = _BV(CS11);                 /* div 8 clock prescaler */
  PORTB = PORTB_INIT; DDRB = PORTB_DD;
  PORTC = PORTC_INIT; DDRC = PORTC_DD;
  PORTD = PORTD_INIT; DDRD = PORTD_DD;

  ACInit();
}

#endif // _RCT45NFS_H_


I would really appreciate if some could have a look and see if I have made any obvious mistake.

Here are images of the esc:
http://static.rcgroups.net/forums/attachments/4/6/3/6/8/5/a6395378-136-uploadfromtaptalk1389127783594.jpg
http://static.rcgroups.net/forums/attachments/4/6/3/6/8/5/a6395386-172-uploadfromtaptalk1389127807055.jpg

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,

..On() ..Off() macroses was using wrong ports..

Code: Select all

//***************************************************************
//* For RCTimer NFS 45A all n-Channel FETs                      *
//* Original fuses are -U lfuse:w:0x2F:m -U hfuse:w:0xCA:m      *
//* By Nils Hogberg                                             *
//***************************************************************

#ifndef _RCT45NFS_H_
#define _RCT45NFS_H_

//*********************
// PORT B definitions *
//*********************
#define DbgLED          5
#define DbgStr          4
#define AnFET           2
#define BnFET           1
#define CnFET           0

#define PORTB_INIT      0
#define PORTB_DD        _BV(AnFET) | _BV(BnFET) | _BV(CnFET) | _BV(DbgLED) | _BV(DbgStr)
#define BRAKE_PB        0

inline void DebugLEDOn()     {PORTB |= _BV(DbgLED);}
inline void DebugLEDOff()    {PORTB &= ~_BV(DbgLED);}
inline void DebugLEDToggle() {PORTB ^= _BV(DbgLED);}

inline void DebugStrOn()     {PORTB |= _BV(DbgStr);}
inline void DebugStrOff()    {PORTB &= ~_BV(DbgStr);}
inline void DebugStrToggle() {PORTB ^= _BV(DbgStr);}

//*********************
// PORT C definitions *
//*********************

#define PORTC_INIT      0
#define PORTC_DD        0
#define BRAKE_PC        0

//*********************
// PORT D definitions *
//*********************
#define c_comp          6
#define ApFET           5
#define BpFET           4
#define CpFET           3
#define rcp_in          2

#define PORTD_INIT      0
#define PORTD_DD        _BV(ApFET) | _BV(BpFET) | _BV(CpFET)
#define BRAKE_PD        0


inline void ApFETOn()  {PORTD |=  _BV(ApFET);}
inline void ApFETOff() {PORTD &= ~_BV(ApFET);}
inline void AnFETOn()  {PORTB |=  _BV(AnFET);}
inline void AnFETOff() {PORTB &= ~_BV(AnFET);}

inline void BpFETOn()  {PORTD |=  _BV(BpFET);}
inline void BpFETOff() {PORTD &= ~_BV(BpFET);}
inline void BnFETOn()  {PORTB |=  _BV(BnFET);}
inline void BnFETOff() {PORTB &= ~_BV(BnFET);}

inline void CpFETOn()  {PORTD |=  _BV(CpFET);}
inline void CpFETOff() {PORTD &= ~_BV(CpFET);}
inline void CnFETOn()  {PORTB |=  _BV(CnFET);}
inline void CnFETOff() {PORTB &= ~_BV(CnFET);}

#define mux_a           5
#define mux_b           4

inline void ACInit() {
  //ACMultiplexed();
  //ACSR |= _BV(ACIC);
}

inline void ACPhaseA() {
   ACChannel(mux_a);
   ACMultiplexed();
}

inline void ACPhaseB() {
   ACChannel(mux_b);
   ACMultiplexed();
}

inline void ACPhaseC() {
   ACNormal();
}

//#define BEMF_FILTER_DELAY_US 22

void Board_Idle() {
};

inline void Board_Init() {
  OSCCAL = 0xFF;
  TIMSK = 0;
  // Timer1
  TCCR1A = 0;
  TCCR1B = _BV(CS11);                 /* div 8 clock prescaler */
  PORTB = PORTB_INIT; DDRB = PORTB_DD;
  PORTC = PORTC_INIT; DDRC = PORTC_DD;
  PORTD = PORTD_INIT; DDRD = PORTD_DD;

  ACInit();
}

#endif // _RCT45NFS_H_

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

ziss_dm wrote:Hi,

..On() ..Off() macroses was using wrong ports..


Doh!! I must have been really tired yesterday night :)
Thank you!
Now it seems to be working, have not tried with prop on yet.

Build target for the RCTimer 45A NFS can be found here (NOT TESTED):
https://github.com/vizual54/wii-esc/tree/master/src/hal

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Randulf,

Could you please test it? ;) In case it works, I'll include it to the "trunk"

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

ziss_dm wrote:Hi Randulf,

Could you please test it? ;) In case it works, I'll include it to the "trunk"


Absolutely, I just need to build a rig first so I can run it safely with prop on. I'll net you know as soon as I have it set up and done tests.

Tested with comp_pwm enabled yesterday and that seems also to be working (only motor, no prop).

About the RCTimer 30A NFS.
It has rc_in on ICP1 an I have started trying to implement support for this. Though I have never programmed microcontrollers except a little arduino and don't really know how I should do this.
I think it should look something like this. Do you think you can have a look at it?

Code: Select all

#if (rcp_in == 0)
#define ICP PINB0
ISR(TIMER1_CAPT_vect) {
  uint16_t time = ICR1;
  uint8_t state = (TCCR1B & _BV(ICES1));
  if (state)
  {
    TCCR1B &= ~_BV(ICES1); // falling edge trigger
  }
  else
  {
    TCCR1B |= _BV(ICES1); // rising edge trigger
  }
  TIFR = (1 << ICF1); // Clear input capture flag
  rx_ppm_callback(time, state);
}

inline void AttachPPM() {
  PORTB |= (1 << ICP); // Pullup enabled
  DDRB &= ~(1 << ICP); // Set as input
  TCCR1B |= (1 << ICNC1) | (1 << ICES1); // Noise cancel, rising edge trigger
  TIMSK |= (1 << TICIE1) | (1 << TOIE1); // Timer input capture interrupt enable, overflow enable
  TIFR = (1 << ICF1); // Clear input capture flag
}
#endif

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,
You can take a look here:
https://code.google.com/p/wii-esc/sourc ... 32u4_int.h

Just adjust to atmega8.


Which you pretty much did. :)

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi Randulf,
Why you enabling Overflow interrupt?

Code: Select all

 TIMSK |= (1 << TICIE1) | (1 << TOIE1); // Timer input capture interrupt enable, overflow enable


There are no handler for it..

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

ziss_dm wrote:Hi Randulf,
Why you enabling Overflow interrupt?

Code: Select all

 TIMSK |= (1 << TICIE1) | (1 << TOIE1); // Timer input capture interrupt enable, overflow enable


There are no handler for it..


Good point!
I guess the foremost reason to why it was enabled was that I don't know what I'm doing and copy paste from internet :D
Now it looks like the a32u4_int.h file you pointed to.

Tested it last night but it didn't work. No startup sound.
Could that be because of the enabled overflow interrupt? Feels like it shouldn't matter if its enabled but doesn't have handler, just that nothing happens when it interrupts.

I think I have the build target correct now the RCTimer 30A NFS. Here is my SimonK file:
https://github.com/vizual54/tgy/blob/ma ... t30nfs.inc

Here is the wii-esc build target and the m8_int file:
https://github.com/vizual54/wii-esc/blo ... rct30nfs.h
https://github.com/vizual54/wii-esc/blo ... l/m8_int.h

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,
With avr-gcc default handler is "bad_interrupt" which is infinite loop. :)

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

Tested the RCTimer 45A NFS ESC today with RCTimer 5010-14 360KV, 16x55 prop an 4s.
It struggles a little bit just when starting but then it worked really well. I could not make it loose sync.

Also did some more testing with the rct30nfs.
Now I get the startup beeps but not the arming beep but hangs on check_for_stick_cal();
Must be something wrong the interrupt.
Measured the output to the FETs and all is correct except for BpFET which is 0v. BpFET is connected to INT1 (PD3).

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hi,
Maybe input inverted?

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

No, I'm pretty shure it's not. I have it working on SimonK using this build target: https://github.com/vizual54/tgy/blob/ma ... t30nfs.inc

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Hmm.. That would be easiest explanation.. ;( But anyway, you can quickly try inverted capture:

Code: Select all

ISR(TIMER1_CAPT_vect) {
  uint16_t time = ICR1;
  uint8_t state = (TCCR1B & _BV(ICES1));
  if (state) TCCR1B &= ~_BV(ICES1); else TCCR1B |= _BV(ICES1);
  TIFR = _BV(ICF1);
  rx_ppm_callback(time, !state);
}

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

BTW: Looks like I have found problem. You need to change this:

Code: Select all

inline void Board_Init() {
  TIMSK = 0;
  // Timer1
  TCCR1A = 0;
  TCCR1B |= _BV(CS11);                 /* div 8 clock prescaler */
  PORTB = PORTB_INIT; DDRB = PORTB_DD;
  PORTC = PORTC_INIT; DDRC = PORTC_DD;
  PORTD = PORTD_INIT; DDRD = PORTD_DD;

  ACInit();
}


to this:

Code: Select all

inline void Board_Init() {
  TIMSK = 0;
  // Timer1
  TCCR1A = 0;
  TCCR1B = _BV(CS11);                 /* div 8 clock prescaler */
  PORTB = PORTB_INIT; DDRB = PORTB_DD;
  PORTC = PORTC_INIT; DDRC = PORTC_DD;
  PORTD = PORTD_INIT; DDRD = PORTD_DD;

  ACInit();
}


By default arduino startup initializes Timer1 to the PWM mode, in which using ICP not possible.

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

Unfortunately neither inverting the capture or setting TCCR1B to only CS11 worked. I had actually already made change in the Board_Init just to be safe.

Im going to do some more testing tonight, would it be possible to define the beep function i global.h and then place a call to it in the interrupt function to verify that the interrupt is actually working?

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Better connect debug LEDs.. ;)

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

Ok, so I placed a Debug_TraceToggle() in the ISR(TIMER1_CAPT_vect) function.
This makes the debug led light up and the then it seems like it hangs, no startup sounds. I have no idea why it hangs, same thing if I place the Debug_TraceToggle() in the rx_ppm_callback func.
Tested the to toggle the led in some other places as well. And it seems like either rx.frame_received or rx.raw never gets set.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

And if you disconnect PPM input? (no receiver). You can also try to add default handler to all interrupts, to see is there are some firing:

Something like this:

Code: Select all

ISR(BADISR_vect) {
  while (1) {
    DebugLEDToggle();
    __delay_ms(1000);
  }
}

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

I'll try that tonight. I remember reading about it but had forgotten all about it, thanks for reminding me.

I'm really at loss here. Ive been reading the datasheet over and over and looked at various examples on the net, I really think this should work.
Anyway, I'm learning a lot here just wish I had more time each night to sit with it.

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

Finally some progress!
Swapped

Code: Select all

TIFR = _BV(ICF1);
rx_ppm_callback(time, state);

to

Code: Select all

rx_ppm_callback(time, state);
TIFR = _BV(ICF1);

and now it works to toggle the led in the interrupt handler.
The datasheet states that the ICF1 bit will be reset automatically so maybe we can remove it.
Still no arming beep though.
Can't really see any difference in frequency when turning the throttle up and down. But maybe the difference is to small to notice.

Seems like we're not getting past the if ((tmp >= rx.rcp_min) && (tmp <= rx.rcp_max)) in the filter_ppm_data function.
Tested to toggle the led if(tmp >= rx.rcp_min) and that works.
Then tested to toggle the led if(tmp <= rx.rcp_max) and that also worked, whooot!!
Retested this a couple of times with the same result, guess I'm too tired to see why.
Time to go to bed.

edit:
Could temp be 65535 and evaluate to -1 when checking if temp is less or equal to rx.rcp_min?
Thats the only explanation I could think of.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Everything is unsigned, so should not be a case.

Randulf
Posts: 11
Joined: Mon Jan 27, 2014 11:08 pm

Re: Alternative ESC firmware (reflashing)

Post by Randulf »

Yeah I know, now when my head is bit clearer.
Dont really know what I was doing yesterday :D

Anyway its working now. Turns out we enable the Analog Comparator Input Capture Enable bit the build target files:

Code: Select all

ACSR |= _BV(ACIC)

If I understand the data sheet this enables noise canceling for Analog Comparator.
And this is nice as long as we doesn't enable the TICIE1 bit in the TIMSK which makes the Analog Comparator trigger the Input Capture.

Had to enable the serial port and actually print out the pulse values I got until I found this, would have been nice to have a oscope sometimes.

This has been a new experience for me, I have never coded microprocessors before except for some arduino stuff. Always fun to learn new things.
Thanks for all the help, I really appreciate it.

Code is here: https://github.com/vizual54/wii-esc
Changed m8_int.h and rct30nf.h

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: Alternative ESC firmware (reflashing)

Post by ziss_dm »

Oops this is left-over of old attempt to use ICP for the zero-crossing detector. Removed from everywhere, to avoid confusion.
Also commited your targets to the main branch. Tnx. ;)

BTW: I think, it still good idea to clear ICF1 flag after changing sensing polarity, so I left it there.

fpvberlin
Posts: 1
Joined: Sun Apr 27, 2014 5:11 pm

Re: Alternative ESC firmware (reflashing)

Post by fpvberlin »

Hi there,

I flashed an rctimer 45A NFS Opto with the corresponding .hex file.
When I connect the ESC it emits a "1-2-3-4-5" ascending beep squence, when I go on full throttle it adds another long "beeeeep" - but then - nothing.
Motor does not run. (iflight-rc 4110)

Can someone help?

Thank you very much!

Goerge

Norbert1992
Posts: 14
Joined: Thu Oct 24, 2013 12:42 am

Re: Alternative ESC firmware (reflashing)

Post by Norbert1992 »

Hello,
did anyone reflashing into fast pwm Redox 20A esc?
I saw info that i can flash it by skywalker 20a hex but i dont know which one :(

Bob1974
Posts: 1
Joined: Tue Sep 16, 2014 3:56 pm

Re: Alternative ESC firmware (reflashing)

Post by Bob1974 »

@ fpvberlin

I had the same problem as you will my rct45nfs (only armed at full throttle). Turns out that the fuses were incorrect and weren't activating the external 16Mhz oscillator (running 8Mhz internal instead). I couldn't fix it with Wii-ESC Flash Tool v 0.7, but I was able to restore the external clock selection fuses with kkmulticopterflashtool, then programmed the wii-esc rct45nfs.hex and the eeprom config using the Wii-Esc Flash Tool.

I'm not sure how the fuses ended up changed in the first place, but I suspect the Wii-Esc tool did it with its 'optimal fuse' settings?

--Bob

User avatar
Rudi48
Posts: 32
Joined: Mon Sep 19, 2011 10:44 am
Location: Wiesbaden, Germany
Contact:

Re: Alternative ESC firmware (reflashing), HK SS18A

Post by Rudi48 »

Hello,
I have not found any infos for reflashing my hobbyking SuperSimple 18A ESC, see picture.

Fortunately I could find some informations elsewhere, so I could reflash the ESC's with simonK software.

So I have put all my information to a web page, in the hope to help somebody:
http://www.rudiswiki.de/wiki9/QuadrocopterESC

Regards, Rudolf
Attachments
how to connect the ISP
how to connect the ISP
reflashing is possible (Atmega8)
reflashing is possible (Atmega8)

rbirdie001
Posts: 178
Joined: Fri Apr 01, 2011 10:32 pm
Location: Czech Republic, Prague

SimonK ESC's give less power than others?

Post by rbirdie001 »

Hi!
while searching found this old thread so trying to reborn it :-)
I bought on ebay G-SUN 30A ESC's with originally loaded SimonK firmware (unknown version) and I'm disappointed because I'm with it getting much less maximal thrust from my motor/propeller (about 70%) compared to other models (more different ESCs). I remember that the same thing happened few years ago when I reflashed some other 10A ESC's to SimonK - I lost a lot of max. power.
Both ESC types don't have crystal nor resonator by CPU so it can be connected also to this feature...
Have anyone experienced this behaviour? Is it normal, can it be changed?
Thanks for any experience!
Roman

User avatar
Rob
Posts: 77
Joined: Sun Apr 03, 2011 4:40 pm

Re: Alternative ESC firmware (reflashing)

Post by Rob »

This design from 2011 works great with this firmware. I redesigned the PCB and going to make some prototypes.
If there is interest I can publish the design. (after I test the prototypes)

Its a very robust and cheap design on a double sided board.
Al the credits for the good Quality are for ziss_dm !!!!

Image
Image



This was the old design:


Image

Post Reply