Help! can't program Picaxe 20m2!

Sanchit

New Member
Hi,
Two days ago, i downloaded a simple debug ADC program onto my picaxe 20m2 to get adc values from an IR phototransistor.
Code:
 main:
 readadc b.3, b0
 debug
 goto main
The program downloaded successfully and a window opened showing the adc values. Then I closed that debug window and made a few changes to my IR phototransistor circuit. After making some changes I opened programming editor and selected Picaxe-> Debug... The debug window opened again and started showing the adc values, so far so good.
But now when I try to download a new program, it shows that same old error that "Hardware not connected, Hardware not powered", etc... I don't understand, the debug is still working properly which means that there is no problem in my usb cable and picaxe. I even tried with new batteries and tried the hard reset as explained in picaxe manual 1, but still the same result.
Any help will be greatly appreciated.
Thank you :)
 
...
But now when I try to download a new program, it shows that same old error that "Hardware not connected, Hardware not powered", etc... I don't understand, the debug is still working properly which means that there is no problem in my usb cable and picaxe. ...
I think I once had a similar problem and discovered that my SERIN connection to the PicAxe was bad. I think the DEBUG window opens up with signals coming from the chip, but if the PC can't talk back to the chip, then you might get that error. It's just a guess.
 

westaust55

Moderator
Are you performing the Hard Reset correctly?

Try a "Hard Reset" procedure as/while you start to download a new program.
Remove power, start the download and when the pop-up windows appears, then apply power to the PICAXE chip.
Have a read from the Rev Ed website here:http://www.picaxe.com/FAQs/Fault-Finding/

Is your PICAXE on a breadboard?
If so how are you connecting to the download cable? The pins on the bottom of a typical stereo socked used with the programming cable are too short for a good electrical conenction.

Maybe a clear photo of your project taken square on (perpendicular) with a plain background and clear enough others can trace wires end to end my help
 
Last edited:

hippy

Technical Support
Staff member
Westaust55 likely has the answer; Hard Reset.

The current program is a tight loop that is almost continually issuing DEBUG which may be confusing the downloader. Adding a reasonable length PAUSE after the DEBUG should also improve download success rates.
 

Sanchit

New Member
I checked all the connections on the cable and found that nothing is wrong it.
And for verifying it completely I shorted the serin and serout wires on my cable, opened the terminal... in picaxe menu, wrote some words in the output buffer and when i clicked enter, they appeared in the input buffer space. This means that my cable is working correctly.
I think that the problem is that the picaxe is not looking for a new program to be downloaded as normally it does.
 

Sanchit

New Member
I even tried the hard reset, but still the same result. The debug is still working perfectly and the cable is also ok :(
 

BeanieBots

Moderator
I don't see any decoupling capacitors for the PICAXE and I don't see any reservoir capacitors around the regulator.
Without these you will certainly experience problems. At least 100nF for the PICAXE and whatever the regulator datasheet says for the specific manufacturer of regulator that you have used.
 

westaust55

Moderator
I cannot access the photo you gave a link to. Maybe the site is too busy . . .
Better to post your photo here rather than remotely.
 

hippy

Technical Support
Staff member
Here is my board- http://letsmakerobots.com/files/userpics/u17926/Picaxe20m2-1.jpg
programming port is bottom left.
the pins are in order from top to bottom
1-> Gnd
2-> serout
3-> serin
It's somewhat hard to tell how the connector connects to the PICAXE and the connector is not in a standard Rev-Ed format but ... assuming you programmed the PICAXE through your cable and used this connector it should likely be wired correctly.

It still sounds like a Hard Reset issue. The power-cycling Hard Reset sequence is rather specific and does need to be done in the correct order, and step 3 is particularly important -

1) Turn power off
2) Initiate a download
3) Wait for the pop-up title to show "Connecting to hardware..."
4) Turn power on

It would be worth trying again.
 

Sanchit

New Member
Thank you everyone!
I finally got it to work. I don't know whether i was doing the hard reset procedure wrong or there was some other problem :D
 

MPep

Senior Member
The next tip now is to remember to add a PAUSE in your loop. This will allow you to be able to download a new code easier than now :).
 

westaust55

Moderator
Great to read that your problem is resolved.

Did you do anything physical (eg rework solder, etc) other than try hard resets?

For your future reference, keep in mind that it can be worthwhile assign a PAUSE 1000 statement at the beginning of a program. This can be advantageous in a couple of ways including:
1. Slightly longer time available for a new program download to start in the event that a program uses a blocking command or tight program loop
2. The programming Editor terminal window takes a finite time to establish if you start it ‘automatically’ when a download takes place. A delay of at least 0.5 second is generally required otherwise if data is sent serially to the PE terminal window early in the program in may be lost/missed.
 

Sanchit

New Member
Great to read that your problem is resolve

Did you do anything physical (eg rework solder, etc) other than try hard resets?
.
No I didn't do any physical thing, I just tried and tried the hard reset again and again and it worked and it is now responding to the download normally.
I think that as you suggested the program had a tight loop and the microcontroller was not able to respond properly at the time of downloading.
 
Top