28X2 instability ?

dworboys

New Member
Hi, seeking advice on an issue I have struck with a 28X2 based solar battery charge controller I have built and programmed. The original design for the controller was based on an 18X (AXE10 datalogger board) that worked fine for several years. I have now included additional functionality including the use of an i2c LCD. This additional functionality meant I had to deploy a new 28X2 based design. The new design has three i2c devices (DS3231 RTC, 24LC256 eeprom, and the LCD using a PCF8574). The program I've written occupies nearly all the capacity of the 28X2. I run the 28X2 at 16MHz (setfreq m16).

The issue is that the 28X2 seems to reset itself randomly. Everything will work for days and then reset itself for no apparent reason. At first I suspected a power supply issue but after a rebuild using a standard 7805 and fitting additional decoupling caps the problem appears unaffected. I have used another 28X2 but again no affect. I have run the 28X2 at lower clock speeds and again no apparent affect on the issue. I have temporarily omitted some less critical sections of code all to no affect.

I have attached the program for interested parties but I was wondering if there is some fundamental issue with the 28X2 in the way I'm trying to use it in this application that I'm not aware of ?View attachment VOLTAGE LOGGER_CONTROL_V24_28X2_100116.bas

Any comments or advice appreciated.

David
 

inglewoodpete

Senior Member
After the usual obvious problems which afflict PICAXEs (Reset pin not pulled up or SerIn pin not pulled down), my next thoughts are with decoupling and/or ground currents.

Ground currents are a tricky one, where the 0v line at the PICAXE fluctuates with high currents in shared paths (eg for your solar charger). You often need to run a separate earth return from the microcontroller to the power source. Also, is the charger a switchmode one?
 

dworboys

New Member
After the usual obvious problems which afflict PICAXEs (Reset pin not pulled up or SerIn pin not pulled down), my next thoughts are with decoupling and/or ground currents.

Ground currents are a tricky one, where the 0v line at the PICAXE fluctuates with high currents in shared paths (eg for your solar charger). You often need to run a separate earth return from the microcontroller to the power source. Also, is the charger a switchmode one?
Thanks for the reply, the actual solar regulator is a shunt regulator and is a separate standalone device to the picaxe circuit. The picaxe is there to measure the battery voltage at regular intervals, calculate average values, log it to eeprom along with time and date where I ultimately recover the data and plot what's happening over several months. The other main function of the picaxe is to drive the i2c LCD to dynamically display voltage and other parameters like turn on and turn off times that control my solar inverter, system alarms like low volts and other functions like RTC synchronisation. I use interrupts on one input to count the number of times the shunt regulator operates which gives me an indication of how much charging the batteries have had. Even the LCD update subroutine is inactive whenever the LCD backlight switch is set to off which it is at 3.30 in the morning and is off most the rest of the time as well.

The last random reset was at 3.30am in the morning when my inverter had been in sleep mode for several hours, with nothing else happening in the system, no sun, no charging, nothing.

Would you or anyone else know if there is a published list of 'system errors' or conditions that can cause the 28X2 to reset ? That might give me some clue.

David
 

inglewoodpete

Senior Member
Possible stack overflow error?

I use the 28X2 a lot in both commercial and personal projects and have nothing but praise for it.
 

dworboys

New Member
Your initial response prompted me to revisit the floating pin possibility. Seems more in keeping with the randomness of the resets I'm seeing. Measuring the voltage on the reset pin of the 28X2 confirmed a problem. On closer inspection the 4k7 pullup was open circuit. DOH ! I can count the number open circuit resistors I've encountered over the years on one hand. A valuable reminder that just because its physically there in circuit doesn't mean you should assume its working properly ! Although still early days yet I suspect it will be all good now. Thanks for the steer in the right direction.

David
 
Top