Will a Pause Prevent a Program Download?

beb101

Senior Member
I am testing a small board that incorporates an 08m2 together with an inverter circuit to interface to a straight USB to serial adapter. Everything works ok, but the 08m2 does not want to accept a new download without a hard reset.

The program is:
Code:
'Picaxe 08m2 Mini Board test

#picaxe 08M2
#terminal 4800

pause 2000
main:	
	sertxd( "Hello from 08M2", cr, lf )
	pause 1000
goto main
Options --> check firmware version shows: PICAXE-08M2 Firmware version A

The symptoms are as follows:

Program running: SERIN voltage = 0.000V

Start of download: SERIN voltage = 5.1v then back to 0V

Popup message: Error - memory verification failed (byte 511)

Hard reset: SERIN voltage = 2.3V then 5.1V briefly, then, order of 1 to 2 v then back to 0V. Then program downloads.

If I comment out the pause 1000, then the program will almost always download without the hard reset. However, it will sometimes take a couple of tries. So, I think I answered my own question, but is there any way to work around this problem?

Baxter
 

jinx

Senior Member
hi, do you have a diagram for the inverter circuit to interface to a straight USB to serial adapter, NO a pause should'nt as i know prevent a download as you are overwritting the last program.
 

westaust55

Moderator
In answer to the question: "Will a Pause Prevent a Program Download?"

Forum member Technical from Rev Ed has in fact recently recommended adding a PAUSE 1000 as the first command when a DISCONENCT command follows (on the second line) to improve the chances of any subsequent program download being initiated. But maybe that just gives a chance after 1 second.

Presuming that the program download function works in a similar manner to the polled interrupts where scanning for an interrupt (SETINT command) is continuously during a pause command then it suggest a PAUSE command would not prvent a program download.

In the absence of a firm answer (and I am not near a PICAXE to test), try breaking your PAUSE 2000 down into several PAUSE 500 (or smaller increments) and see if the download problem is resolved.
 

hippy

Ex-Staff (retired)
I am testing a small board that incorporates an 08m2 together with an inverter circuit to interface to a straight USB to serial adapter. Everything works ok, but the 08m2 does not want to accept a new download without a hard reset ... Popup message: Error - memory verification failed (byte 511)
It seems the PICAXE has accepted and acknowledged the download but then fails during the download. Normally this would likely be related to the power supply and possibly batteries being worn out.

However, you seem to have an inverter on the download connections so my feeling is it is more likely to be something related to that. If you are getting 2.3V and 2V out of your inverter to the serial in pin that suggests a circuit error or it's a pulsing serial signal and it only looks to be 2V because of the way you are measuring things.

is there any way to work around this problem?
We recommend using the AXE027 download cable.

If you can post your full circuit diagram indicating how all power rails are connected to each other and provide full details of the cable you are using someone may be able to see why things do not work as expected.
 

hippy

Ex-Staff (retired)
Presuming that the program download function works in a similar manner to the polled interrupts where scanning for an interrupt (SETINT command) is continuously during a pause command then it suggest a PAUSE command would not prvent a program download.
Long pauses can sometimes prevent downloads being recognised but they produce "hardware not found" errors rather than verification errors which indicate the download is under way and has failed. Short, one or two seconds, pauses should not prevent download.

The suggested PAUSE when using DISCONNECT and/or SERRXD is to give the PICAXE a greater window of opportunity to spot a download after a Hard Reset.

Hard Reset should be initiate download, wait for "Connecting to Hardware...", turn power on, but some people turn power on when initiating download and/or before "Connecting to Hardware...". This often works but DISCONNECT will have already locked the PICAXE out of download. The PAUSE just gives some extra leeway on the timing, provides a period when it will still recognise a download even if powered up too early.

Bottom line - it's highly unlikely it's the PICAXE Code which is a problem in this case.
 

inglewoodpete

Senior Member
.....Popup message: Error - memory verification failed (byte 511)......
My observations over several years are that this sort of error is usually related to voltage mismatches. Either weak batteries on the PICAXE side (if using them) or poor output signal from the programming cable. Decoupling capacitor/s can help.

