Unable to reprogram 08M2+ SMD

Hemi345

Senior Member
I have run into a bit of an issue. I built a custom PCB and used an 08M2+

board.jpg

I was able to successfully program the chip once with some code that interacts with the terminal using the serial in and out pins (C.5 and C.0). But I can no longer reprogram the chip. I'm using PE 6.0.8.6. I've tried pressing the program button and then connecting power to the PCB but it still says no hardware found. I've tried two different computers with the same result. The PCB has a 2.5V LDO and I've confirmed I'm getting a solid 2.5V to the PICAXE. I've bypassed the regulator with 4.35V and still can't get PE to check PICAXE type connected or program it. I've given the board a good washing to make sure their isn't any stray flux... still no dice.

I know the PICAXE is working, because the program executes just fine and I can interact with it at the terminal. I have a DS3232M RTC on the PCB that I can set the time on it with the terminal and program just cruises along... I just can't reprogram it with an update!! Too bad my first attempt at the program wasn't perfect....

Any ideas?
 

Hemi345

Senior Member
Forgot to add that on the computer (desktop) I initially programmed it with, it has a real serial port straight to the PCB. On my laptop, I tried my Prolific USB to Serial adapter and get the same result. Both computers can program other projects just fine so it's not a serial port issue on the computers.
 

marks

Senior Member
Hi Hemi345,
Usually a sign of some noise.
Usually a power on & program will catch it but may need to try a few times.
Use a separate supply other than from your serial cable it may be ok for 1 picaxe but not a populated board.
Using serout,I2c and or tight code can make it hard to reprogram.
Try using the old programmer 5.5.5 this executes faster and works better in this situation.
When reprograming Set Freq higher or and add some pauses this makes it easier to reprogram in future.

good luck!
 

inglewoodpete

Senior Member
What test gear do you have? A logic probe or, better still, an oscilloscope will help. If you're getting into SMD, you're probably working at a level that requires these tools anyway.

Solder a wire between Serial In and +5v rail on the board - I say solder to be sure you have definite connection. Next, connect a logic probe or oscilloscope to Serial Out pin also, on the board. Power up the circuit - do you detect pulsing on the output? If so, the PICAXE is alive and programmable - so the problem would be somewhere in the wiring to the computer.
 

Hemi345

Senior Member
This is supposed to be a very low power design so I'm using pin C.0 to supply power to the i2c pullups only when I need to read or write the RTC. That's what the RUN jumper is for. After I program the PICAXE, I short RUN and then I can dynamically turn on and off the pullups. This worked great on the breadboard and didn't cause any issues and saved a few uA. Here's the schematic:

DST schem.png

I tried PE 5.5.5 but no change. I tried PE6 a dozen more times and finally got it to program a simple test code.I was able to then reprogram it again with updated code but then back to not able to program it. I'll post that code tomorrow as I need to get some sleep. Unfortunately, I don't have any test equipment other than a DMM. I'm saving up for a Saleae Logic 4.
 

inglewoodpete

Senior Member
Flaky programming suggests either 1) Weak or unsuitable power supply or 2) Dry or loose joint in the programming circuit. I presume you've reflowed solder on the PICAXE pins involved with programming.

Otherwise, the board looks very neat.
 

hippy

Technical Support
Staff member
I tried PE6 a dozen more times and finally got it to program a simple test code.I was able to then reprogram it again with updated code but then back to not able to program it.
It does sound like a timing issue related to performing the Hard Reset procedure.
 

Hemi345

Senior Member
Quick update while on the road. I was finally able to reprogram it with a simple program and then reprogram if normally without hard reset 100% of the time. I added more to that simple prog that interacts with the RTC and still ok. Only when I put my original (about 1750 bytes) back on it does it go back to being very dodgy to reprogram. Will post code later.
 

erco

Senior Member
Any chance pin c.0 is sucking so much current7 that it's resetting the Picaxe? Cut the trace to measure the current and or keep it an input and see what happens.
 

