Atmel328 external clock 8mhz

Hello,

I try to use PlatformIO to upload an Arduino program to a Atmel328 with a 8mhz external clock.
I always receive these error messages

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x4f
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x46
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x46
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x0d
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x4f
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x4e
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x0d
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x4f

All is fine, when I put a 16MHz xtal.

I also try on the Arduino IDE, I don’t have trouble wit hthe 8MHz xtal if I use the
MiniCore platform.

Many thanks for your help

I think you need to set board_build.f_cpu=8000000L in platformio.ini

See documentation: ATmega328P/PA — PlatformIO latest documentation

I try but I receive these error messages when I put this line in the platform.ini file

here is my env

platform = atmelavr
board=uno
framework = arduino
lib_deps = pierremolinaro/ACAN2515@^2.1.3
monitor_speed = 115200
board_build.f_cpu=8000000L
; change microcontroller
board_build.mcu = atmega328p