A Forum run by Enthusiasts of MidNite Solar

Charge Controllers and Clippers => The "Classic" charge controller => Topic started by: Rybren on June 17, 2014, 02:41:40 PM

Title: Classic Firmware update using Linux
Post by: Rybren on June 17, 2014, 02:41:40 PM
I'm finally about to install the WBJr that I got for Christmas.  I know that I'll have to do a firmware update.  This will be my first one ever.

My Windoze laptop expired on me and the only machine that I have available is a really old Acer that I recently put Debian on because the machine was having trouble running XP.

Here's where I need some help: 

- Are there any tips that anyone can provide to a Linux newbie?
- Is there anything that I can test or run at home before heading up to the camp? My system is completely off grid and I have no communication with the outside world when I'm there
- What Firmware should I install?
- What can I do if the install fails or hangs? 

Thanks

Jerry
Title: Re: Classic Firmware update using Linux
Post by: Rybren on June 22, 2014, 11:12:54 AM
Let me try asking each question one by one.

What should I do if the firmware update fails? How do I get the Classic up and running again?
Title: Re: Classic Firmware update using Linux
Post by: zoneblue on June 22, 2014, 03:59:10 PM
Not sure i can help. Even though i use linux quite a bit, my observation/calculation was simply that most of the midnite firmware resources go into windows, therefore that will give me the best shot. Hence never had a firmware update go belly up. If you are boxed into linux, maybe PM TomW, who probably knows as much about it as anyone.
Title: Re: Classic Firmware update using Linux
Post by: TomW on June 22, 2014, 05:58:12 PM
Here is a fairly good discussion of this:

http://midniteforum.com/index.php?topic=909.msg6019#msg6019 (http://midniteforum.com/index.php?topic=909.msg6019#msg6019)

Hope it helps.

Tom
Title: Re: Classic Firmware update using Linux
Post by: Rybren on June 24, 2014, 07:29:39 AM
Thanks Tom.

I hope to head up to the camp and give it a try this weekend.
Title: Re: Classic Firmware update using Linux
Post by: chris on June 24, 2014, 10:09:00 AM
any possibility of just borrowing a windows laptop for the weekend there Jerry?

   I'm a Mac guy my self and have had to barrow one both times I updated my Kid....oh, and if the Classic is as easy to update as the Kid....should be a snap.
Title: Re: Classic Firmware update using Linux
Post by: Westbranch on June 24, 2014, 11:40:31 AM
Quote from: chris on June 24, 2014, 10:09:00 AM
oh, and if the Classic is as easy to update as the Kid....should be a snap.

Sad to say, but NO, it is not drag and drop...it can be frustrating in the least.  Most  important is to have patience and give the process lots of time to handshake, etc... it is NOT fast by any imagination.

have fun
Title: Re: Classic Firmware update using Linux
Post by: Rybren on June 24, 2014, 12:01:53 PM
Chris,

I MAY try using Linux this weekend. 

My biggest concern is about what to do if it fails.  Then I'm stuck in the bush without a working charge controller.  I'd have to drive around until I got cell reception and then pray that I could actually speak to someone.
Title: Re: Classic Firmware update using Linux
Post by: TomW on June 24, 2014, 12:17:14 PM
Quote from: Rybren on June 24, 2014, 12:01:53 PM
Chris,

I MAY try using Linux this weekend. 

My biggest concern is about what to do if it fails.  Then I'm stuck in the bush without a working charge controller.  I'd have to drive around until I got cell reception and then pray that I could actually speak to someone.

Rybren;

I do not remember a case where a failed FW update actually bricked a Classic. Usually it seems the Classic just keeps chugging along as a controller.    From not so reliable memory so take with a grain of salt.

Some successful upgrades have been known to set the mode to off so check that stuff before you leave it.  In fact, I would recommend a VMM whenever you upgrade the firmware. Shut off power in and battery power, hold  < and > arrow keys down and power it up, hold the keys until you get to the welcome screen. Answer the questions and reset any custom settings you may have had. This assures no unpredictable settings retention that may cause problems.


Just what I would do.

