Problems with USB to Serial Adapter (USB010): Can't download PICAXE program

lahaye

Member
[Edit 06.04.09]
The Problem has been resolved:
The problem was that Vista automatically Installed the device and used a different a driver version than provided by Rev-Ed: It installed 2.0.0.19, but the correct ones are 2.0.0.7.
If you find yourself in this situation use the "Update Driver"-Button in the Device Mananger/Ports/Prolific... /Properties/Driver, there you can manually Browse your computer and select the folder downloaded from Rev-Ed (link on top of this/any page).
[/Edit 06.04.09]

Hello Forum,

I'm having trouble programming my PICAXE chips with my new Rev-Ed USB to Serial Adapter (USB010). It gives me the following error message:
" Serial port error - code 0x1F54 'Error reading comm device' "



I also have the following strange behaviour:

Test Program (downloaded from laptop with serial port):
Code:
high 0       ' turn on LED0
pause 1000
high 1       ' turn on LED1
pause 1000
low 1        ' turn off LED1
pause 1000
low 0        ' turn off LED0
pause 1000
When I attach the Cable USB010-AXE026-combo the PICAXE semi hangs:
I) When already running it will finish the program but pushing the reset button won't make any LED light up again.
II) When Programing Cable is inserted before the program starts running no LEDs are lit.
When I remove the Download Cable reset works again.

This behaviour is very erratic, so what I describe above is what happens MOST of the time, sometimes the PICAXE needs a complete power cycle to run the program again, on a few occasions inserting the cable while the program is running will "freeze" the current LED pattern until the program finishes (If cable is inserted when both LEDs are lit up they both are turned off 2 seconds later, if cable is inserted at start of program only one LED turns on , it turns off 3 seconds later). Point II might be a variant of this*


My setup:
- Laptop with Windows Vista (Professional), no serial port (obviously)
- Picaxe 40X1 (about 9 months old) on Rev-Ed Protoboard (AXE022)
- RevEd USB-to-serial-converter (USB010) attached to a normal Rev-Ed Serial Download Cable (AXE026)
- PICAXE Programming Editor Version 5.2.2
- I have selected the correct port (port4)
- 3 AA batteries power supply

The drivers for the USB010 came from a Rev-Ed CD, Installation was easy and without problems (once I bothered to insert the CD ;) )

I tested the PICAXE (on the AXE022 with the Rev-Ed Standard Download Cable) with an older laptop (Windows XP [home edition?],serial port, older version Programming Editor [about 12 months old] and everything was fine (that's how I got the program downloaded in the first place).

Can someone offer some insights on this issue?
What is: Serial port error - code 0x1F54 'Error reading comm device' ?

regards
Florian

* Output state is frozen when zero LEDs are lit, observing current consumption might reveal if the PICAXE is doing something, but I don't wanna bloat this thread (yet).

[Edit 04.09]
Replaced AXE010 with USB010, also in thread title
[/Edit 04.09]
 
Last edited:

hippy

Technical Support
Staff member
I don't know the answer at the present time, but are the USB010 drivers compatible with Vista ? The error certainly seems to indicate a problem between the Programming Editor and Windows / Driver.

The strange program execution issues could also be related to that. To me it sounds like the cable is telling the PICAXE that there may be a download taking place, even though there isn't.
 

lahaye

Member
USB010 should work on Windows Vista

Hello hippy,
Thanks for the nightly reply.
Being a good forum member I did a forum search before :)
http://www.picaxeforum.co.uk/showthread.php?t=8132
It was stated (by Technical) that the USB010 is compatible with Vista (uses the XP drivers).

I just did the test provided by the Programming Editor (under Options, Serial Port):
{
[Copy-Pasted from Programming Editor]
Instructions:
1) Connect the download cable (and USB adapter if required) to the computer.
2) Make sure the PICAXE chip is inserted and powered (4.5 to 5V).
3) Use a multimeter on the DC Volts setting to measure the voltage between the PICAXE serial input pin and 0V.
4) When the LED is off, the signal should be between 0V and -1V.
5) When you click on the LED the signal should switch high.

If the signal does not change it indicates that:
-the wrong serial port is selected, or
-there is an incorrect connection, or
-the USB adapter is not suitable (does not support the RS232 'break' command). Use part AXE027 or USB010 instead.
}

Serial Input 40X1: Leg 6
4) I get +0,23 V
5) I get -5,05 V

It seems to me that something is reversed (maybe some crossover/non-crossover issue?), but you are supposed to connect the AXE026 to the USB010 right?



I made some voltage measurements between the pins of the USB010:
The pins are named after the position they have when they are connected to the AXE026 (USB010 top-left -> AXE026 top-right)
No idea if this is relevant though
Code:
Left                                 Top                                      Right
    ______________________________________________
    |    1             2            3             4            5          |
    |   O             O            O            O             O         |
     __                                                                   __
         |      6             7             8              9            |
         |     O             O             O             O            |
          _________________________________________
                              
                                  Bottom
Ground of multimeter is connected to "Pin 1" (the top-left pin of the USB010)
This Pin will connect to socket 1 of the AXE027 (top-right).

Pin Voltage
2 0V
3 -6,4V
4 -6,4V
5 0V
6 0V
7 -6,4V
8 0V
9 0V


AXE027 connected to USB010 measuring voltage on stereo connector (middle ring as ground):
Code:
__________________
                 |          |_______
                 |          |           |
                 |          |_______|
__________ |______ |
  +6,4V         Ground       +6,4V
Maybe this helps clarify things.

Florian


P.S
Somehow the ASCII art is messed up, but I think you get the idea
 

hippy

Technical Support
Staff member
It was stated (by Technical) that the USB010 is compatible with Vista (uses the XP drivers).
Thanks, I'll try and remember that for the future. Not sure why the error you are getting is appearing. Is it still appearing, and when ?

Serial Input 40X1: Leg 6
4) I get +0,23 V
5) I get -5,05 V
That is odd, but if you have the 0V (black) lead of the multimeter to something giving ~5V that would explain the negative voltages, if that is the case it looks like you are approximately seeing -

1) +5V
2) 0V

which would be as expected.

Ground of multimeter is connected to "Pin 1" (the top-left pin of the USB010)
AXE027 connected to USB010 measuring voltage on stereo connector (middle ring as ground)
Pin 5 of the 9-way is the one you want to be connecting the ground to. Pin 1 is DCD, an input towards the USB cable / PC so it's not predictable what would happen when connected to that.

On the 3.5mm jack, the tip is 0V, the ring is the signal from the PC to the PICAXE.

It would probably be worthwhile running your tests again so there's no confusion over what voltages you are seeing. A reasonable positive and a close to zero reading would be expected, a close to zero and negative reading is not correct.
 

lahaye

Member
Hi,
Fast reply, and it says your offline. What a pleasent surprise.

Well the error is still happening now (right now the PICAXE won't reset with Program Cable connected)
When does it happen?
Well if the stereo plug is not inserted i get "Error hardware not foud on COM 4", wich is expected.
As soon as I connect the stereo plug to the AXE022 and click on the Program-button I get "Serial port error - code 0x1F54 'Error reading comm device' "
The first time this happens it takes about 1,5 seconds for the error message to appear (the downloading window says " Connecting to Hardware... "), after that it happens almost instantly after clicking Program (one can barely see the download window appearing).
If I then remove the stereo plug and click on Program it instantly gives me " Serial port error - code 0x1F54 'Error reading comm device' " ONCE, if I click Program again it takes the usual timeout period and then states "Error hardware not foud on COM 4".



Conserning the other points you made:
- I am pretty sure I had the leads of the multimeter the correct way around, but I will tripple check again.

- thanks for pointing me to the correct ground pins, I was kinda fishing for that ;) [RTFM? :eek:]. I will make the measurments and post results.

Florian
 

lahaye

Member
Here are some measurements

Rechecked the serial test provided by Programming Editor:
LED off
-0,22V
LED on
+5V
so I guess I DID switch positiv and ground lead of the multimeter. :eek:
when the test goes from LED_ON to LED_OFF it resets the PICAXE (right now manual reset is working)

Stereo plug:

Code:
________________________
                           |         |______
                           |         |______|
________________ |______|
proximate ring       middlering                Multimeter ground connected here
Code:
Condition               Ring             Voltage   
not downloading     proximate       0V 
not downloading     middle          -6,4V    
downloading          proximate       0V 
downloading          middle           +7V
USB010

D-9 serial connector pins are named from left to right (on AXE027 from right to left)

Ground = pin5 is the top-right pin on USB010 D-9 connector, connects to top-left pin of AXE027 cable (also called pin/socket 5)
Code:
pin1 is here ->  ------------    <-Ground is here
                   --------
Code:
Pin               Voltage
1                  0V
2                  0V
3                 -6,5V  (+6,5V when downloading)
4                 -6,5V  (+6,5V when downloading)
5                  is ground reference
6                  0V
7                  0V
8                 -6,5V (-6,5V when downloading)
9                  0V

Is this making any sense?
 

Technical

Technical Support
Staff member
Vista should work fine with the XP drivers on our website. Perhaps you have got a different driver version (right click over the Prolific COM port setting in Device manager)
 

lahaye

Member
Hello,

I think my drivers are up-to-date:

-When I search for new drivers via Device Manager Vista tells me they are the most up to date.
-Just to be sure:
I deinstalled the drivers anyway, deleted all the drivers I downloaded before (From Rev-Ed), took the driver CD out of my DVD drive (the would now still be installed automatically upon insertng the USB010; same Version: 2.0.0.19).
After re-downloading the drivers from Rev-Ed I ran the Application (Remover) provided in the folder (wd_pl2303_v2007). It would deinstall the drivers on my laptop, then prompted me to restart the computer (and told me that the drivers will then be installed). After restart the drivers were indeed installed automatically (USB010 remained plugged into laptop). Again same Version (and it still doesn't work).

So Device Manager/Properties/Driver tells me:
Driver Provider: Prolific
Driver Date: 03.08.2005
Driver Version: 2.0.0.19
Digital Signer: Not digitally signed

Device Manager/Properties/Port Settings tells me:
Bits per second: 9600
Data bits: 8
Parity: None
Stop bits: 1
Flow control: None
(as described in the installation guide)
Device Manager/Propertie/Port Settings/Advanced tells me:
Recieve Buffer: High (14)
Transmit Buffer: High(16)
COM Port Number: COM5

Would scoping the stereo connector be of any use?

Florian
 

hippy

Technical Support
Staff member
Scoping the 3.5mm jack probably won't give much more usable information. When doing the serial port test the Tx signal goes high (+V) LED on, otherwise it is normally low (0V/-V) LED off.

There are two separate errors here; one related to accessing the serial port / USB driver, then the issues inserting the cable has on the running program which may be related to the first.

I would recommend testing the USB010 and downloading on another ( preferably non-Vista ) PC so you can better determine if it is a cable or test board problem or related to the PC or Vista.
 

lahaye

Member
USB010 works on other (XP) laptop

Hi,

I installed the drivers (from folder provided by Rev-Ed) on other laptop (with Windows XP) and...voila worked first time. Sertxd also works.
My bad for not trying this out before. :eek:

One thing though. The Driver Version installed on the XP laptop seems to be different:
Device Manager on XP laptop says:
Driver Version: 2.0.0.7 (Vista: 2.0.0.19)
Driver Date: 12/31/2002 (Vista: 03.08.2005)
Is this Version-difference due to Vista/XP or is my Vista laptop getting the wrong drivers from somewhere? (it actually gives me no opportunity to tell it where to get the drivers from, it kinda happens automatically when I plug in the USB010)


Florian
 

Technical

Technical Support
Staff member
We have used the 2.0.0.7 on Vista without any problems. In Device Manager right click over the name, and select the 'update driver' option and then don't let Vista do anything automatically itself, at every option tell it exactly where to get the files from by using the 'browse' option!
 

lahaye

Member
It works!

:)

Hello,

Yep, it was the Version issue....
2.0.0.7 is the proper one.

I don't know where Vist got the other one from. I don't care as long as this keeps working I am fine.

Good point with the update drivers button Technical(I got so excited when I read "BROWSE my computer" ;)).

Hippy, Technical thank you both very much for seeing me through this, this is mostly appreciated.

Regards
Florian
 
Last edited:

pmolsen

Senior Member
I also have a problem with a USB cable. I bought a USB-to-serial cable on Ebay ($AUD4.95 incl delivery) which I then hook up to my standard download cable. 70% of the time it works fine. Other times it will download part of the program then give the error that you get if you disconnect the cable during a download. I try again and again and it finally gets through properly. Any ideas?
 

BeanieBots

Moderator
Well, the obvious idea would be to buy the recommended cable!

Failing that, try using a slightly lower (~4.5v) power supply.
Also, try lowering the 22k to around 10k but only if your cable is producing 5v logic and not +/-10v.

I've had similar issues with 18X using the USB010 cable. The only fix was to use AXE027
 

pmolsen

Senior Member
I cannot use AXE027 unfortunately. Firstly it is too short. The closest I can get the PC to the boards is about 5m. Second it has the wrong connector. My boards have a 3-pin header not a stereo socket.

I also cannot change the voltage of the board. It is powered from 12V via a 7805 voltage regulator. Unfortunately they don't make 7804.5 regulators and it is not feasible to redesign the board to use a variable voltage regulator.

Before changing the resistor from 22k to 10k what should I be testing or checking?
 

pmolsen

Senior Member
I put a scope across the pins during download. This is what I see as peak-to-peak readings. (Using picaxe 18x):

Interface pin 1 (ie. Picaxe pin 2 - serout): 1V
Interface pin 2 (Interface side of 22k resistor): 4.1V
Picaxe pin 3 (serin) (Picaxe side of 22k resistor): 4.1V
 

MartinM57

Moderator
That could be the problem in itself. 5m is a long way for RS232 like this and the cable could easily pick up electrical noise etc. which would make programming unreliable.
5m is no great distance for RS232 at all - when we all had dial up modems a few years ago, we were using kilometres of wire and it all worked fine.

5m is a long way for USB though....
 

pmolsen

Senior Member
The $4.95 USB - Serial converter cable is 800mm long. The converter circuit is in the far plug 800mm from the PC. Then there is a 5m RS232 cable at the end of that.

5m is a trivial distance for RS232. A parallel cable that long could cause problems but it is a tiny distance for for serial. Most computer centres have or had thousands of serial cables 50m long or more criss-crossing the building under the floor without a hint of interference.
 

hippy

Technical Support
Staff member
The thing seems to be, not that serial should notionally work over 6.8m, but that this particular configuration does not.

RS232 length limits are those in place when using drivers, buffers, connectors, cables and voltages which all meet the RS232 specification. This configuration does not appear to meet that so it is hard to say what will work and what will not. It is not necessarily a serial transmission issue but a whole-system issue.

The bottom line is it doesn't work in this instance, so any argument that it should is rather moot, the issue is why it does not, and more particularly how to make it work.

Even without knowing exactly what the root cause of the problem is we do know there are ways to improve the 'signal quality' as seen by the PICAXE on its Serial In pin; raise the serial voltages or conversely lower the PICAXE supply voltage, additionally lower the 20K or replace the two-resistor interface with MAX232 and invertors, plus of course using a different serial link ( different USB-to-Serial interface, using physical ports, different cable ). Any one of those may solve the problem or it may require a number of those changes. Depending on the actual nature of the problem it may be necessary to do more.

Without identifying the root cause, there are a few things which can be fairly easily tried in the hope of resolving the problem or reducing it or in helping to identify what alternative steps may help resolve it -

1) Lower the 20K. Easy enough by placing another R in parallel.

2) Lowering the PICAXE +V supply. This can be done by putting a diode drop in the power supply and can usually be tested by not powering any regulator and injecting the desired voltage onto the PICAXE supply line.

3) RS232 back-to-back filter connectors can be used where cables join.

4) Ferrite blocks can be clamped around cables at each end.

5) Adding low value pF or nF capacitors between the TX and Rx pins of the serial to 0V.

Ideally one would scope the signals and see what affect each change has, analyse those, and determine an ideal solution. In the absence of being able to do that it's really a case of trying things and seeing if they help or not.
 

pmolsen

Senior Member
Can I standardize on a lower resistor than 22k? Say 10K? What risks do I run in doing that?

I have an EM-406A GPS receiver on the board and also a 433.92MHz radio receiver. What would be the likely result of inserting a dropping diode on the supply to the picaxe only and not to them? In other words the picaxe reads the output from them. Is it likely to cause problems if they are running on 5v and the picaxe on 4.5V or 4V?

...answered my own question. I added the diode which resulted in 4.3V across the picaxe. Other components reading 4.98V. Works fine.

I changed the 22K to 10K. Hard to tell if there is any difference since the original problem was intermittent. Under what circumstances does that risk damage to the picaxe assuming I don't go experimenting with the input and just use a standard interface from a (laptop) PC?
 
Last edited:

hippy

Technical Support
Staff member
I'm not an electronics engineer so am not clear on how reducing the 20K helps things; perhaps someone more qualified in that respect could answer there ?

The 20K exists to limit the current into the pin which prevents an input voltage above +V pulling the power rail up to to the input voltage an damaging the PICAXE. The internal diode clamps the voltage on the pin to 0.3V (?) above +V. Too high a current through that diode and it will be destroyed.

Early datasheets did not state what the maximum injection current was and everyone using this technique appears to have been guided by an old Microchip datasheet which showed a direct mains connection to an I/O pin. That suggested a few uA were good enough to disicriminate between logic high and low and a few hundred uA would not damage the PICmicro nor raise the internal +V. 20K meets that criteria for +/-15V and values around that are found in similar RS232 interfacing schemes beyond PICAXE and the same technique is used in non-PICmicro systems.

In the latest datasheets the maxium injection current is stated to be +/-20mA ( check Microchip datasheets for specific devices ), so for a +/-15V RS232 signal the 20K could theoretically be reduced towards 750R. Again, as a non-electronics engineer, while such current would not exceed the maximum injection current, I don't know what other adverse effects it would have on power supply, input pin circuitry or what's driving the signal.

If the serial voltage is guaranteed 0V/5V there seems to be no reason to use any resistor at all other than to add a low value R to prevent damage should a fault condition make Serial In an output and short two outputs together; 250R upwards should do that.
 

BeanieBots

Moderator
Lowering the 22k will only have very small effect but can help because any circuit will have capacitance which can result in 'sloppy' signals when larger R's are used. On a quality PCB, I doubt there will be any perceivable difference but bread-board and strip-board layouts can accumulate considerable capacitance between tracks.

Despite what the datasheet says about injection current, don't forget, that current has to go somewhere. Many regulators can only source current and cannot sink any at all. In such a circuit, the excess current would be used to raise the PICAXE supply voltage via the internal catch diode. That could easily raise the voltage above the maximum and damage the PICAXE.

ONLY consider dropping the 22k value if your signals are 5v/0v.
DO NOT drop the 22k if your signals are +/-12v.
 

BeanieBots

Moderator
"standard", now there's a thing!
STANDARD is +/-12v.

However, MANY (but not all) laptops only supply +5v/0v.
MOST, (but not all) desktops are +/-12v.

Many (but not all) Serial/USB adapters use +5v/0v.

If in doubt, use 22k.
For a commercal product where the 'interface' is unknown and reliability is important, use a proper RS232 tranciever with appropriate inverters.
 

hippy

Technical Support
Staff member
RS232 standard is -15V..-3V / +3V..+15V

-12V/+12V became a defacto standard for PC's, presumably because they had those two power rails.

-10V/+10V became a defacto standard for MAX232 buffered signals because they self-generate those voltages.

0V/5V has become fairly widely used because it usually works but it is outside of the RS232 standard.

Compliance to RS232 requires tolerating -25V/+25V and shorts of any signal to 0V without damage.

What comes out of a PC, desktop, laptop or USB to serial cable depends on how it is designed.
 
Top