I have the following computers : HP Elite and Surface running Arduino IDE with the following hardware: UNO R3 with one 328p that works with USB serial and one which does not. Neither will program using USBasp. I also have two third-party 328pb based UNO which only program from the Command Prompt window with USBasp and will not program using Arduino IDE serial USB. I also have an Atmel 328pb xplained mini which refuses to program by any means. Needless to say all continue to run the last simple test program which displays a binary count on PortB. Does anyone else continue to go around in ever decreasing circles try to make sense of this fragmented development environment with all the unhelpful error messages?
What error messages? They usually make sense to me. But I can't see them so I can't help you.
The UNO is not an 328PB it is 328P
You need to install MiniCore to program a 328PB device
What is unhelpful about this? It says that your Arduino is not responding when asked to.
This can happen if:-
- you have not chosen the correct processor in the tools menu.
- you have not chosen the correct serial port.
- your Arduino is broken.
All three would cause the same error message.
Do you mean 2.0 or higher?
IDE 2.1.1 is the version now being used.
Yes all five of my devices must be broken!
What version of the IDE did you use before that worked? Is it possible that you just need to reinstall minicore?
Is there one you like better?
Use it.
I use Eclipse myself.
Not if you don't like it. Nobody is forcing you to use it. There's nothing you can't do without it if you know how.
The Arduino IDE is for beginners. Complaining about its lack of features is like looking at a FisherPrice toy and complaining that it doesn't work like a grown up one. If you feel like it isn't up to your standards then use something that is. There are lots of us that use other IDEs to write our own code.
But to be clear, the errors you are pointing to aren't coming from the IDE. Those are AVRDude errors. If you don't know what AVRDude is, then you will need to become familiar with that before you move to another IDE that doesn't do all of that for you.
Rather than making unfounded claims, I would suggest you test your hypothesis that the cause of the errors you are getting is something specific to Arduino IDE 2.1.1. You can do this easily by attempting the same procedure with the version of the IDE you were using previously.
The previous versions of Arduino IDE 2.x are available for download here:
https://github.com/arduino/arduino-ide/releases
Arduino IDE 1.8.19 is available for download here:
Previous versions of Arduino IDE 1.x are available for download here:
You may have erased the bootloader when you programmed the boards via USBasp. If so, the errors you got while trying to upload via the serial bootloader would be expected.
Please try this:
- Connect the board to your computer via the USBasp.
- Select the appropriate board from the Tools > Board menu in Arduino IDE (and any other custom board option menus if applicable.
- Select Tools > Programmer > USBasp from the Arduino IDE menu.
- Select Tools > Burn Bootloader
- Wait for the "Burn Bootloader" operation to finish successfully.
- Unplug the USBasp from your computer and the board.
- Connect the board to your computer using the USB cable.
- Select the serial port of the board from the Tools > Port menu in Arduino IDE.
- Select Sketch > Upload from the Arduino IDE menus.
Does the upload now succeed? If so, the cause of the previous errors was that you erased the bootloader. You should be able to restore the serial upload capability on your other boards but performing a "Burn Bootloader" operation on them as well.
I'm not sure I understand what you mean.
There were some previous reports of this "can't set com-state for ...
" error occurring specifically when uploading to the boards that use the WCH CH340 USB chip (and apparently only specific batches of those chips). The problem only occurs when using the latest version of the CH340 driver.
The affected users have reported that doing a "roll back" to an older version of the driver was an effective workaround. You can give that a try.
I'll provide instructions:
- Open this tutorial from SparkFun in your browser:
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#drivers-if-you-need-them
ⓘ We are using this tutorial as a source for an older version of the CH340 drivers. Generally I recommend only obtaining drivers from the manufacturer of the device, but WCH does not provide older versions of their drivers and SparkFun is trustworthy. - Click the "Windows (EXE)" link you see in red under the "Drivers (If You Need Them)" section of the tutorial.
- Wait for the download to finish.
- Run the downloaded
CH341SER.EXE
file. - A "User Account Control" dialog may now appear asking "Do you want to allow this app to make changes to your device?". Click the "Yes" button.
- A "DriverSetup(X64)" dialog will appear. Click the "INSTALL" button in the dialog.
- Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
- Click the "OK" button in the "Driver install success!" dialog.
- Click the X icon at the top right of the "DriverSetup(X64)" dialog to close it.
- Close Arduino IDE if it is running.
- Connect the Arduino board to your computer with a USB cable.
- Open the Windows Device Manager.
- Select View > Devices by type from the Device Manager menus.
- Open the "View" menu.
- If there is a ✓ to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
- Open the "Ports (COM & LPT)" section of the Device Manager tree.
- You should see a port identified as "USB-SERIAL CH340 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Right click on that item.
The "USB-SERIAL CH340 (COMn) Properties" dialog will open. - Select the "Drivers" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
- Click the "Update driver" button.
An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open. - Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
- You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
It is possible you will instead see the message "The best drivers are already installed". If so, please stop following the instructions here and reply on the forum thread to let me know. I'll provide alternative instructions you can follow. - Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
- Click the "Update driver" button.
- Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
The "Driver Package rollback" dialog will open. - Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
- Click the "Yes" button.
- Click the "Close" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error before. Hopefully this time you will not encounter that "can't set com-state
" error during the sketch upload.