Once programmed, the PICAXE will run fine. The problem seems to be getting the program into the PICAXE.

Peter
 

beb101

Senior Member
Thanks for all of your replies. I don't have a schematic, but the attached Eagle Cad board image should be self explanatory. The inverter IC is a 74LVC2G14. It is the 6 pin SOT23-6 just below the input header. To the right is a SPDT on/off switch. Below that is an LED. The inverter is always on and the switch controls power to the LED and Picaxe. The discretes are the 22K and 10K SERIN resistors and a 0.1uF ceramic decoupling capacitor. The two small squares are pin 1 markers. The USB serial adaptor is a CP2102. The behavior is the same for either 3V or 5V power supplied from CP2102. I statically tested the serial inversion without the Picaxe plugged in and it is correct.

Based upon your answers, this could be a problem with the Cp2102. Goeytex mentioned in a post that this adapter gives a much faster download than one based upon the FTDI chip (and it does). I have never had this problem with a 20X2. So, perhaps the slower clock of the 08m2 is the issue here. I will check this later with Prolific and FTDI based adapters and report back. As Hippy says
We recommend using the AXE027 download cable.
Baxter
 

Attachments

Technical

Technical Support
Staff member
The USB serial adaptor is a CP2102. The behavior is the same for either 3V or 5V power supplied from CP2102. I statically tested the serial inversion without the Picaxe plugged in and it is correct.
Almost certainly the issue - CP2102 is not designed to also drive additional major loads - the internal 3V regulator has very limited capabilities in terms of powering external devices. What happens if the PICAXE is powered from a separate battery pack?

As Hippy explained earlier it is not a communication error - to get to the point of a verification error the PICAXE and computer have already communicated quite extensively. It is a programming voltage issue / power supply noise issue, not a general communication issue.

Goeytex mentioned in a post that this adapter gives a much faster download than one based upon the FTDI chip (and it does).
http://www.picaxeforum.co.uk/showthread.php?18867-Speeding-up-your-AXE027-Download
 
Last edited:

srnet

Senior Member
Thanks for all of your replies. I don't have a schematic, but the attached Eagle Cad board image should be self explanatory.
Its not.

I looked at it for a while and gave up.

Circuit diagrams are so much easier to read, if there is a problem with your circuit, the experienced guys on here would spot it in a couple of seconds.
 

beb101

Senior Member
Ok, to close the loop. I switched to a Prolific PL2303 USB adapter,

http://www.mdfly.com/index.php?main_page=product_info&cPath=9_41&products_id=485

and the program downloads perfectly every time. To check Technical's suggestion about inadequate power from the CP2102, I powered the board from a separate 3.3V supply, but the problem with the CP2102 persisted. So the issue is not power. Perhaps it is a messed-up break or some sort of latency. In any event, I will not further use Cp2102 adapters with a Picaxe.

Thanks for your help ...

Baxter
 

beb101

Senior Member
Hi SAborn,

Yes, I understand the inversion problem. I have the inverter in the circuit it is basically the same 74HC14 Schmitt trigger inverter circuit that Goeytex originally posted. However, I am using a 74LVC2G14 to save space, but the electrical characteristics are the same. This is one of those situations that can never be resolved. My circuit is correct according to the Picaxe SERIN/SEROUT standards. I ruled out a soldering error by putting together two different boards and they both behave the same with the same CP2102. The previous posters put to bed any question that a pause might be interfering with a program download. Moreover, downloads worked perfectly with a Prolific adapter. So I am going to blame my CP2102 and put it aside as possibly damaged or defective and move on.

Baxter
 

Goeytex

Senior Member
Unless the serial download is coming from a true serial port the 22K current limit resistor can be reduced. I generally use a 2.2K when using logic level devices. I also sometimes have to put a 10K- 15K resistor from serout to ground to get rid of a strange little pulse that sometimes happens causing a memory verification error on byte 511.

The CP2102 uses 3.3volts for its logic and is supposed to be 5v tolerant. However, I suggest a 200 ohm series resistor from the output of the inverter to the RX input of the CP2102 adapter.

Memory verification errors can also be a symptom of a bad ground.
 
Top