Latest Firmware Version
Latest Firmware Version
This latest version is now pretty much feature complete - I'm not planning to add in any more major improvements at this stage.
Please view the following post for a quick guide on how to flash the charger with this firmware:
viewtopic.php?f=3&t=32
Please read the above guide if you have any problems with compiling the firmware!
Please post discussion about this firmware in the following topic:
viewtopic.php?f=3&t=50
Note: an easier way to update the firmware can be found in the following thread:
viewtopic.php?f=3&t=64
Please view the following post for a quick guide on how to flash the charger with this firmware:
viewtopic.php?f=3&t=32
Please read the above guide if you have any problems with compiling the firmware!
Please post discussion about this firmware in the following topic:
viewtopic.php?f=3&t=50
Note: an easier way to update the firmware can be found in the following thread:
viewtopic.php?f=3&t=64
- Attachments
-
- ChargerSource0900.zip
- (751.66 KiB) Downloaded 2872 times
-
- ChargerSource0522.zip
- (102.79 KiB) Downloaded 2797 times
-
- ChargerSource0520.zip
- (101.99 KiB) Downloaded 2733 times
-
- ChargerSource0518.zip
- (101.3 KiB) Downloaded 2742 times
-
- ChargerSource0516.zip
- (101.03 KiB) Downloaded 2758 times
-
- ChargerSource0514.zip
- (96.22 KiB) Downloaded 2805 times
-
- ChargerSource0512.zip
- (87.29 KiB) Downloaded 2699 times
-
- ChargerSource0510.zip
- (87.71 KiB) Downloaded 2705 times
-
- ChargerSource0508.zip
- (80.39 KiB) Downloaded 2651 times
Re: Progress on Charger Firmware with Virtual Machine
I've just finished doing some work on the charger firmware:
I'll write up some instructions on general use for this firmware some time later. For the moment, I'm heading off to bed since it's now 1:40am!
- Fixed a bug where the shift registers were swapped - the wrong LED would be lit, and the charger would be charging the wrong cell!
- Added support for the 3 position mode switch. The middle position will now charge as expected and the outer positions will both do a discharge into the 3.9 ohm resistor - no difference between outside positions at the moment.
- Added support for the charging current switch. High will give 1000 mA, Medium 500 mA and Low 200 mA. -dV termination probably won't work at 200 mA.
- When logging is started, it will now log the hardware and firmware version to the log file/serial port.
- Fixed a bug that caused data corruption on the SD card when the LCD board was connected.
- Added a new ReadAndLog opcode to combine reading Voltage, Current and Temperature and then logging the results with a single byte instruction.
I'll write up some instructions on general use for this firmware some time later. For the moment, I'm heading off to bed since it's now 1:40am!
Re: Progress on Charger Firmware with Virtual Machine
I've just uploaded Version 0.502 to the first post - changes with this version include:
- Added Already Full Check - LED will light up purple if cell is at or over 1.4V Prevent accidentally overcharging a full cell and also helps to reject Alkalines.
- Added Resistance Check - does a brief charge and discharge to estimate cell resistance. Will refuse to charge cells with more than 300 milliohms resistance - should reject most alkalines, but not guaranteed.
- Implemented Inflection termination method - initial test results seem to be good, but needs more testing.
- Fixed bug which caused the elapsed time to be incremented even during pauses between charging.
- Added Refresh & Analyze mode: Discharge, Charge, Discharge, Charge. 30 minute rest between each charge and discharge. Good to check remaining capacity, recharge and discharge to get actual capacity and then finally recharge to leave battery ready for use.
- Added Header line to output.
- Fixed a bug that prevented the over temperature check from working.
- Modified charging currents: High mode will now charge at 1amp and the charge will only charge one cell at a time - if a second cell is inserted, it will automatically start charging it once the first one has finished. Medium mode will charge at 1amp as well, but with a pause to give an effective rate of 500mA. In this mode, if 2 cells are inserted, the charger will alternate between them. Low mode will charge at 400mA with a pause to give an effective rate of 200mA - again, in this mode it can charge 2 cells by alternating between them.
- Added register for firmware version.
- Reduced the number of long registers and replaced them with byte registers to save memory.
- Reduce duration of off period when fast charging a single cell. Effective charge rate should now work out to about 950mA.
- Increased maximum temperature for Revision 4 charger due to proximity of temperature sensors to charging circuit.
- Fixed a problem with compiling with the Arduino IDE version 1.5.2
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just updated the firmware to 0.504:
- Fixed a bug causing a Panic (SOS LED flashes) when trying to do an Analyze.
- Fixed some problems with EEPROMEx Class: regained some RAM and fixed an incorrect error message.
- Added code to set EEPROM memory size - I had assumed that this would be automatically set based on chip type selected in the IDE.
- Fixed (hopefully) inconsistent filename case names.
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just updated the code to version 0.506:
- Fixed a weird problem when inserting a second battery if charge rate was set to Medium or Low.
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just uploaded version 0.508:
- Fixed defines for Charger revision 5 - was previously defined incorrectly as revision 6.
- Added support for charger revision 6 - using the 18 bit ADC to read current in and out of batteries.
- Added code to load byte code programs from SD card into EEPROM and run them from there.
- Added code to enable WatchDog Timer Reset
- Added code to log last reset reason.
- Added Interrupt Service Routine to handle LED sequences.
- Added new op code to make use of LED ISR above.
- SOS is now run by this ISR, so timing should now always be good.
- Will now flash green instead of solid purple if cell is detected as full.
- Made reg_LED readable.
- Added reg_LEDPrescale to allow control of LED Sequence speed.
- Fixed a bug with op_JE op.
- Fixed a bug that could prevent fast charging from starting.
- Modified Read_ADC to allow selection of resolution and gain.
- Fixed an error in mcp342xRead that could cause invalid data to be returned when measuring with less than 18 bits of resolution.
- Added registers to control ADC resolution.
- Modified Internal Resistance check to use lower resolution measurements - should actually make the check more accurate.
- Fixed timing issues that could cause early termination when starting or finished charge on a second cell and charge rate set to medium or low.
- Freed up some RAM and Flash by not including the SoftwareSerial library if not needed.
- Added flashing blue indication when there is a problem starting the logging feature - e.g. if the SD card is missing or not inserted properly.
- Added mini light show on startup.
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just uploaded version 0.510:
Note that this will most likely be the last firmware version to support hardware revisions 5 and earlier. Paul has asked me to clean up the code to make it easier for others to understand.
- Added op_LOGMF - Logs a preset message followed by total time, capacity and energy.
- Fixed cells not being detected if their voltage was below 0.9V Cells now need to be at least 0.3V to be detected.
- Added (a modified version of) Paul's light show at startup.
- Disabled debugging messages in the EEPROMEx library to free up some flash - modified the code to still keep the write limiting feature enabled.
- Renamed reg_CycleSwitch to reg_ModeSwitch
- Added reg_StartupCode - allows byte code program to determine whether the MCU has been powered on, or if it was reset due to an external reset, brown out or watch dog.
- Changed message "min dV detected" to "Inflection detected"
- Changed maximum allowed current from 1 amp to 2 amps - use with caution - not actually used by current firmware.
- Cut some fat from the EEPROMEx library to save some Flash.
- Removed logging of free memory to save some Flash.
- Replaced MultiAnalogRead with analogRead to save some Flash.
- Added support for the push button.
- Added check to make sure that each VM doesn't run for more than 1.7 seconds at a time - otherwise that channel will panic - this should pre-empt the watch dog unless the whole controller has crashed.
- Added multiple modes depending on duration of button press.
- Added precharge feature to revive dead cells before doing internal resistance check and then main charge.
- Numerous other minor changes.
Note that this will most likely be the last firmware version to support hardware revisions 5 and earlier. Paul has asked me to clean up the code to make it easier for others to understand.
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just uploaded Version 0.512:
- Added feature to bypass loading of program from SD card if switch is held down during startup.
- Added EEPROM setting to switch above behaviour so that programs are loaded from SD only if button is held down during startup.
- Added feature to load from "charge.bin" "dischrge.bin" or "analyze.bin" depending on mode switch position. If file not found, will try for "charger.bin" then default to built in program.
- Added in random light show if charger is inactive for more than a minute.
- Improved accuracy of internal resistance check.
- Rewrote EEPROMEx library to save some flash space.
- Moved many parameters to EEPROM so that they can be changed without replacing the entire default program.
- Made a change to hopefully prevent a brown out condition occuring when starting charging after a full discharge.
- Fixed a bug preventing a rest from being given between charging and discharging.
- Default Hardware version will now be set for the revision 7 charger. Older versions are still supported for the time being.
- Other minor bug fixes.
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just uploaded Version 0.514:
I'd consider this version mostly feature complete. There's just a few more minor changes that I want to make.
- Fixed a file name case error affecting Linux users.
- Optimized Logging code to reduce flash usage.
- Changed to white with brief red flashes whilst waiting to charge.
- Changed Internal Resistance Check to only use resistance measured whilst charging. Resistance during discharges is still measured for informational purposes.
- If cells have a resistance of over 1 ohm, the charger will now reduce charging current to 200mA and the LED will alternate between red and purple whilst charging.
- Replaced standard Arduino SD library with fat16lib - this reduced compiled program size by almost 6KB! This does mean however that cards greater than 2GB are no longer supported.
- Fixed a bug with loading alternate byte code programs based on switch position.
- Changed behaviour with pressing button whilst starting - pressing and holding the button will now cause the charger to load a mode specific file, otherwise it will attempt to load the main charger.bin file.
- Modified logging to show PWM value that was used prior to the measurement rather than the updated PWM value.
- Added Voltage limit for constant voltage charging.
- Added support for detecting and charging NiZn cells.
- Added support for discharging into an external load.
- Fixed a problem with random light show not being shown under certain circumstances.
- Moved most of the byte code program into a separate area of flash so that byte code programs on SD can be a lot smaller to fit into the available EEPROM space.
I'd consider this version mostly feature complete. There's just a few more minor changes that I want to make.
Re: Progress on Mark's Firmware (Latest Version Attached)
I've just uploaded Version 0.516:
If you've already got a charger, I'd appreciate it if you could start seriously testing this new version so that we can be reasonably sure that there are no bugs before it's sent out to the masses!
- Added optional top off charge. (Default is to do it only when running analyze and discharge modes - not normal charging)
- Improved support for NiZn cells.
- Added capability to use PWM to vary discharge current through the internal load resistor.
- Reinstated more verbose error messages since we've not got some flash space to spare.
- Increased number of general registers by 25%
- Doubled number of EEPROM registers.
- Added code to reset EEPROM write count after loading program from SD card.
- Changed Channel numbers in output to be 1 & 2 instead of 0 & 1.
- Added display of estimated internal resistance at start of discharges.
- Added redirection table to allow SD card programs to replace up to 10 support routines - similar to virtual methods.
- Changed Waiting to charge from White/Red combination to Blue/Red combination.
- A few other minor changes.
- Fixed a few minor bugs.
- General code clean up.
If you've already got a charger, I'd appreciate it if you could start seriously testing this new version so that we can be reasonably sure that there are no bugs before it's sent out to the masses!