Technical

Technical Support
Staff member
Everything stated points to an issue downloading due to something in the running program e.g. disconnect etc.

However if you get the timing of the hard-reset correct the program in memory is never executed, hence it doesn't matter at all what the program contains.

When using PE6 click on the Compiler tab in the workspace explorer on left. This tells you exactly when to connect power.
 

Hemi345

Senior Member
erco:294504 said:
Any chance pin c.0 is sucking so much current7 that it's resetting the Picaxe? Cut the trace to measure the current and or keep it an input and see what happens.
The only thing C.0 is connected to while I'm trying to program it is the SO pin on the programming header (because i'm leaving the run jumper open during programming). In the latest large program I put a 3 second pause as the first command after picaxe declaration and no_data and it still won't program without a dozen attempts while that program is currently on the pic. When i get back to a PC i'll post the code to see if any of you eagle eyes can spot something. There's gotta be something in it that passes syntax but really isnt right.

Atleast it seems like just a program issue and not hardware at this point.

IP, yes, i hit the so, si pins with extra flux and solder as well as the 10k and 22k resistors.

Thanks.
 

Hemi345

Senior Member
When using PE6 click on the Compiler tab in the workspace explorer on left. This tells you exactly when to connect power.
That's what I was doing, but just seems to be hit or miss even on two different computers (one using Windows 10 and the Prolific and the other Windows 8.1 and serial port. Reading this: "If the PICAXE is waiting for certain commands to complete (irin, kbin, serin, long pause commands and similar) the download request may not always be detected." I figured maybe my 3 second pause wasn't helping because right after that the program sends some instructions to the terminal and then waits at serin. So I added the following to the top of the program and now can program it reliably.

Code:
do 
	pause 250
	sertxd (".")
	inc tempVar1
loop until tempVar1 > 10
Neither of the computers I'm using to program this are very speedy so maybe that's where the issue lies. I've made many projects with PICAXE and this is the first one that has used serin and subsequently the first one that I've had this issue with.
 

inglewoodpete

Senior Member
I figured maybe my 3 second pause wasn't helping because right after that the program sends some instructions to the terminal and then waits at serin.

Neither of the computers I'm using to program this are very speedy so maybe that's where the issue lies. I've made many projects with PICAXE and this is the first one that has used serin and subsequently the first one that I've had this issue with.
If you do what Technical says, you will reprogram the PICAXE EVERY TIME. There is no such thing as "speedy code". When the PICAXE powers up (Boots up), the first thing it does BEFORE running your code is to check for a new program download.

The only other thing I can think of is that the PICAXE is not powering down when you "disconnect" the power. This can happen when the PIC is getting a ghost power feed via one or more of its I/O pins. Make sure that ALL power is removed from your circuit before starting the download + power-up process.
 

Hemi345

Senior Member
If you do what Technical says, you will reprogram the PICAXE EVERY TIME. There is no such thing as "speedy code". When the PICAXE powers up (Boots up), the first thing it does BEFORE running your code is to check for a new program download.

