I have modified the platformio.ini file as requested. I can confirm that it is working and I am able to upload my code to Arduino Uno Wifi Rev 2 without any issue. I also attached the verbose upload output for your reference if needed. Thanks again for the quick fix.
> Executing task in folder Robot Arm Braccio: C:\Users\Wong Zhi Wei\.platformio\penv\Scripts\platformio.exe run --verbose --target upload --environment uno_wifi_rev2 <
Processing uno_wifi_rev2 (platform: https://github.com/platformio/platform-atmelmegaavr.git; board: uno_wifi_rev2; framework: arduino; lib_deps: arduino-libraries/Braccio@^2.0.4, arduino-libraries/Servo@^1.1.8)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/uno_wifi_rev2.html
PLATFORM: Atmel megaAVR (1.5.0+sha.317e3e8) (git+https://github.com/platformio/platform-atmelmegaavr.git) > Arduino Uno WiFi Rev2
HARDWARE: ATMEGA4809 16MHz, 6KB RAM, 47.50KB Flash
PACKAGES:
- framework-arduino-megaavr 1.8.7
- tool-avrdude-megaavr 1.60300.191015 (6.3.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 7 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Braccio> 2.0.4 (D:\Nextcloud\PlatformIO\Project\Robot Arm Braccio\.pio\libdeps\uno_wifi_rev2\Braccio)
| |-- <Servo> 1.1.8 (D:\Nextcloud\PlatformIO\Project\Robot Arm Braccio\.pio\libdeps\uno_wifi_rev2\Servo)
|-- <Servo> 1.1.8 (D:\Nextcloud\PlatformIO\Project\Robot Arm Braccio\.pio\libdeps\uno_wifi_rev2\Servo)
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\uno_wifi_rev2\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 1.5% (used 90 bytes from 6144 bytes)
Flash: [= ] 7.6% (used 3714 bytes from 48640 bytes)
.pio\build\uno_wifi_rev2\firmware.elf :
section size addr
.data 14 8398848
.text 3536 512
.rodata 164 20432
.bss 76 8398862
.comment 17 0
.note.gnu.avr.deviceinfo 64 0
.debug_aranges 416 0
.debug_info 11869 0
.debug_abbrev 9132 0
.debug_line 2445 0
.debug_str 3979 0
Total 31712
<lambda>(["upload"], [".pio\build\uno_wifi_rev2\firmware.hex"])
AVAILABLE: xplainedmini_updi
CURRENT: upload_protocol = xplainedmini_updi
BeforeUpload(["upload"], [".pio\build\uno_wifi_rev2\firmware.hex"])
avrdude -v -p atmega4809 -C "C:\Users\Wong Zhi Wei\.platformio\packages\tool-avrdude-megaavr\avrdude.conf" -c xplainedmini_updi -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x02:m -Ulock:w:0xC5:m -U "flash:w:C:\Users\Wong Zhi Wei\.platformio\packages\framework-arduino-megaavr\bootloaders\atmega4809_uart_bl.hex:i" -b 115200 -V -e -D -P usb -U flash:w:.pio\build\uno_wifi_rev2\firmware.hex:i
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Wong Zhi Wei\.platformio\packages\tool-avrdude-megaavr\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini_updi
Overriding Baud Rate : 115200
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
AVR Part : ATmega4809
Chip Erase delay : 0 us
PAGEL : P00
BS2 : P00
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 0
StabDelay : 0
CmdexeDelay : 0
SyncLoops : 0
ByteDelay : 0
PollIndex : 0
PollValue : 0x00
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
prodsig 0 0 0 0 no 61 61 0 0 0 0x00 0x00
fuses 0 0 0 0 no 9 0 0 0 0 0x00 0x00
fuse0 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse1 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse2 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse4 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse5 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse6 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse7 0 0 0 0 no 1 0 0 0 0 0x00 0x00
fuse8 0 0 0 0 no 1 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 0 0 0x00 0x00
data 0 0 0 0 no 0 0 0 0 0 0x00 0x00
usersig 0 0 0 0 no 64 64 0 0 0 0x00 0x00
flash 0 0 0 0 no 49152 128 0 0 0 0x00 0x00
eeprom 0 0 0 0 no 256 64 0 0 0 0x00 0x00
Programmer Type : JTAGICE3_UPDI
Description : Atmel AVR XplainedMini in UPDI mode
ICE hardware version: 0
ICE firmware version: 1.19 (rel. 57)
Serial number : 3E8AF0BC6CAE72168E44
Vtarget : 5.00 V
JTAG clock megaAVR/program: 0 kHz
JTAG clock megaAVR/debug: 0 kHz
JTAG clock Xmega: 0 kHz
PDI clock Xmega : 0 kHz
avrdude: Partial Family_ID returned: "mega"
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.04s
avrdude: Device signature = 0x1e9651 (probably m4809)
avrdude: erasing chip
avrdude: reading input file "0x01"
avrdude: writing fuse2 (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of fuse2 written
avrdude: verifying fuse2 memory against 0x01:
avrdude: load data fuse2 data from input file 0x01:
avrdude: input file 0x01 contains 1 bytes
avrdude: reading on-chip fuse2 data:
Reading | ################################################## | 100% 0.01s
avrdude: verifying ...
avrdude: 1 bytes of fuse2 verified
avrdude: reading input file "0xC9"
avrdude: writing fuse5 (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of fuse5 written
avrdude: verifying fuse5 memory against 0xC9:
avrdude: load data fuse5 data from input file 0xC9:
avrdude: input file 0xC9 contains 1 bytes
avrdude: reading on-chip fuse5 data:
Reading | ################################################## | 100% 0.01s
avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "fuse5", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xcd instead of 0xc9 (double check with your datasheet first).
avrdude: 1 bytes of fuse5 verified
avrdude: reading input file "0x02"
avrdude: writing fuse8 (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of fuse8 written
avrdude: verifying fuse8 memory against 0x02:
avrdude: load data fuse8 data from input file 0x02:
avrdude: input file 0x02 contains 1 bytes
avrdude: reading on-chip fuse8 data:
Reading | ################################################## | 100% 0.01s
avrdude: verifying ...
avrdude: 1 bytes of fuse8 verified
avrdude: reading input file "0xC5"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xC5:
avrdude: load data lock data from input file 0xC5:
avrdude: input file 0xC5 contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "C:\Users\Wong Zhi Wei\.platformio\packages\framework-arduino-megaavr\bootloaders\atmega4809_uart_bl.hex"
avrdude: writing flash (280 bytes):
Writing | ################################################## | 100% 0.12s
avrdude: 280 bytes of flash written
avrdude: verifying flash memory against C:\Users\Wong Zhi Wei\.platformio\packages\framework-arduino-megaavr\bootloaders\atmega4809_uart_bl.hex:
avrdude: load data flash data from input file C:\Users\Wong Zhi Wei\.platformio\packages\framework-arduino-megaavr\bootloaders\atmega4809_uart_bl.hex:
avrdude: input file C:\Users\Wong Zhi Wei\.platformio\packages\framework-arduino-megaavr\bootloaders\atmega4809_uart_bl.hex contains 280 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.10s
avrdude: verifying ...
avrdude: 280 bytes of flash verified
avrdude: reading input file ".pio\build\uno_wifi_rev2\firmware.hex"
avrdude: writing flash (4226 bytes):
Writing | ################################################## | 100% 1.06s
avrdude: 4226 bytes of flash written
avrdude: safemode: Fuses OK (E:FF, H:FF, L:FF)
avrdude done. Thank you.
==================================================================== [SUCCESS] Took 3.97 seconds ====================================================================
Terminal will be reused by tasks, press any key to close it.