Home        Store        Docs        Blog

Firmware modifications


(Alexander) #1

Hello, All. I have a question regarding customizing the Blue ESC firmware. Specifically, the way the ESC controls the motor speed and rotation direction as a function of the PWM input. As currently written, the motor is stationary at 50% throttle, spins one way from 0-50% throttle (with 0% being full speed) and the other way from 50% to 100% throttle. I would like to modify this portion of the firmware for a different throttle response.

In looking over the BlueESC zip folder, I see the compiled .hex files for the BlueESC firmware as well as the bluesc.inc source code. The same folder has source code for a variety of other firmware options. The bluesc.inc file contains only hardware-specific port definition. In what file is the “meat” of the firmware hidden?

Or, in other words, what .inc files are required to compile blueesc_id0.hex?

Cheers & thank you in advance for the help, -Alex

 


(Rusty) #2

Alex,

The “meat” of the motor controller code is in tgy.asm. There are a bunch of defined options in there that you can use to control behavior easily.

Once modifying it, you can compile with make blueesc.hex. You’ll need avra installed.

How do you want the throttle to behave?

-Rusty


(Alexander) #3

Hello again, Rusty - and thank you for the quick reply. I’ve looked through tgy.asm, and installed the AVRA compiler.

I’d like to use a hardware switch for rotation direction, and program the throttle for 0%=full stop, 100% = full throttle. It looks like the “RC_PULS_REVERSE” parameter sets the throttle type (forward & reverse, or single direction), and the parameter “MOTOR_REVERSE” determines that direction.

Since there are no unused I/O pins, I’m using a switch to change the value of the high side resistor used in the temp sense circuit - it’s a bit of a hack, designed to work like so:

#Calculate the temperature assuming the stock, 3.3k high-side resistor value.

#If calculated temp is higher than feasible (>200C), resistor value has been switched to 100 ohm, indicating CCW rotation is desired.

#Re-calculate temp, set rotation direction accordingly.

if (temp > 200):

temp = temp - 150

rotation = CCW

else:

rotation = CW

If you have an idea of what section of tgy.asm to change, please let me know. I’ll figure it out eventually, but it may come at the expense of smoking several hand-assembled boards. I don’t expect the actual code, of course - you’ve been more than helpful already!

Cheers, -Alex

 

 

 


(Rusty) #4

Alex,

Okay. I’m not familiar enough with the code to know exactly where to put it but I would probably aim for the section where the input is scaled to full range.

Instead of risking smoking your boards, you should use a current-limited power supply! Or, cheaper, put a 12V light bulb in series with the ESC and it will limit current to an amp or so.

-Rusty