The only other thing I can think of is that the PICAXE is not powering down when you "disconnect" the power. This can happen when the PIC is getting a ghost power feed via one or more of its I/O pins. Make sure that ALL power is removed from your circuit before starting the download + power-up process.
I had more time to mess around with this tonite. I cannot program this with a hard-reset very reliably at all. Only with the bit of code I posted above added to the program, can I re-program this 100% -- and only if I follow this routine:
1) connect programming cable
2) connect power
3) within 2-3 seconds, click program button (while it's running that loop I put in at the beginning).

I believe your ghost power idea is the issue... but from the programming lead. If I only connect the programming lead (nothing else), Vdd (measured at PICAXE leg 1) jumps to ~3V (not sure how accurate that is...again I only have a DMM to test with) then within a couple seconds settles down to -315mV. Leaving the power disconnected, I click the PE6 program button and Vdd goes up to +2.81V where it sits until it times out and I get the programming failed dialog box. Vdd then drops back to -315mV.
 

inglewoodpete

Senior Member
I had more time to mess around with this tonite. I cannot program this with a hard-reset very reliably at all. Only with the bit of code I posted above added to the program, can I re-program this 100% -- and only if I follow this routine:
1) connect programming cable
2) connect power
3) within 2-3 seconds, click program button (while it's running that loop I put in at the beginning).

I believe your ghost power idea is the issue... but from the programming lead. If I only connect the programming lead (nothing else), Vdd (measured at PICAXE leg 1) jumps to ~3V (not sure how accurate that is...again I only have a DMM to test with) then within a couple seconds settles down to -315mV. Leaving the power disconnected, I click the PE6 program button and Vdd goes up to +2.81V where it sits until it times out and I get the programming failed dialog box. Vdd then drops back to -315mV.
Firstly, as I have said previously, your code should not run first. The PICAXE should reprogram every time if you reverse your steps 2 and 3: Ie click "program" and then apply power.

I have used a straight RS232 lead (AXE026) for over 10 years with no self-powering problems. Also, I've used many Prolific PL2302-based leads and also the AXE027. This suggests that there is a wiring error in your download circuit or programming lead.

Could you tell us the following voltages:
  1. With the download cable not plugged into the PICAXE board, perform a programming lead voltage test via PE6>Workspace Explorer>Configure and Test>Test Download Cable>Test 2. What are the two voltages you read? Note that +5v and 0v are for the AXE027 FTDI chip cable.
  2. Now, plug the cable into the your board. Measure the voltages across the 10K shunt resistor (R1 in your circuit) using the two above criteria.
  3. With the cable still plugged into the board, measure the two voltages between 0v and the PICAXE Serial In pin using the two above criteria.
  4. Finally, check that these voltages are the same as the 0v rail to the 22k resistor (the end that is connected to the PICAXE).
 

Hemi345

Senior Member
Firstly, as I have said previously, your code should not run first. The PICAXE should reprogram every time if you reverse your steps 2 and 3: Ie click "program" and then apply power.

I have used a straight RS232 lead (AXE026) for over 10 years with no self-powering problems. Also, I've used many Prolific PL2302-based leads and also the AXE027. This suggests that there is a wiring error in your download circuit or programming lead.

Could you tell us the following voltages:
  1. With the download cable not plugged into the PICAXE board, perform a programming lead voltage test via PE6>Workspace Explorer>Configure and Test>Test Download Cable>Test 2. What are the two voltages you read? Note that +5v and 0v are for the AXE027 FTDI chip cable.
  2. Now, plug the cable into the your board. Measure the voltages across the 10K shunt resistor (R1 in your circuit) using the two above criteria.
  3. With the cable still plugged into the board, measure the two voltages between 0v and the PICAXE Serial In pin using the two above criteria.
  4. Finally, check that these voltages are the same as the 0v rail to the 22k resistor (the end that is connected to the PICAXE).
1) green light off, -9.49V. Green light on, 9.69V
2) green light off, -8.77V. Green light on, 9.22V
3) green light off, -0.614V. Green light on, 3.426V
4) green light off, -0.612V. Green light on, 3.425V
 

hippy

Technical Support
Staff member
1) green light off, -9.49V. Green light on, 9.69V
2) green light off, -8.77V. Green light on, 9.22V
3) green light off, -0.614V. Green light on, 3.426V
4) green light off, -0.612V. Green light on, 3.425V
Those results would appear to be as expected.

For (3) and (4), -0.6V would be the negative serial voltage clamped through an internal diode to 0V, and +3.4V would be the positive serial voltage clamped through an internal diode to V+, with that V+ being around 2.8V.
 

inglewoodpete

Senior Member
Those results would appear to be as expected.

