Friday, November 9, 2018

Flashing SimonK firmware on a Red Brick 200A ESCs

So I got this ESC here. They are, as most Chinese ESCs are, suspiciously priced. I do not recommend them for the lack of testing I have done. I`ve been designing a linear actuator for a thrust vector control system and needed to make a mockup with some cheap parts. This ESC was particularly intriguing as it has an Atmega8 processor, meaning that I can reflash it with SimonK firmware, and also modify that firmware so that I can run the motor in both directions (tends to be important for linear actuators....). Most of this process I learned from this video by Robert Cowan (a cool dude, check his work out), but I had numerous more issues that were not covered in his video; so here I document that for you.


Note that the MOSFETs used for switching are all paralleled. If you used transistors from the same silicon batch, they should share the current normally. After all, most single package semiconductors like this are just a bunch of small devices in parallel on the substrate. However, in this case, they have decided to use a bunch of different transistors, and I wouldn't be surprised if this led to a failure later on under higher load conditions. Maybe they got a deal on a rando box `o FETs. Also you`re not seeing that the heatsink was held in place by heat shrink. So once you remove the covering... it just falls off.

Sigh. I should just fab some of these...

This reprogramming process only works for certain ESCs with ATMEGA8 chipsets. So keep this in mind if you are going to do this yourself. This list here includes a lot of the different ESCs that are supported, as well as their flavour of firmware binaries.

First you are going to need a USBASP dongle so that you flash the chip. This is basically a bad version of an atmel ICE or similar programmer. They're super cheap so sometimes they arrive in odd nonfunctioning states. The things we deal with. It might be worth it to pick up a couple.

Then you will need to open up the ESC and find the appropriate programming pins, and wire up a harness for programming.

This figure is taken directly from the data sheet for the atmega8 chip. You need Vcc, GND, MOSI, MISO, SCK, and RST(pin 29) to connect ot the programmer. Your ESC may have these conveniently laid out. Mine sort of did? Whoever designed this board ported them out to pads of 0402 size, and then had nothing populated on them. My best guess is that they had some special programming pogo-contact tool that allowed the factory (in god knows where shenzhen) for quick programming


I have also listed the pinout of the connector on the USBASP above on the engineering paper. Note that the box I drew denotes looking into the gated connector (so you should be seeing male pins). I cut up some female header jumper wires and soldered them to the programming "pads." Note that VCC was much easier to tag onto the linear regulator. I think I also omitted RST in this picture, but added it on later.

You`ll need to get the USPASP driver running, so head off to zadig, download the software and run it. This basically finds drivers needed for whatever peripherals it senses on the USB bus (i know...). So plug in the dongle and do that.

The head over to lazyzero and get the kkmulticopter flash tool. You will actually want both version 0.77 and 0.8. The latter will be run for programming your chip, but won't work without a file from the former. Make sure that you have downloaded the proper java run time environment. This proved to be very difficult. I recommend downloading the whole offline file and running it.

Otherwise you might get this error:
No JVM could be found on your system.
Please define EXE4J_JAVA_HOME
Even now, if you run the 64bit distribution of kkmulticopter it probably won't work. In my case, running this produced an error file that said it didn't have some of the required files. I went over to my 0.77 version folder and brought kkMulticopterFlashTool.properties over.. and it seemed to work.

Oh yeah you might also need to add the file path of Java RTE to your environmental variables, as well as EXE4J_JAVA_HOME as a variable name, with its path as its descriptor. (I am on windows 10 by the way).

Now it should finally run and stop giving you errors? Hopefully?


Open the tool, go to the simonk firmware section, hit download and pick your binary. In this case I am using birdie70A. I changed the lines 188 to high, and 189 to low so that I can run the motor in both directions.
Just kidding I have this error. I am still working on a fix for this. Some places say this is caused by the clock frequency being too high and having a "slow SCK" issue. Some people say that this is bogus and it has flashed correctly anyways... I'm going to keep working this one out.

Almost there!!!













4 comments:

  1. Hi ive just flash my redbrick 200amp with simonk all working apart from i could draw 2000watts before and now max is 315watts. Any ideas cheers

    ReplyDelete
  2. Hi ive just flash my redbrick 200amp with simonk all working apart from i could draw 2000watts before and now max is 315watts. Any ideas cheers

    ReplyDelete
  3. Did you figure it out? Does the esc work with the new firmware? How do you program the esc with three new firmware, do you use a programming card?

    ReplyDelete
  4. Did you find a .Hex file working for it? With mine it did not get error you showed but programming was 100% successful. But the . Hex files for the 200a reb brick does not work for it. Not the ones for Blue or Black board. I tried almost all. Hex files on simonk database. Nothing.. With bs_nfet.net I got a constant repetition of beeps and with rb70a2.hex the morot moves with repetition of beeps. But not one had any sesponcw with any commands from controller?

    ReplyDelete