Tom
Title: Re: Classic Firmware update using Linux
Post by: Rybren on June 24, 2014, 02:59:40 PM
Tom,

It's good to know that a failed update doesn't brick the unit.  That has been my biggest concern.

Thanks.

Jerry
Title: Re: Classic Firmware update using Linux
Post by: chris on June 24, 2014, 10:46:47 PM
  Hope it all goes smooth Jerry,

   Once you get the WBjr up and running I'm sure you will be thrilled......I can't help but run to the controller every few mins to see how much power I'm using.....and how much is making it threw to the batts LOL
Title: Re: Classic Firmware update using Linux
Post by: Rybren on June 26, 2014, 06:52:14 PM
Thanks Chris,

I'm not so sure that I'll get it done any time soon.  My wife has been struggling with her Chemo lately and a trip to the cabin may not be in the books for a while.

Jerry
Title: Re: Classic Firmware update using Linux
Post by: chris on June 26, 2014, 11:08:54 PM
I hope the difficulty with the treatment pays off and she starts feeling better soon.
Title: Re: Classic Firmware update using Linux
Post by: Halfcrazy on June 27, 2014, 05:18:16 AM
Jerry
I wish you and your wife all the best through this.

Now on the Classic the only way to make it stop charging is to get the update to partially install and stop it. But if you get that far then it is very likely you will get it updated. 99% of the issues always settle around the driver being installed and the Com port being set. Without either it can not erase the old firmware'

Ryan
Title: Re: Classic Firmware update using Linux
Post by: Rybren on June 27, 2014, 08:01:30 AM
Thanks for the well wishes.

Ryan, thanks for the clarification.  I will eventually get the WBjr installed and the firmware updated.  Luckily, because we havn't been using the camp much, the batts spend 99+% of the time in float.
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 11, 2014, 04:35:00 PM
I made it up to the camp yesterday and managed to attempt the WBJr install and firmware update this morning.

Using Debian, I managed to get the Classic Firmware updated (Latest prod, 1849); however, I couldn't get the MNGP to update.

I kept getting the following error message:

ord() expected a character, but string of length 0 found.

I tried the update at least 20 times, and got the same error each time.