For (3) and (4), -0.6V would be the negative serial voltage clamped through an internal diode to 0V, and +3.4V would be the positive serial voltage clamped through an internal diode to V+, with that V+ being around 2.8V.
I agree with hippy on this one - the voltages all look correct for an RS232 cable (+/-9.5v in your case) and ~2.8v chip supply. I have no experience with programming PICAXEs that are running on low voltages so this has me (almost) stumped.

Perhaps Technical or hippy can offer something from their experience with low-voltage operation and programming.

I don't know what voltage regulator chip you're using here. Is it tolerant to being reverse biased? Ie higher voltage (4.35v - post #1) fed into its output? I've cooked an LM7805 by connecting a 5v power supply to its output pin in circuit - something I've learned:(. Could yours now be damaged by doing that and now doesn't have the current capability to sustain the circuit during programming? I'm running out of ideas but can you check the supply rail voltage when you attempt to download a program using the hard-reset method?
 

hippy

Technical Support
Staff member
Perhaps Technical or hippy can offer something from their experience with low-voltage operation and programming.
I have never had a problem with that, using RS232 or AXE027. When developing PICAXE products they go through a whole load of testing at various voltages, downloads while running and using hard Reset.

It is possible that at some low voltages a PC RS232 port will not register a signal from a PICAXE but, if it is working with one program downloaded, it should also work with any other downloaded with the same supply voltage.

For low voltage programming, and in using latest PICAXE, we would recommend using the AXE027 but RS232 should be usable in most cases.
 

AllyCat

Senior Member
Hi,

Post #1 reports the Vdd as a "solid" 2.5 volts, but perhaps the serial programming line is pulling that higher (via the internal protection diodes), or maybe the voltage drop across those diodes is rather higher than expected?

Perhaps Technical or hippy can offer something from their experience with low-voltage operation and programming.
Well, I've been doing quite a lot of testing over the full range of (specified) PICaxe supply voltages, and successfully programmed them from nearly 6v down to less than 2v (almost 1.5 volts for 14/20M2s). However, one issue which did prevent satisfactory programming was the serial/programming OUTPUT interface levels. That might be a specific problem when using "Real" RS232 levels (as the OP appears to have) with a PICaxe Vdd below say 2.5 volts.

In my case, the serial output comms was failing at about Vdd = 2 volts, so I devised a simple one-transistor interface described in this finished project.

Cheers, Alan.
 

Hemi345

Senior Member
IP, I'm using a TI TPS709 LDO, it has built in reverse current protection (page 14). So it should be fine if voltage on its OUT pin is kept below 6.5V. I don't think it's damaged because using the programming routine I outlined above, it is 100% successful. The hard-reset procedure just rarely works on this regardless what program is installed using either RS232 or the Prolific adapter. I have an FTDI USB to serial adapter that I made using a FT230X that I could try (if I can find it) if you all are curious.

I haven't measured the voltage while I'm trying to program it, I'll try that tonite. This is the first project I've built with a 2.5V supply to the PICAXE and using this TPS709 regulator. So maybe there's just something with this combo. I don't want to hack up this board too much as it works great for everything but the hard-reset procedure (and the DS3232M wasn't cheap!). I have a spare 2.5V TPS709 that I'll put on a breakout board (when i get a chance) to see if it behaves the same way for programming to rule out a design flaw in this board.
 

Hemi345

Senior Member
Hi,

Post #1 reports the Vdd as a "solid" 2.5 volts, but perhaps the serial programming line is pulling that higher (via the internal protection diodes), or maybe the voltage drop across those diodes is rather higher than expected?



Well, I've been doing quite a lot of testing over the full range of (specified) PICaxe supply voltages, and successfully programmed them from nearly 6v down to less than 2v (almost 1.5 volts for 14/20M2s). However, one issue which did prevent satisfactory programming was the serial/programming OUTPUT interface levels. That might be a specific problem when using "Real" RS232 levels (as the OP appears to have) with a PICaxe Vdd below say 2.5 volts.

In my case, the serial output comms was failing at about Vdd = 2 volts, so I devised a simple one-transistor interface described in this finished project.

Cheers, Alan.
Thanks Alan for the link to your Vdd Sweeper project. If I get the 2.5V reg and PICAXE mocked up on on a breadboard and it experiences the same issue, I'll try to replicated your setup to see if it helps.
 

AllyCat

Senior Member
Hi,

I don't believe we've seen your code and the symptoms still sound very much like a SERRXD lurking somewhere (which automatically generates a DISCONNECT). However, if you do decide it's a hardware issue then my simple serial output buffer/amplifier stage, i.e. one NPN, a LED and two pullup resistors (the output one to a higher voltage) might be worth a try.

Cheers, Alan.
 

Hemi345

Senior Member
AllyCat:294720 said:
Hi,

I don't believe we've seen your code and the symptoms still sound very much like a SERRXD lurking somewhere (which automatically generates a DISCONNECT). However, if you do decide it's a hardware issue then my simple serial output buffer/amplifier stage, i.e. one NPN, a LED and two pullup resistors (the output one to a higher voltage) might be worth a try.

Cheers, Alan.
My code is irrevelent at this point. As others have said, it wouldn't prevent programming using the hard reset procedure... which I've found is the issue now. Couple that with my prog starting up and going almost immediately into a serrx command and it seemed almost impossible to reprogram. Now that i have a 5 second pause at the beginning, I can program it without the hard reset by clicking program right after applying power. The issue is that hard reset just rarely works. I'll make a video of it so you can see the issue.
 

Hemi345

Senior Member
First two attempts were trying to use hard-reset procedure. Last attempt was successful when power is applied first then click program. Just need to make sure I always have a few seconds programmed in at the start before a command disconnects serial in on this project :)

I measured the Vdd rail to the PICAXE while trying to do hard-reset procedure.
1) plug in programming cable, Vdd goes to -315mV
2) click Program and Vdd goes to +2.63V
3) plug power in and Vdd stays at +2.63V until programming times out, then drops to +2.5V

Note that hard-reset works fine on all my other projects that use 2.7V or higher.

Only way I can program this project:
1) plug programming cable, Vdd goes to -315mV
2) plug power in, Vdd goes to +2.5V
3) quickly click Program and Vdd stays at +2.5V during and after download is finished.
 
Last edited:

hippy

Technical Support
Staff member
It is interesting with the RS232 plugged in, power not connected, with break asserted, the V+ appears to get clamped to around the voltage of the regulator. Though about half a volt lower than previous tests seem to show. That suggests the regulator is partially active even without input power.

I would surmise there is some sort of interaction which prevents the PICAXE from seeing the download break signal when applied before being powered as with a Hard Reset, but once powered can see the break signal, which allows it to download using other programs and this with a start-up pause, but not code which immediately blocks download.

As to what that interaction and cause is I have no idea. It could be a result of negative voltages on RS232, negative voltages being injected into the output of the voltage regulator, something to with a high RS232 voltage and low V+ voltage, or some other combination. It is odd that it worked on the breadboard; there could be some wiring error or components may have become damaged while trying to get it to work.

I don't think you are going to get to the bottom of it without a good quality, multi-channel, digital storage scope and a lot of analysis.

The best thing might be to get hold of an AXE027, see if that performs better. Or add a diode in series with the Serial In to prevent negative voltages reaching the module to see if that helps.

If things have worked with 2.7V regulators then perhaps replace the 2.5V with one of those. It may be that only by discovering what does work and doesn't can the cause for the current behaviour be determined. I would suggest building another board with only the PICAXE and its regulator on the board to eliminate the problem being with those other components.
 

Tyro

Member
Try adding a ceramic 1n0 capacitor as close to the power supply pins as possible. Most 100n caps have to much inductance to bypass correctly at the speed of these devices.
 
Top