Imax B6AC program with Arduino ISP

1,079 views
Skip to first unread message

Romeo Virgilio

unread,
Apr 7, 2018, 11:46:57 AM4/7/18
to cheali-charger
Hi all, i`m new here.
I need to charge LiHV (Lipo at 4.35 Volts per cell), so I decided to update the stock firmware to this one that can manage these lipos.
So I used an Arduino 1 to update but I had some problems.. I tried and this is the result:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e950f
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "C:\Users\romeo\Downloads\cheali-charger-master\cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex"
avrdude.exe: input file C:\Users\romeo\Downloads\cheali-charger-master\cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex auto detected as Intel Hex
avrdude.exe: writing flash (32768 bytes):

Writing | ################################################## | 100% 5.96s

avrdude.exe: 32768 bytes of flash written
avrdude.exe: verifying flash memory against C:\Users\romeo\Downloads\cheali-charger-master\cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex:
avrdude.exe: load data flash data from input file C:\Users\romeo\Downloads\cheali-charger-master\cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex:
avrdude.exe: input file C:\Users\romeo\Downloads\cheali-charger-master\cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex auto detected as Intel Hex
avrdude.exe: input file C:\Users\romeo\Downloads\cheali-charger-master\cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex contains 32768 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 4.42s

avrdude.exe: verifying ...
avrdude.exe: 32768 bytes of flash verified

avrdude.exe done.  Thank you.


Can anyone help me please? 

diggit

unread,
Apr 7, 2018, 12:07:16 PM4/7/18
to cheali-charger
Flashing itself seems to be successful. What is the problem?
Can you verify that contents of your hex file looks like this? (Sometimes, people download hex file incorrectly.)

:100010000C9468090C9437060C9437060C94370638
:100020000C9437060C94CC090C9498090C94A309F1
:100030000C9437060C94540A0C94890A0C943706D5
:100040000C9444090C9437060C9437060C9437062C
:100050000C94370660146C1471147414761488149C
:10006000851474146014E135E335E535E935E93577
...

BTW I suggest flashing files from unstable directory

diggit

unread,
Apr 7, 2018, 12:09:20 PM4/7/18
to cheali-charger
Oh, I've spotted the problem, signature 0x1e950f means, you have flashed ATmega328P (your arduino) instead of charger.


On Saturday, April 7, 2018 at 5:46:57 PM UTC+2, Romeo Virgilio wrote:

Romeo Virgilio

unread,
Apr 7, 2018, 12:45:25 PM4/7/18
to cheali-charger
Wow, looks cool lol
Do you know how can I fix? Thank you

diggit

unread,
Apr 7, 2018, 1:12:42 PM4/7/18
to cheali-charger
On Saturday, April 7, 2018 at 6:45:25 PM UTC+2, Romeo Virgilio wrote:
Wow, looks cool lol
Do you know how can I fix? Thank you

Yes, flash your charger instead of arduino...

You did not provide any details about how you executed avrdude (arguments) nor details of wiring. Here is page about using Arduino as ISP. Without any additional info, I can't help you...

Romeo Virgilio

unread,
Apr 7, 2018, 1:23:27 PM4/7/18
to cheali-charger
I programmed Arduino uno with ArduinoISP sketch, then I soldered 6 cable to my IMAX and connected with Arduino, mosi-13 miso-12 sck-11 reset to reset, 5V to 5V and gnd to gnd.
After that I downloaded AVR DUDE and I follow documentation to flash the firmware.. now Arduino works fine, checked with blink sketch, if programming is impossible I can buy an UsbASP, I find one on Amazon for 7 Euros
Thank you

diggit

unread,
Apr 7, 2018, 1:50:10 PM4/7/18
to cheali-charger


On Saturday, April 7, 2018 at 7:23:27 PM UTC+2, Romeo Virgilio wrote:
I programmed Arduino uno with ArduinoISP sketch, then I soldered 6 cable to my IMAX and connected with Arduino, mosi-13 miso-12 sck-11 reset to reset, 5V to 5V and gnd to gnd.

From previously linked website:
Uno or Duemilanove | MOSI: 11 or ICSP-4 | MISO: 12 or ICSP-1 | SCK: 13 or ICSP-3 |
Reset goes to pin 10 (mentioned on website and in sketch)

So flash ArduinoISP sketch and fix your wiring.

Then execute avrdude:

avrdude.exe -patmega32 -cstk500v1 -P[COM port] -Uflash:w:cheali-charger-[VERSION].hex:a

replace [COM port] with your arduino com port and [VERSION] with version of FW you are flashing...

You should see progress of flashing.

 

Romeo Virgilio

unread,
Apr 7, 2018, 2:02:32 PM4/7/18
to cheali-charger
Ok, for now thank you very much,
After dinner I try with the configuration that you mentioned and I'll let you know.
Message has been deleted

Romeo Virgilio

unread,
Apr 8, 2018, 4:24:13 AM4/8/18
to cheali-charger

> Uno or Duemilanove | MOSI: 11 or ICSP-4 | MISO: 12 or ICSP-1 | SCK: 13 or ICSP-3 |
> Reset goes to pin 10 (mentioned on website and in sketch)


Okay! It works! Now I can charge my 4,35V cells!
Thank you, have a great Sunday ! :)

diggit

unread,
Apr 8, 2018, 7:11:17 AM4/8/18
to cheali-charger
Enjoy new FW features and don't forget to calibrate your charger. :)

flixwat...@gmail.com

unread,
Sep 23, 2018, 7:42:36 AM9/23/18
to cheali-charger
Hi all,

I'm trying to do exactly the same thing, flash my Imax B6 with Cheali custom FW.
Got an Arduino Mega 2650 and think I have ISP setup correctly.
The command line is not quite working for me and I'm not sure where to edit or get the config file "-c stk500v1"?
Am I missing something?

I'm on Windows using avrdude.exe but just cannot get the custom FW HEX file written to my Imax B6 AC :-(

Any help is much appreciated!

Thanks so much!

diggit

unread,
Sep 23, 2018, 7:53:28 AM9/23/18
to cheali-charger
I'm trying to do exactly the same thing, flash my Imax B6 with Cheali custom FW.
Got an Arduino Mega 2650 and think I have ISP setup correctly.
The command line is not quite working for me and I'm not sure where to edit or get the config file "-c stk500v1"?

what file?
-c stk500v1
is a parameter to avrdude.

Please post whole command and its output.

flixwat...@gmail.com

unread,
Sep 23, 2018, 8:09:08 AM9/23/18
to cheali-charger
Hey Diggit, I'm blown away by your swift response, hope is returning I might be able to charge my HV Lipos and get some airtime with my new TinyWhoop today :-)

So what I'm typing in my cmd is:
avrdude.exe -p atmega32 -c stk500v1 -P com3 -U flash:w:cheali-charger-imaxB6-original_2.00-e10.3.12-20160613_atmega32.hex:a

It thinks about it for a short while, my Arduino flashes RX/TX and then I get this back:

avrdude.exe: stk500_getsync(): not in sync: resp=0xe0

avrdude.exe done.  Thank you.

By the way, I have hooked up the wires from my Arduino to my Imax using VCC, RESET and GND on the Power pins and MISO,MOSI and SCK to the Mega's SPI as per this link.
Just realized the example is showing an Uno. Might this be the issue? Thought the SPI setup is the same with Uno & Mega.

Appreciate your help!

diggit

unread,
Sep 23, 2018, 8:59:53 AM9/23/18
to cheali-charger
Ok, avrude can't recognize your programmer (arduino).

Problem is different default baud-rate, specifying it should be enough.

avrdude.exe -p atmega32 -c stk500v1 -P com3 -b 19200 -U flash:w:[your_file].hex:a
I suggest using most recent version from here. There are some fixes.

flixwat...@gmail.com

unread,
Sep 23, 2018, 9:21:19 AM9/23/18
to cheali-charger
Hi Again,

thanks a lot, unfortunately I seem to have some kind of mismatch. What I get now is:
c:\WinAVR-20100110>avrdude.exe -p atmega32 -c stk500v1 -P com3 -b 19200 -U flash:w:cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex:a -F

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0x000000
avrdude.exe: Yikes!  Invalid device signature.
avrdude.exe: Expected signature for ATMEGA32 is 1E 95 02
avrdude.exe: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex"
avrdude.exe: input file cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex auto detected as Intel Hex
avrdude.exe: writing flash (30810 bytes):

Writing | ################################################## | 100% 34.35s

avrdude.exe: 30810 bytes of flash written
avrdude.exe: verifying flash memory against cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex:
avrdude.exe: load data flash data from input file cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex:
avrdude.exe: input file cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex auto detected as Intel Hex
avrdude.exe: input file cheali-charger-imaxB6-original_2.01-e10.3.12-20170311_atmega32.hex contains 30810 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 19.62s

avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0000
             0x0c != 0x00
avrdude.exe: verification error; content mismatch

avrdude.exe: safemode: Fuses OK

avrdude.exe done.  Thank you.

Sorry, I'm completely new to this. I will try some other firmware files...

Thanks again.

flixwat...@gmail.com

unread,
Sep 23, 2018, 9:26:04 AM9/23/18
to cheali-charger
One more thing, last post was using the -F parameter because I got this initially:

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude.exe: Device signature = 0x000000
avrdude.exe: Yikes!  Invalid device signature.
             Double check connections and try again, or use -F to override
             this check.


avrdude.exe done.  Thank you.

Any idea where to look now? I feel I'm so close (but yet so far) :-)

Thanks!

Am Sonntag, 23. September 2018 14:59:53 UTC+2 schrieb diggit:

flixwat...@gmail.com

unread,
Sep 23, 2018, 9:55:05 AM9/23/18
to cheali-charger
I've changed the wiring and some different HEX files from unstable as well.
At least it is now reading the device and saying it's wrong.

c:\WinAVR-20100110>avrdude.exe -p atmega32 -c stk500v1 -P com3 -b 19200 -U flash:w:cheali-charger-imaxB6-clone_2.01-e10.3.12-20170311_atmega32.hex:a -F

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude.exe: Device signature = 0x00ff00
avrdude.exe: Expected signature for ATMEGA32 is 1E 95 02
avrdude.exe: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude.exe: safemode: To protect your AVR the programming will be aborted

avrdude.exe done.  Thank you.

I'm not sure if I'm actually talking to the Imax B6 (ATMEGA32) through my Arduino?
The Imax B6 does Beep and reboot when I send the command though.

Anything else?

Thanks again!

Am Sonntag, 23. September 2018 14:59:53 UTC+2 schrieb diggit:

diggit

unread,
Sep 23, 2018, 10:28:58 AM9/23/18
to cheali-charger
Now it seems, like wiring is wrong.

Correct signature is mandatory.

Which pin on arduino do you use as reset?

I am trying same scenario with my abused Arduino mega. My pin 10 is probably dead so i had to change next line in arduino ISP sketch and then flash new version.
#define RESET     10 // Use pin 10 to reset the target rather than SS
//to
#define RESET     3 // Use pin 3

My wring went from ICSP connector (pinout here), except mentioned RESET line moved to pin 3. Maybe try swapping MOSI and MISO lines, I am not sure from which perspective are those pin names (in image).
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages