Question on uploading

Arduino projects on the go
jmendoza
Posts: 167
Joined: 18 Feb 2018, 23:07

Question on uploading

Post by jmendoza »

Well, got the IDE running and the USBasp driver installed. Board is selected as a Pro Mini ATMega 328P, 8MHz, 3.3 V. When I try to upload a test sketch I get the following error:

avrdude: ser_open(): can't open device "\\.\COM1": The system cannot find the file specified.

Windows 7 home version does not have a Com Port LPT1/2 tab under the Device Manager menu. In the list I do see the USBasp however, and it says it has its libusb win 32 driver and is operating normally. It is on Port_#.0001 Hub_#.0001 These settings automatically change to Port .0002 and Hub .0001 if I plug it into the other USB on my computer. I tried using View to see any hidden devices and still could not see the Com Ports to configure them.

In the IDE software under Tools, the Port arrow is greyed out so I can't select a port. At the bottom right of the screen border it does say it is on Com 1.
Apparently the board and my computer are not seeing each other through the USB port.

Update: I tied the Upload with programmer option and got this error message:
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'

Jay
User avatar
Flynn
Posts: 64
Joined: 17 Feb 2018, 14:48

Re: Question on uploading

Post by Flynn »

Hi Jay, ok ..so you found the first problem. when using a programmer, like the usbasp, you use the "sketch/upload via programmer" option because you are using a programmer and not a serial lead/port. The next problem (cannot find usb device) comes from the fact that you are using the wrong windows driver for your usbasp. There are, I think, 4 different drivers that windows will accept for the usbasp (winUSB, libusb-win32, libusbK and WinUSB (Microsoft))

You need to install a utility called Zadig (http://zadig.akeo.ie), its purpose is to allow you to select which driver you want to install for several different usb devices, including usbasp. Once installed open zadig and plug the USBasp into your usb port, then select USBasp from the uppermost window - if the window is blank then go to options and tick the list all devices box, USBasp should then be available, then you need to select WinUSB(v6.1.7600.16385) to the right of the green arrow, then select reinstall driver. Once all the magic has happened you should find the USBasp under Universal Serial Bus devices in device manager and your programmer should work in the Arduino IDE.

If you intend to use your USBasp to program a transmitter with openTX then you need to change the driver windows uses with the USBasp to (IIRC) libusb-win32, when you will find the USBasp listed in device manager under a new tab that is labelled libusb-win32 devices and not Universal Serial Bus devices.... ;)
You only ever need two tools....WD40 and duct tape.
If it doesn't move when it should use the WD40 and if it moves and it shouldn't use the tape.
jmendoza
Posts: 167
Joined: 18 Feb 2018, 23:07

Re: Question on uploading

Post by jmendoza »

Hey there Flynn, thanks, I'll try what your are suggesting.
I had no device in the Zadig window, it was blank, and I had uploaded libusb win 32 driver. That is the problem.

Quote:
if the window is blank then go to options and tick the list all devices box, USBasp should then be available,

My Results:

OK, I got the device (USBasp) in the window and re-installed WinUSB (v6.1.7600.16385)

It did upload the sketch but I get this message:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

Is that normal, am I good to go, or did I screw up yet again? :lol: I was able to load Blink and was also able to change the on and off times, so I guess that means everything is working?

All thumbs over here, Jay
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Question on uploading

Post by Martin »

It sounds like it's working now. :)

Most USBASPs have a few jumpers that can be confusing. If there is just a single jumper pair of pins up near the PC connector end of the thing, that is often a 'slow' jumper. You sometimes get an Arduino board or chip in a strange state where the USBASP won't talk to it and then it's worth putting a jumper to connect these 'slow' pins and trying again - sometimes that allows a sketch or bootloader to be written to the chip, which then sorts it out so it will work in 'fast' mode again. Normally 'fast mode', without the jumper is much better just because it saves so much time.

