I am using Attiny402 controller and programmer ATMEL ICE for uploading a simple led blink code. But I always get the error message as "A programmer is required to upload".
I also tried with "sketch>upload using programmer" method, but uploading message was there for a long time means I am not getting upload done or success. Kindly help me.
Hi @joju0407. I'm going to ask you to post the full verbose output from an upload.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
Select File > Preferences... from the Arduino IDE menus.
The "Preferences" dialog will open.
Uncheck the box next to Show verbose output during: ☑ compilation in the "Preferences" dialog.
Check the box next to Show verbose output during: ☐ upload.
Click the OK button.
Attempt an upload, as you did before.
Wait until you are certain the upload went into a hang state.
Right click on the black "Output" panel at the bottom of the Arduino IDE window.
From the context menu, click Copy All.
Open a forum reply here by clicking the Reply button.
Click the <CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press Ctrl+V.
This will paste the compilation output into the code block.
Move the cursor outside of the code tags before you add any additional text to your reply.
Unfortunately I'm not familiar with the ATtiny402 or the use of Arduino UNO as an UPDI programmer so I won't be able to help with the error message you shared. Hopefully one of the other forum members will be able to provide assistance. I would recommend that you carefully check all the circuits, including the support circuitry for the ATtiny402 and the connections between the UNO and the ATtiny402.
In some rare cases, jumper wires can be defective or damaged in a way that causes there to be no conductivity through the jumper wire even though the jumper appears intact from a visual inspection so you might also want to check the electrical continuity through your circuit. That can easily be done using a multimeter set to the continuity check mode (usually indicated by a diode symbol on the mode selector switch).
Something that might be useful to the helper is if you also post the output from attempting an "Upload Using Programmer" operation with your Atmel-ICE programmer.
I can add some notes about the problems you experienced with Arduino IDE:
As the message says, a programmer is required to upload to the ATtiny402. It is not possible to do uploads directly via the serial port as is done on the more common Arduino boards. So this means that an upload to the ATtiny402 is always an "Upload Using Programmer" operation. Arduino IDE 1.x has a feature that allows the boards platform developer to configure the definitions for boards like this so that the "Upload" button will trigger an "Upload Using Programmer" operation instead of a normal upload. Unfortunately that feature has not been added to Arduino IDE 2.x:
So when you are using the ATtiny402 board with Arduino IDE 2.x you must remember to always select Sketch > Upload Using Programmer from the Arduino IDE menus when you want to upload.
The AVRDUDE tool that is used to upload sketch programs to your ATtiny402 often spends an excruciatingly long time retrying a failed upload over and over and over again before it finally gives up and exits. This can give the impression that the upload hung permanently.
AVRDUDE also does hang permanently under certain conditions when an upload fails.
In both of these cases, you can usually force the tool to exit by disconnecting the USB cable of the programmer from your computer.
There is also a known bug in Arduino IDE that can cause it to remain in the uploading state even after the upload tool process exits:
If you were affected by that bug, you would see the message in the "Output" panel at the bottom of the Arduino IDE window that shows the process finished:
but the IDE would remain in the uploading state, as indicated by the in progress notification at the bottom right corner of the IDE window:
I use PlatformIO to programme ATtiny402 devices but you can use an Arduino as programmer too.
I still use Arduino IDE to 'download boot loader' - on an ATtiny402 (any bare bones AVR for that matter) this just lets you blow fuses as per the option selections - a key one is the brown out threshold voltage.
I use a modified USB to TTY adaptor and a Python script to do the biz.
PlatformIO is free and uses Arduino wrapper so you still have access to stuff like millis() if you want.
Here's some comments from a gadget geo cache I just built...
/* General approach to UPDI
I purchased an original ATtiny402 direct from Microchip - the exact part code was ATTINY402-SSN.
This part was available as it's not automotive spec and comes in a tube so there was no part reel cutting fee.
The upload command used pymcuprog which had to be installed within PlatformIO.
The ATtiny402 was programmed using a UPDI programmer made from a UTP to serial device with a diode betwen TXD and RXD.
-------------------- To Target device
DTR| 330 ohm __________________
internal Rx |--------------,--------\/\/------| UPDI------------->
Tx---/\/\/\---Tx |-------|<|---' .--------| Gnd
resistor Vcc|---------------------------------| Vcc
typ 1-2k CTS| .` |__________________
Gnd|--------------------' If you make a 3-pin connector, use this pinout
--------------------
<https://github.com/SpenceKonde/AVR-Guidance/blob/master/UPDI/jtag2updi.md>
<https://pypi.org/project/pymcuprog/>
<https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/PlatformIO.md>
<https://docs.platformio.org/en/latest/platforms/atmelmegaavr.html#upload-using-pymcuprog-serialupdi>
<https://community.platformio.org/t/problems-migrating-from-studio-7-to-platformio-attiny402-with-pymcuprog-custom-tool/29352/9>
I used Studio START code generator to get used to the peripheral configuration code
I put all the initial set up required in a system_init() routine and put this code at the bottom
below the main() loop structure.
*/
Check out these links for great stuff posted by Spence Konde (AKA Dr Azzy) - excellent.
You can even build a cheap HV programmer using the same kit (I haven't done this yet waiting on the MAX4544 chips) - see here http://www.technoblogy.com/show?48MP
If you are still struggling, post a response and I'll try to help some more - by the way - I am a relative newbie so don't take what I say too seriously.