Thursday, April 9, 2020

S-Core firmware 0.96 - fix unintended trigger trap when full auto and decelerateBoltToSwitch() (etc.)

This fixes a bug in which

  • firing full auto
  • releasing the trigger momentarily overlapping with a trigger polling event, thus initiating drivetrain deceleration in preparation for firing to end
  • pulling the trigger again during the deceleration

-would incorrectly be trapped by the disconnector and do nothing until the trigger was reset, as if it were a continuing trigger-down state after a burst or semi shot has been fired. This little death slot could be found when thrashing a blaster with "stop and go" type input on full auto. Plenty of players may make inputs like this, including me, under pressure.

Wednesday, April 8, 2020

ESC Project: ACE-LC v2.0 ("ACE 2") - RELEASE and Build Notes


BOM of my exact build (generated by Digikey)

Component list with most generic/second sourcing info

2oz copper is required.

Most everything is quite obvious. However, due to the packing density, the silkscreens tend to be unreadable (at least on my batch of boards) for a lot of the passives. Hence these images may be helpful for quick reference:

Front side has 2 100R gate resistors R7 and R10, the sense network comprising six 18K 0.1% resistors R17-22 and three 3.3K 0.1% resistors R23-25, and 3 MCU decoupling caps C1, C2 and C9.

Note that there is an option for decoupling capacitor C9 if you want to overengineer this by using a 1uF to have a typical wideband decoupling network with caps an order of magnitude apart. I have some 1uF 0805s sitting around so I have been using them there.

Also, watch out for which way those bootstrap diodes are pointing. The topmost one has the cathode pointing up. The other two are pointing down. Similarly when soldering, the back to back anodes are shorted together/the same pad on the top two so it is OK if that is a single solder mass right there, but the pads between the bottom two diodes are not connected, do not let them get bridged.

Another quick note. The low side DC bus where it comes up to the source pins through the vias - the solder mask has been removed here so these vias can be filled in with solder for better thermal/electrical performance. Similarly, on the backside, there is an unmasked strip on that bus trace, you can tin that or put a wire or bar there if you want. And obviously, the motor phase wires go on the 3 pads on the front side without vias. The ones with the vias are just ground.

Back side has logic power and high side gate drivers, the rest of the 100R gate resistors R5, 6, 8 and 9, 10K low side gate pulldown resistors R2-4, 10K RESET pullup resistor R1 and yet ANOTHER MCU decoupling cap C3 (0.1uF).

R11-13 are the ballast resistors in the discrete drive circuit, the ones that need some awareness of power rating. Those should be a 0.4W or other similarly rated part. R14-16 are just base resistors for Q1-3, the only reason they end up being the same part in my design is BOM reuse, the 0.4W 1.6K resistor is cheap enough that it is better/easier/faster to stick them there than add another part.

C8 (1206) in my build is a 47uF tantalum. This is not strictly necessary that it is either 47uF or tantalum as long as you use a LDO that is stable with whatever cap you place there. However, I recommend a high capacitance tant there to be sure about stable vcc. The C7 should be a fairly big ceramic to decouple the LDO such as 4.7uF.

After building, cleaning and inspecting, wire up your AVR ISP device of choice (I use a USBasp) to the ISP pads:

  • Ground is in the throttle cable pads.
  • MOSI is the tach pad in the throttle cable pads.
  • MISO is next to the MCU.
  • RESET is next to the oscillator.
  • SCK is on the backside of the board right under the MCU.
  • VCC is next to the regulator.

And program. Do not use KKMulticopterFlashTool to burn brand new boards, if you have that tool. It will set the fuses incorrectly. Always set the fuses to the recommended values stated clearly in the SimonK source comments using avrdude i.e.:

  • avrdude -p m8 -c usbasp -U lfuse:w:0x3f:m -U hfuse:w:0xca:m

Then flash the firmware (found HERE) and remove ISP connections.

You can use KKMFT to flash after setting the fuses correctly if you like. Also note that the bootloader allows using a USB toolstick such as the Afro or Turnigy ones over the throttle cable once a board has been ISP-ed the first time.

These are a bs_nfet board and any bs_nfet firmware is suitable, but I would strongly recommend you stick with the linked binary or adjust/modify it to your needs. A post about this board and evolutions of my SimonK variant is upcoming which will cover this, but there are a few things to consider:

  • Switching times on these are better than the ACE LC1.
  • The MOSFETs used in these have faster, pseudo-Schottky body diodes (i.e. copack, protection or antiparallel diodes). This seems to make a difference in reliable sensorless performance.
  • I recently realized the existence of loss-localization mechanisms of the single-sided modulation strategy and that there are operating points for any non-complementary PWM situation (low voltage command and high phase current) where diode conduction losses go through the roof and result in unevenly high temp on the high-side devices. I have never cooked anything, but it just isn't necessary. This affects ALL boards, including for instance, Afros. (In the future, I will design all boards with the potential of this occurring with certain firmwares in mind i.e. disproportionate and excessive high-side device heatsinking.)


  • I run these at POWER_RANGE = 856 for stock (nominal 17.8kHz) PWM carrier frequency. They run cool and hold sync robustly and do NOT require the 10kHz that is recommended on commercial hobby ESCs and is default on ACE1 boards. The benefit of this higher frequency is mostly that the carrier is inaudible for most people, whereas the 10kHz can be heard as a distinct PWM whine.
  • The startup mode half-frequency drop is NOT necessary for maximally reliable startup and sync holding on this board in my experience. I have it left in place, but turning it off removes a tiny moment of 8kHz whine when starting up from 0 rpm or while locked-rotor.
  • I have implemented a crude but effective selective complementary PWM mode which enables complementary modulation during all locked-rotor and 0 rpm start cases while being governor-compatible. Doing synchronous rectification during these specific situations greatly reduces, and greatly equalizes, device temps, causing this board to run quite cool under abuse. This is recommended on this board and all previous boards such as Afro.

N.b.: This build supports FlyShot for variable speed applications. It also defaults, for safety purposes, at boot to a governor setting of ~35,000erpm, or ~5000 mechanical rpm with 14 pole motors. If you have a fixed-speed application which doesn't support FlyShot, change the value at line 3351 (high byte) and 3352 (low byte) to the speed setting you want to run at. The governor setting is in TIMING_MAX * 8 format, same as what is sent in FlyShot frames.

Then install the DC link capacitor, DC bus input and motor phase wires and a signal cable. Here is a typical assembled unit:

Shrinkwrap this, ideally with PVC or PET shrink film tube (battery pack wrap or "layflat tubing"), being sure to support the capacitor with it to prevent flexing. I think what I have been using on most Afro-sized ESCs for shrinkwrapping is 40mm flat width, for reference. Leaving the board bare is inadvisable! Insulate it with something.