I have some USBASPs where there are jumpers to select 3.3V or 5V operation, and whether or not the USBASP supplies power to the target device - normally it's possible to work out what these pins do by seeing where the PCB traces connect and/or using a multi meter to measure voltages. You can't damage the AT mega 328 or AT tiny boards by connecting 5V to them - even if they are 3.3V versions - but of course you need to be very careful if there are 3.3V only devices connected to the Arduino any you want to connect the USBASP at the same time.

Lastly, I have some USBASPs that have a jumper that allows you to reprogram the USBASP itself - I've never had a need to use those and they seem a bit dangerous to me. :shock:

Why do I have so many USBASPs? To begin with I didn't really know what I was doing so I bought 5V 3.3V and ones with both 6-pin and 10-pin headers. Then later I ordered some that have a switch rather than jumpers for swapping voltage. They're only a few dollars each so sometimes it's easier to just leave one wired up to each breadboard project rather than having to swap the same one back and forth between several target devices.
jmendoza
Posts: 167
Joined: 18 Feb 2018, 23:07

Re: Question on uploading

Post by jmendoza »

Martin, Flynn,
question, what does this message mean?

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

I'm assuming I can use my 8MHz 3.3V Pro Mini Strong as long as all I wire it to are the pots and switches and no 5 volt inputs, correct?

Thanks,
Jay
User avatar
Phil_G
Posts: 597
Joined: 15 Feb 2018, 23:32
Contact:

Re: Question on uploading

Post by Phil_G »

You can just ignore that message Jay, some usbasps have manually adjustable sck and some dont, they set it automagically. Its to allow for targets running at slow clock rates. The avrdude command to upload a program includes a 'set clock period' specifically for 'older', manual, usbasps. When a modern, 'automatic' usbasp sees the 'set' command from avrdude it returns this warning, its not an error. One of mine gives that exact message every time, in fact I think its the 3v3 switchable one. Ignore it and all will be well Image
Cheers
Phil
jmendoza
Posts: 167
Joined: 18 Feb 2018, 23:07

Re: Question on uploading

Post by jmendoza »

Wiring it up to 1972 Kraft Sport Series 5 channel, Orange RX DSM2 Futaba compatible module.
Will update with photos.
Cheers and thanks guys :D
Jay
User avatar
Flynn
Posts: 64
Joined: 17 Feb 2018, 14:48

Re: Question on uploading

Post by Flynn »

I thought it was the other way around Phil, you get the warning if you are using an older USBasp and can get rid of the warning if you re-flash the USBasp with the latest firmware... whatever!! as you say ...it isn't important.

Jay...you do need to take some care with the 3v3 versions of the Arduinos as there appear to be some versions of the USBasp that do not have a 5v/3v3 selection jumper...you do not want to be plugging a 3v3 arduino into a 5v USBasp, if this is your case I would suggest you get back on ebay and get another USBasp with a 3v3/5V jumper
You only ever need two tools....WD40 and duct tape.
If it doesn't move when it should use the WD40 and if it moves and it shouldn't use the tape.
jmendoza
Posts: 167
Joined: 18 Feb 2018, 23:07

Re: Question on uploading

Post by jmendoza »

Thanks Phil and Flynn.

My USBasp has a 3.3V and 5V jumper. It also has a J2 and a J3.

What is J2 and J3 used for?

These things are so cheap they come with zero instructions so I don't know which jumpers are used and how they are used to to update the firmware.
User avatar
Flynn
Posts: 64
Joined: 17 Feb 2018, 14:48

Re: Question on uploading

Post by Flynn »

usbasp.jpg
So JP1 is to select 3v3, 5v or no power to the target device, JP2 needs to be shorted if you want to update the firmware in the USBasp and JP3 is there to allow you to slow down the data rate as described by Martin in an earlier post. You wont be bothered with JP2 &JP3 in normal use, thats why there are no headers soldered into the board for them.
You only ever need two tools....WD40 and duct tape.
If it doesn't move when it should use the WD40 and if it moves and it shouldn't use the tape.
Post Reply