Stk500_disable(): protocol error

i get this error :

Arduino: 1.8.15 (Windows Store 1.8.49.0) (Windows 10), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

Sketch uses 8698 bytes (28%) of program storage space. Maximum is 30720 bytes.

Global variables use 310 bytes (15%) of dynamic memory, leaving 1738 bytes for local variables. Maximum is 2048 bytes.

C:\Users\Commander\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Commander\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM7 -b57600 -D -Uflash:w:C:\Users\COMMAN~1\AppData\Local\Temp\arduino_build_628310/Thermistor-Serial.ino.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\Commander\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"



     Using Port                    : COM7

     Using Programmer              : arduino

     Overriding Baud Rate          : 57600

     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: 2

     Firmware Version: 1.16

     Vtarget         : 0.0 V

     Varef           : 0.0 V

     Oscillator      : Off

     SCK period      : 0.1 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\COMMAN~1\AppData\Local\Temp\arduino_build_628310/Thermistor-Serial.ino.hex"

avrdude: writing flash (8698 bytes):

Writing | ################################################## | 100% 2.46s

avrdude: 8698 bytes of flash written

avrdude: verifying flash memory against C:\Users\COMMAN~1\AppData\Local\Temp\arduino_build_628310/Thermistor-Serial.ino.hex:

avrdude: load data flash data from input file C:\Users\COMMAN~1\AppData\Local\Temp\arduino_build_628310/Thermistor-Serial.ino.hex:

avrdude: input file C:\Users\COMMAN~1\AppData\Local\Temp\arduino_build_628310/Thermistor-Serial.ino.hex contains 8698 bytes

avrdude: reading on-chip flash data:

Reading | ##

avrdude: stk500_paged_load(): (a) protocol error, expect=0x10, resp=0x00

avrdude: stk500_cmd(): programmer is out of sync

avr_read(): error reading address 0x0000

read operation not supported for memory "flash"

avrdude: failed to read all of flash memory, rc=-2

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xe0

avrdude done. Thank you.

the selected serial port

does not exist or your board is not connected

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

and this is "my" code (i say "my" because most of it is another persons code (which still dosent work but thats not why im here))


  Voltage divider
  R1 = 10K resistor (Vcc and common point)
  r2 = 10K THERMISTOR (GND and common point)
  Vo = pin A1 (common point


  Pin connections
  Arduino   device
  5V        resistor
  GND       Thermistor
  A0        Voltage divider Vo (common point between termistor and resistor)
  A1
  A2
  A3
  A4
  A5
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  SDA
  SLC

*/
#define PW 13

int TR_PIN = A0;
double a1, b1, c1, d1, r2, r1, vo, tempC, tempF, tempK;

void setup()
{
  Serial.begin(9600);
  a1 = 3.354016E-03 ;
  b1 = 2.569850E-04 ;
  c1 = 2.620131E-06 ;
  d1 = 6.383091E-08 ;

  r1 = 9720.0;

  pinMode(TR_PIN, INPUT);

  pinMode(PW, OUTPUT);
  digitalWrite(PW, HIGH);
}

void loop()
{

  // read the temp
  vo = analogRead(TR_PIN);
  vo = vo / (1023.0 / 5.0);

  // voltage divider calculation
  // vo = 5 * r2 /(r1+r2)
  // solve for r2
  // get the exact value for voltage divider r1

  r2 = ( vo * r1) / (5.0 - vo);

  //equation from data sheet
  tempK = 1.0 / (a1 + (b1 * (log(r2 / 10000.0))) + (c1 * pow(log(r2 / 10000.0), 2.0)) + (d1 * pow(log(r2 / 10000.0), 3.0)));
  tempC  = (tempK - 273.15);
  tempF  = (tempC * 1.8) + 32.0;

  Serial.println("Temp - degK " + String(tempK));
  Serial.println("Temp - degC " + String(tempC));
  Serial.println("Temp - degF " + String(tempF));
  Serial.println(" ");


  if(tempF >= 150.0){
    digitalWrite(PW,LOW);
    Serial.println("its off at : ");
    Serial.println(tempF);
   }
  Serial.println("its still on at : ");
  Serial.println(tempF);
  delay(1000);
  
}```

idk why im getting this error and it happend out of no where