I got this same error the first time I attempted to update the Classic (I think - but I didn't write it down), but it worked the second.

I then tried adding the -z 3 bit, but got this message:

No ACK byte received

Thoughts?  I am using the USB cable that came with the Classic (picked up from the Midnite garage sale)

Thanks

Jerry
Title: Re: Classic Firmware update using Linux
Post by: Westbranch on July 11, 2014, 05:43:19 PM
Jerry, can you test that cable at home, just to ensure it works?
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 11, 2014, 09:48:41 PM
I left the cable at the camp.  However, it does work because I updated the Classic with it. I will try to grab a new and shorter cable before heading up again.
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 12, 2014, 08:53:36 PM
I went back to the camp today.  Tried the MNGP update using 4 different USB cables of varying lengths.  None worked.

What is interesting, is that this time, every attempt resulted in the "No ACK byte received" regardless of whether I used the -z 3 function.  In addition, I noticed that the top left of the MNGP would momentarily flash "No Communications" when I tried the update.  Also, during the attempted updates,  the Classic would show an alternating display of "Resting"  and "Got Comms?" (or something like that - I didn't write it down and my memory isn't as good as what it once was)

Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 16, 2014, 11:14:36 AM
Just thought I'd give this a bump.  I would like to head up to the camp this weekend and would dearly love to get the MNGP updated so I can start using the WB Jr.

Thanks
Title: Re: Classic Firmware update using Linux
Post by: chris on July 16, 2014, 06:45:14 PM
  Wow...sounds like updating the Classic is waaaay more work then the Kid....I'd send a PM over to one of the MidNite guys so you can get an answer before you head out for the weekend.

  Good luck man  ;D
Title: Re: Classic Firmware update using Linux
Post by: Westbranch on July 16, 2014, 07:56:58 PM
Yes , it is a very picky process  :-\ and needs kid (Pun intended) gloves :(

Not for the faint of heart
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 16, 2014, 08:32:54 PM
The Classic Firmware went relatively smoothly - it worked on the second attempt.  I probably tried the graphic panel at least 50 times.  :'(
Title: Re: Classic Firmware update using Linux
Post by: Westbranch on July 16, 2014, 09:26:47 PM
Did you wait 2 minutes after each press of "the button".  That seems to be paramount, very slooooooow on communication I found, like watching paint dry.

glad it went in the end...
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 17, 2014, 07:02:32 AM
Not sure what you mean by waiting 2 minutes after each press of the button. I saw no mention of waiting in the Linux instructions.

Tthe Graphics panel never did get updated.
Title: Re: Classic Firmware update using Linux
Post by: Westbranch on July 17, 2014, 02:04:40 PM
That is a W7 lesson I learned the frustrating way over 3 weekends, ie like "patience young Jedi",  that is: the CPU in the Classic is very small and takes a lot of time to process each command if you would..

The 'buttons' are in the screen for updating ( ie Classic model or MNGP)  that comes up in W7, maybe its not like that in Linux...
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 17, 2014, 02:33:12 PM
Ahh, got it.

In Linux, you execute a command like the old DOS stuff,  it runs through a script and then prompts you to turn the Classic on.
Title: Re: Classic Firmware update using Linux
Post by: boB on July 22, 2014, 06:45:33 PM

You can't "brick" a classic as in, erase all of the flash so it can't do anything at all by being re-programmed.

But, you CAN get it to stop working if you start the upload and stop it before it is finished.

Normally what happens (or doesn't happen) is that it either updates or doesn't talk at all.
Sounds to me like the Linux box is not talking to the Classic at all here and so the flash
will not be erased.  If it DID get erased, that would mean there was hope !  (as weird as
that sounds)...

If you try a windows laptop and it still does not update, then we will just have to RMA the
Classic so you can get one that does update.

Which version of the Linux update software from our site are you trying ?

I am also wondering if this (copied below) TXT file is the same one that is in your instructions ?
boB



MidNite USB Firmware Update Utility
Copyright MidNite Solar Inc. 2012
Andrew Meares, andy@midnitesolar.com
12/7/2012

Mac OS X

Description:
The mnupdate utility is a Python script that uploads a MidNite firmware through
a USB COM port.  The script requires Python 2.7 and the pyserial
module.  Mac OSX comes with Python but you should check that you have version 2.7.
From the command line type

python

The response will be the version of Python installed.  Type control d to exit python.
If you need to upgrade Python go to:

www.python.org/download/releases/2.7/

The pyserial module is not included with python. If you do not have it you can get it
using Macports with:

sudo port install py27-serial

Alternatively it can be downloaded from:

pyserial.sourceforge.net/

Follow the online instructions for installation.  Note that you may have to update your
PATH to use pyserial if you use your Mac's version of python because pyserial is
installed in a different location and python might not be able to find it.  Try:

export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
       site-packages:$PYTHONPATH

You can add this to the end of your profile by editing your .bash_profile

In order to function, the mnupdate.py script must have execute permissions and
have permissions to access the serial port device.  From Terminal, cd to the directory
with your Midnite Solar firmware and type:

chmod +x mnupdate.py

To find the device name in Mac OSX, type:

ls /dev/tty.*

Do this once with the USB from your Midnite device not plugged into the computer and then
with it plugged in type it again to figure out your device name.  For a Classic charge
controller it should be something like 'tty.usbmodemDEADC0D1'. Replace the 1 at the end in
the examples if yours differs.

Run the update script once for the Classic and then again for the MNGP.  After first
updating the Classic, turn off the power and run the script a second time to upgrade the
MNGP.


Instructions:
To update the firmware on your Classic Charge Controller use the following
procedure:
1. Switch off the Classic battery and PV inputs.  This turns your Classic off
   completely.
2. Plug your computer into the USB port on the Classic.
3. With the Classic off, run the mnupdate utility in your terminal with the
   proper options.  The options are described later in this document.
4. When "Waiting for serial device." is displayed, switch the battery breaker to
   turn on your Classic.  The Classic should boot and the mnupdate utility
   should connect and automatically begin uploading the firmware.
5. The firmware can take a few minutes to upload, so be patient.
6. Once the mnupdate utility has finished running, cycle the power on your
   Classic.

   
Command Line Options:
usage: mnupdate.py [-h] [-d DEVICE] [-b {9600,19200,57600}] [-t TIMEOUT]
                   [-m MESSAGE] [-z SLEEP] [-r] [-x REPEAT_SLEEP] [-s]
                   filename

A utility for updating firmware via a USB COM port.

positional arguments:
  filename              Firmware file path/name

optional arguments:
  -h, --help            show this help message and exit
  -d DEVICE, --device DEVICE
                        Device path/name
  -b {9600,19200,57600}, --baudrate {9600,19200,57600}
                        Device baudrate
  -t TIMEOUT, --timeout TIMEOUT
                        Device timeout in seconds
  -m MESSAGE, --message MESSAGE
                        Upload message
  -z SLEEP, --sleep SLEEP
                        Sleep time for serial port in seconds
  -r, --repeat          Repeat upload message?
  -x REPEAT_SLEEP, --repeat-sleep REPEAT_SLEEP
                        Repeat upload sleep time in seconds
  -s, --silent          Silent mode?


Examples: **Since this version is for MAC I have added "-d /dev/tty.usbmodemDEADC0D1" to all examples because it is required.**
For a basic Classic update simply use:
./mnupdate.py -d /dev/tty.usbmodemDEADC0D1 INSERT_FILENAME.ctl

In order to update your MNGP you must use the repeat option and a special message.
./mnupdate.py -d /dev/tty.usbmodemDEADC0D1 -r -m uPlDrEMaLLfl INSERT_FILENAME.rem

The '-d' option can be used to specify a device other than '/dev/ttyACM0' (ACM0 is for Linux). **required for MAC users**
./mnupdate.py -d /dev/tty.usbmodemDEADC0D1 INSERT_FILENAME.ctl

If for some reason the program tries to acquire the serial port too quickly, it
may work to increase the sleep time as follows.
./mnupdate.py -d /dev/tty.usbmodemDEADC0D1 -z 1.5 INSERT_FILENAME.ctl

If the firmware update fails on the MNGP try adding both -z and -x options:
./mnupdate.py -d /dev/tty.usbmodemDEADC0D1 -x 0.1 -z 1.5 -r -m uPlDrEMaLLfl FILENAME.rem


Choosing a Firmware Update File:
The proper file for your particular device must be chosen.  There are different
firmwares for different Classic voltages and for the MNGP.  The firmware files
have the extension '.ctl' or '.rem' and are available from the MidNite Solar
web page.


Resources:
http://www.midnitesolar.com/
http://pyserial.sourceforge.net/



Title: Re: Classic Firmware update using Linux
Post by: boB on July 22, 2014, 06:49:48 PM

Oh man !  I hear you on the chemo thing...  It's going around.  You and your wife are not alone  !

But then again, a trip to the cabin might be just what is needed !

boB
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 22, 2014, 08:59:54 PM
boB,

Thanks for the response.  Yeah, chemo is a real pain.  This last bout was particularly rough on her and we haven't been able to do much of anything.  It's particularly frustrating, because despite the fact that she has Stage 4 lung cancer, she'd have no symptoms if it weren't for the chemo.

The Classic itself updated fine to 1849.  The issue I've been having is with the 1821 Graphic panel update.  The file is in MNupdate_Linux_Mac_Rev1849_4-21-2014.zip  (latest production firmware)

The instructions are different from what you posted and have a more recent revision date of 2-20-2014 (boB)

When I get up to the camp, should I try the older instructions?

Thanks,

Jerry
Title: Re: Classic Firmware update using Linux
Post by: boB on July 24, 2014, 12:23:02 AM
Quote from: Rybren on July 22, 2014, 08:59:54 PM
boB,

Thanks for the response.  Yeah, chemo is a real pain.  This last bout was particularly rough on her and we haven't been able to do much of anything.  It's particularly frustrating, because despite the fact that she has Stage 4 lung cancer, she'd have no symptoms if it weren't for the chemo.

The Classic itself updated fine to 1849.  The issue I've been having is with the 1821 Graphic panel update.  The file is in MNupdate_Linux_Mac_Rev1849_4-21-2014.zip  (latest production firmware)

The instructions are different from what you posted and have a more recent revision date of 2-20-2014 (boB)

When I get up to the camp, should I try the older instructions?

Thanks,

Jerry


Yes, try instructions.  If no-go, we will do something about the MNGP.  I'm pretty sure the MNGP is the problem if no-go.

I am very close to someone with the same problem as your wife, BTW.

Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 24, 2014, 07:19:03 AM
Thanks boB.  Will give it another go the next time we head up to the camp.

My heart goes out to the person you know with cancer.  It is an incredibly difficult time.

Jerry
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 29, 2014, 06:55:53 AM
boB,

Made a trip up to the camp yesterday.  The MNGP update was still a no-go using Linux and the instructions that you posted.  As a note, -x is not supported in the version of mnupdate that I'm using (from the MNupdate_Linux_Mac_Rev1849_4-21-2014.zip  file). 

I tried dmesg and it shows the port being connected and disconnected and also ran sudo tail -f /var/log/syslog and it also showed the  port being connected and disconnected.

Finally, I tried sudo cat /dev/ttyACM0 and got a data dump.



I'm still trying to find someone with an XP or Win7 laptop that I can borrow.  Not sure that it will make much of a difference.

Cheers,

Jerry
Title: Re: Classic Firmware update using Linux
Post by: TomW on July 29, 2014, 10:35:37 AM
Just in case I missed it or nobody asked....

Did you run the update command as root or via sudo?

Seems you need to unless you changed permissions on your port?

Just a thought.

Tom
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 29, 2014, 10:25:19 PM
TomW,  I ran it as root and did the chmod to change the permissions of nmupdate.

Thanks


Jerry
Title: Re: Classic Firmware update using Linux
Post by: boB on July 30, 2014, 04:07:11 AM
If it isn't working still, then it's maybe time for it to be RMA'd.

Still good to try windows but if that doesn't work or you just can't get Linux to work,
then RMA might be the only choice.  It shouldn't take very long to get it turned around.
Title: Re: Classic Firmware update using Linux
Post by: Rybren on July 30, 2014, 07:22:36 AM
Thanks boB.  Will give it one last shot - hopefully with windoze - and then call in for RMA if it doesn't work.

Jerry
Title: Re: Classic Firmware update using Linux
Post by: Rybren on August 04, 2014, 04:29:13 PM
I managed to tear apart a couple of old laptops and then build one that would run Win7.  Loaded the updater and brought it up to the camp.

The MNGP updated on the first attempt!  Yahoo!

I now have the WB Jr operational!!!
Title: Re: Classic Firmware update using Linux
Post by: Halfcrazy on August 04, 2014, 06:58:29 PM
Sweet. Sorry it was such a pain in the rear
Title: Re: Classic Firmware update using Linux
Post by: Rybren on August 04, 2014, 08:53:38 PM
No worries Ryan.  I finally got it to work, and that is what is important.

Cheers,

Jerry
Title: Re: Classic Firmware update using Linux
Post by: chris on August 05, 2014, 06:53:33 PM
  Right on Jerry!
   I love mine  8)
Title: Re: Classic Firmware update using Linux
Post by: Rybren on August 05, 2014, 09:59:01 PM
Yeah Chris.  I'm a happy man  :)
Title: Re: Classic Firmware update using Linux
Post by: boB on August 06, 2014, 01:44:06 AM

Excellent news !   I wonder what the Linux problem was though ?  I guess I better make another partition here.

Thanks for the update !
boB
Title: Re: Classic Firmware update using Linux
Post by: Rybren on August 06, 2014, 06:39:04 AM
boB,

I'm really happy it finally worked as well.  It seems as though Linux has caused problems for other folks as well.  There's a thread here.... http://midniteforum.com/index.php?topic=1814.30 (http://midniteforum.com/index.php?topic=1814.30)

Jerry