Can not upload any code with Platformio IDE

I can not upload any code to any arduino. If I use arduino ide the code is uploaded without problem.
Even using an empty code I can’t upload it.

#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

output on upload:

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/nanoatmega328.html
PLATFORM: Atmel AVR (3.4.0) > Arduino Nano ATmega328 
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash      
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr 5.1.0
 - tool-avrdude 1.60300.200527 (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 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\nanoatmega328\src\main.cpp.o
Archiving .pio\build\nanoatmega328\libFrameworkArduinoVariant.a
Compiling .pio\build\nanoatmega328\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\Print.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\WInterrupts.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\WString.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\abi.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\hooks.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\main.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\new.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\nanoatmega328\libFrameworkArduino.a
Linking .pio\build\nanoatmega328\firmware.elf
Checking size .pio\build\nanoatmega328\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.4% (used 9 bytes from 2048 bytes)
Flash: [          ]   1.4% (used 444 bytes from 30720 bytes)
Building .pio\build\nanoatmega328\firmware.hex
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Use manually specified: COM8
Uploading .pio\build\nanoatmega328\firmware.hex
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xf2
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xf2

avrdude done.  Thank you.

*** [upload] Error 1

Any idea?

Write board = nanoatmega328new in the platformio.ini instead?

Yes, board is ok. not working with nanoatmega328new or nanoatmega328

Regards and sorry for delay

Please show a working verbose upload in the Arduino IDE (File → Preferences → Tick on “Verbose” for Upload) and the output for a non-working project tasks → Advanced → Verbose Upload.

Arduino IDE:

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:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\Juan\AppData\Local\Temp\arduino_build_126460/sketch_feb24a.ino.hex"
avrdude: writing flash (2084 bytes):

Writing | ################################################## | 100% 0.29s

avrdude: 2084 bytes of flash written
avrdude: verifying flash memory against C:\Users\Juan\AppData\Local\Temp\arduino_build_126460/sketch_feb24a.ino.hex:
avrdude: load data flash data from input file C:\Users\Juan\AppData\Local\Temp\arduino_build_126460/sketch_feb24a.ino.hex:
avrdude: input file C:\Users\Juan\AppData\Local\Temp\arduino_build_126460/sketch_feb24a.ino.hex contains 2084 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.25s

avrdude: verifying ...
avrdude: 2084 bytes of flash verified

avrdude done.  Thank you.

Platformio:

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino; upload_port: COM8; monitor_port: COM8; monitor_speed: 9600)
----------------------------------------------------------------------------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/nanoatmega328.html
PLATFORM: Atmel AVR (3.4.0) > Arduino Nano ATmega328
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr 5.1.0
 - tool-avrdude 1.60300.200527 (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 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\nanoatmega328\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.4% (used 9 bytes from 2048 bytes)
Flash: [          ]   1.4% (used 444 bytes from 30720 bytes)
.pio\build\nanoatmega328\firmware.elf  :

section                    size      addr

.data                         0   8388864

.text                       444         0

.bss                          9   8388864

.comment                     17         0

.note.gnu.avr.deviceinfo     64         0

.debug_aranges               64         0

.debug_info                1898         0

.debug_abbrev              1482         0

.debug_line                 258         0

.debug_str                  520         0

Total                      4756
<lambda>(["upload"], [".pio\build\nanoatmega328\firmware.hex"])
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
BeforeUpload(["upload"], [".pio\build\nanoatmega328\firmware.hex"])
Use manually specified: COM8
avrdude -v -p atmega328p -C C:\Users\Juan\.platformio\packages\tool-avrdude\avrdude.conf -c arduino -b 57600 -D -P COM8 -U flash:w:.pio\build\nanoatmega328\firmware.hex:i

avrdude: Version 6.3, compiled on Sep 12 2016 at 17:24:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Juan\.platformio\packages\tool-avrdude\avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x37
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x37

avrdude done.  Thank you.

*** [upload] Error 1

Regards

Wrong baud in PlatformIO, right baud (115200) in Arduino IDE. Are you 100% sure you wrote nanoatmega328new in the platformio.ini? Did you use the project environment switcher to select the right project?