Skip to content

Arduino Upload Error on VS Code #74

Open
@KC014

Description

@KC014

The following picture is the actual device of my Arduino microcontroller.
Image

Here is some basic information about this microcontroller:
Chip: ATmega4809
Clock: 20MHz
Memory: flash-48KB SRAM-6KB
Interfaces: USB, SPI, I2C, UART
Dimensions: 18 * 45mm
Device website link: https://store.arduino.cc/products/arduino-nano-every-with-headers

The following part is the code I just wrote on VS Code to test my Arduino microcontroller device, and this code has no compiling errors.
`#include <Arduino.h>

// put function declarations here:
// int myFunction(int, int);

void setup() {
// put your setup code here, to run once:
// int result = myFunction(2, 3);
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED pin as an output
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on (HIGH is the voltage level)
delay(200); // Wait for a second
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off (LOW is the voltage level)
delay(200); // Wait for a second
}

// put function definitions here:
/*
int myFunction(int x, int y) {
return x + y;
}
*/`

When I upload the code above to my Arduino microcontroller device by using the Arduino IDE, the code can be uploaded successfully without any errors. However, when I try to upload my code to my Arduino microcontroller on VS Code based on PlatformIO, VS Code gives me the following error messages. I have tried for several days, but still can't resolve this issue. I'm not sure what happened to my Arduino microcontroller device.
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATmega4809.html
PLATFORM: Atmel megaAVR (1.9.0) > ATmega4809
HARDWARE: ATMEGA4809 16MHz, 6KB RAM, 48KB Flash
PACKAGES:

  • framework-arduino-megaavr-megacorex @ 1.1.2
  • tool-avrdude @ 1.70100.0 (7.1.0)
  • toolchain-atmelavr @ 1.70300.191015 (7.3.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 12 compatible libraries
    Scanning dependencies...
    No dependencies
    Building in release mode
    Checking size .pio\build\ATmega4809\firmware.elf
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM: [ ] 0.1% (used 4 bytes from 6144 bytes)
    Flash: [ ] 1.6% (used 776 bytes from 49152 bytes)
    Configuring upload protocol...
    AVAILABLE: jtag2updi
    CURRENT: upload_protocol = jtag2updi
    Looking for upload port...
    Using manually specified: COM3
    Uploading .pio\build\ATmega4809\firmware.hex
    avrdude warning: attempt 1 of 10: sign-on command: status -1
    avrdude warning: attempt 2 of 10: sign-on command: status -1
    avrdude warning: attempt 3 of 10: sign-on command: status -1
    avrdude warning: attempt 4 of 10: sign-on command: status -1
    avrdude warning: attempt 5 of 10: sign-on command: status -1
    avrdude warning: attempt 6 of 10: sign-on command: status -1
    avrdude warning: attempt 7 of 10: sign-on command: status -1
    avrdude warning: attempt 8 of 10: sign-on command: status -1
    avrdude warning: attempt 9 of 10: sign-on command: status -1
    avrdude warning: attempt 10 of 10: sign-on command: status -1
    avrdude error: timeout/error communicating with programmer (status -1)
    avrdude error: unable to open programmer jtag2updi on port COM3

avrdude done. Thank you.

*** [upload] Error 1

Can anyone tell me what happened? Why can I upload my code successfully on Arduino IDE but can't do so on VS Code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions