Well we all know how super reliable PIC's are, but I've just found one that's failed
It's a PIC 18F27K42 (my 18F PIC of choice) and among it's other jobs, it controls a switch-mode converter to charge it's Li-Ion battery pack.
As part of that it uses two analogue inputs, one monitoring the voltage, one measuring the current - and the I/O pin (A6) that monitors the current isn't working. As it monitors voltage and current, and adjusts the PWM for the converter accordingly, this wasn't good.
The current reading never changed from 0.002A, so the software kept turning it up (till it reached my MaxPWM limit), so the charging current was excessively high - but as the perceived current was below it's fully charged value, the software turned charging off as it thought it was fully charged. The software includes many safety features to shut down charging if there's a problem, and crude hardware features of a fuse feeding the battery, and also a fuse on the incoming 12V charging supply.
The charging current with a new PIC in is now happily 1.032A, and all is well.
It's a PIC 18F27K42 (my 18F PIC of choice) and among it's other jobs, it controls a switch-mode converter to charge it's Li-Ion battery pack.
As part of that it uses two analogue inputs, one monitoring the voltage, one measuring the current - and the I/O pin (A6) that monitors the current isn't working. As it monitors voltage and current, and adjusts the PWM for the converter accordingly, this wasn't good.
The current reading never changed from 0.002A, so the software kept turning it up (till it reached my MaxPWM limit), so the charging current was excessively high - but as the perceived current was below it's fully charged value, the software turned charging off as it thought it was fully charged. The software includes many safety features to shut down charging if there's a problem, and crude hardware features of a fuse feeding the battery, and also a fuse on the incoming 12V charging supply.
The charging current with a new PIC in is now happily 1.032A, and all is well.