arduino pro mini ATMEGA328P 連線和點亮第一盞LED(同時記錄燒錄失敗的問題stk500_recv)

直接跟TB抓了張圖作爲開始

與其他arduino的開發板不同的是,這塊板子沒有USB接口,所以我們無法直接連接到電腦~ 

這時候我們需要的是通過TTL方式連接,使用 VCC GND TX RX

 

 

這裏我們需要的是USB轉TTL的轉接板,我這個是 ch340g,也就是很多開發板上都會集成的廉價國產芯片,國外很多板子喜歡使用的是cp210x 系列的芯片,還有 pl230x 系列的(大鍋蓋中9升級更新用這個芯片)

(上面的就是ch340g)

下面給張正面照

多手截圖,選擇開發板的位置,處理器注意選擇對應的型號(看不清就點開或者另存爲,都是大圖)

這裏需要注意的除了使用5v或者3.3v去接arduino的vcc,gnd接gnd,RX和TX是反接的(上面的RX接下面的TX)

 

敲黑板的重點!!!!!

提前看好了 arduino這塊板子的供電是 5v 還是 3.3v,如果操作不當看錯了參數小心冒煙,雖然短時間不會壞,但能活多久這是個問題)

然後是準備一個代碼用來測試


void setup() {
  delay(2000);
  Serial.begin(115200);
  Serial.println("LED blink");
  // 這裏會輸出13,因爲println後面要求是字符串,因此想要看東西要強轉String
  Serial.println(String(LED_BUILTIN)); 
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT); // 指定這個針腳是用來做輸出使用的,對應的也就是高低電平 1和0
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                       // wait for a second
}

寫在最後這裏的另一個重點是!!!!

每次點右箭頭→但是程序運行到上圖位置之後會提示錯誤(後面還有重複10次都失敗的提示)

avrdude: stk500_recv(): programmer is not responding

因爲程序運行到這個位置的時候需要你 手動RST 復位板子(pro mini 有一個板載按鈕,作用雖然是復位,但是燒錄的時候也需要你在程序停在上圖位置的時候按一下。)

         Using Programmer              : arduino
         Overriding Baud Rate          : 57600

然後程序會繼續寫入,同樣

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Administrator.T420\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14/etc/avrdude.conf"

         Using Port                    : COM3
         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\ADMINI~1.T42\AppData\Local\Temp\arduino_build_450173/ProMini-Blink.ino.hex"
avrdude: writing flash (3350 bytes):

Writing | ################################################## | 100% 1.00s

avrdude: 3350 bytes of flash written
avrdude: verifying flash memory against C:\Users\ADMINI~1.T42\AppData\Local\Temp\arduino_build_450173/ProMini-Blink.ino.hex:
avrdude: load data flash data from input file C:\Users\ADMINI~1.T42\AppData\Local\Temp\arduino_build_450173/ProMini-Blink.ino.hex:
avrdude: input file C:\Users\ADMINI~1.T42\AppData\Local\Temp\arduino_build_450173/ProMini-Blink.ino.hex contains 3350 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.74s

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

avrdude done.  Thank you.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章