RASPBERRY PI PICO 樹莓派PICO開發板雙核高性能低功耗RP2040芯片

      網友投稿 1064 2022-05-28

      01

      RASPBERRY PICO

      1.簡介

      RaspBerry Pi Pico是一款低價格、高性能的微控制器電路板,具有豐富靈活的數字接口,主要特點包括有:

      RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom

      Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz

      264KB of SRAM, and 2MB of on-board Flash memory

      Castellated module allows soldering direct to carrier boards

      USB 1.1 with device and host support

      Low-power sleep and dormant modes

      Drag-and-drop programming using mass storage over USB

      26 × multi-function GPIO pins

      2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels

      Accurate clock and timer on-chip

      Temperature sensor

      Accelerated floating-point libraries on-chip

      8 × Programmable I/O (PIO) state machines for custom peripheral support

      相關資料鏈接:

      RP2040 DataSheet

      Raspberry Pi Pico 數據手冊

      Pico Python SDK

      2.實驗電路板

      今天剛剛從 RASPBERRY淘寶購買(¥:44.99)的 RP2040剛剛到貨了。

      兩個購買的連接:

      https://item.taobao.com/item.htm?spm=a1z09.2.0.0.7dfc2e8dr0gXNj&id=637379855715&_u=onvskcd1abb :¥:39.99

      RASPBERRY 淘寶購買(¥44.99)

      相關的資料可以在 RaspBerry PI PICO官方網站 尋找。

      02

      初步測試

      1.焊接排針

      焊接之后,使用USB電纜連接到電腦,會出現一個名字為:RPI-RP2磁盤號碼。其中包括有:

      2.初步使用PICO

      根據 Getting started with MicroPython 中的的Drag and Drop MicroPython的操作步驟,將下載 Download UF2 File 的

      pico_micropython_20210121.uf2

      拷貝到RPI-RP2磁盤,對于PI PICO進行處世王MicroPython解釋器。

      RPII-RP2磁盤消失。不過計算器出現了一個初始化錯誤的USB設備:

      3.供PICO 5V電源

      根據PICO數據手冊介紹,VSYS是供給電路板5V電源的引腳。按照下面連接方式在面包板上給PICO施加5V電源。

      錯誤:在一開始的時候,給PICO出現正負極性相反。在限流DC+5V作用下,供電電流別限制在1A的幅值。

      靜態電路板工作電流: 16.5mA。

      3V3 OUT(PIN36) : 3.258V

      RUN(PIN30):3.3V

      TX(PIN1) :0V

      奇詭

      RX(PIN2) : 0V

      奇詭

      注意:

      既然已經初始化成立MicroPython工作的狀態,為什么TX0,RX0初始化后的電壓為0V?*

      4.測試TX,RX

      利用STM32的下載傳寶連接PICO的 UART0的TX(PIN1),RX(PIN2)測試它對于外部發送的信號的相應。

      在PICO上電過程中在TX沒有測量到任何字符輸出。

      03

      安裝Board CDC 驅動

      1.下載MicroPytho Firmware

      從 MicroPython 網站下載 Firmware for Raspberry PI Pico 最新的UF2。根據前面的操作方式,按住BOOTSEL按鍵將RASPBERRY接入PC的USB(Mini-USB)。將下載的Firmware拷貝進入出現的新的U盤內。系統重新啟動,出現新的設備。

      但是在Win7下,CDC無法自動安裝驅動。根據 樹莓派 PI Pico 安裝 MicroPython 后會出現 Board CDC 未知設備 的說法:

      樹莓派 PI Pico 安裝 MicroPython 后會出現 Board CDC 未知設備的解決辦法

      https://files.cnblogs.com/files/czcbzc/Board_CDC_RP2_pico-serial.zip

      然后在設備管理器中手動安裝

      自動安裝不了

      在https://files.cnblogs.com/files/czcbzc/Board_CDC_RP2_pico-serial.zip下載: Board CDC Driver

      2.測試串口

      使用STM32Bootload界面測量Pi Pico Serial Port。但是并沒有接收到任何對應的反饋響應信息。

      3.使用Python測試

      使用Python直接對串口進行操作,可以得到對應的結果。

      #!/usr/local/bin/python # -*- coding: gbk -*- #============================================================ # TEST1.PY -- by Dr. ZhuoQing 2021-02-24 # # Note: #============================================================ from head import * import serial from _ast import Or from serial.serialutil import SerialException #------------------------------------------------------------ sport = serial.Serial() sport.baudrate = 115200 sport.timeout = 0.05 try: sport.port = 'COM6' except: printf('Set sport port COM6 error. ') try: sport.open() except serial.serialutil.SerialException: printf('Open sport port COM6 error.') else: printf('Open sport port COM6 Ok.') #------------------------------------------------------------ sport.write(b"2**3\r\r\r") printf(sport.read(100).decode('utf-8')) #------------------------------------------------------------ # END OF FILE : TEST1.PY #============================================================

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      輸出結果:

      Open sport port COM6 Ok. 2**3 8 >>> >>> >>>

      1

      2

      3

      4

      5

      6

      輸入“help()”最終輸出內容:

      help() Welcome to MicroPython! For online help please visit https://micropython.org/help/. For access to the hardware use the 'machine' module. RP2 specific commands are in the 'rp2' module. Quick overview of some objects: machine.Pin(pin) -- get a pin, eg machine.Pin(0) machine.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p methods: init(..), value([v]), high(), low(), irq(handler) machine.ADC(pin) -- make an analog object from a pin methods: read_u16() machine.PWM(pin) -- make a PWM object from a pin methods: deinit(), freq([f]), duty_u16([d]), duty_ns([d]) machine.I2C(id) -- create an I2C object (id=0,1) methods: readfrom(addr, buf, stop=True), writeto(addr, buf, stop=True) readfrom_mem(addr, memaddr, arg), writeto_mem(addr, memaddr, arg) machine.SPI(id, baudrate=1000000) -- create an SPI object (id=0,1) methods: read(nbytes, write=0x00), write(buf), write_readinto(wr_buf, rd_buf) machine.Timer(freq, callback) -- create a software timer object eg: machine.Timer(freq=1, callback=lambda t:print(t)) Pins are numbered 0-29, and 26-29 have ADC capabilities Pin IO modes are: Pin.IN, Pin.OUT, Pin.ALT Pin pull modes are: Pin.PULL_UP, Pin.PULL_DOWN Useful control commands: CTRL-C -- interrupt a running program CTRL-D -- on a blank line, do a soft reset of the board CTRL-E -- on a blank line, enter paste mode For further help on a specific object, type help(obj) For a list of available modules, type help('modules') >>>

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      4.閃爍LED(PIN25)

      sport.write(b"from machine import Pin\r") sport.write(b"led = Pin(25, Pin.OUT)\r") for i in range(100): sport.write(b"led.value(1)\r") time.sleep(.5) sport.write(b"led.value(0)\r") time.sleep(.5) printf(sport.read(10000).decode('utf-8'))

      1

      2

      3

      4

      5

      RASPBERRY PI PICO 樹莓派PICO開發板雙核高性能低功耗RP2040芯片

      6

      7

      8

      9

      10

      5.上載完整程序

      上載一個執行程序,需要將前面運行的程序中斷,然后輸入程序,最后執行。

      下面給出了對應的過程:

      #!/usr/local/bin/python # -*- coding: gbk -*- #============================================================ # TEST1.PY -- by Dr. ZhuoQing 2021-02-24 # # Note: #============================================================ from head import * import serial from _ast import Or from serial.serialutil import SerialException #------------------------------------------------------------ sport = serial.Serial() sport.baudrate = 115200 sport.timeout = 0.05 try: sport.port = 'COM6' except: printf('Set sport port COM6 error. ') try: sport.open() except serial.serialutil.SerialException: printf('Open sport port COM6 error.') else: printf('Open sport port COM6 Ok.') #------------------------------------------------------------ sport.write(b'\x04') sport.write(b"from machine import Pin, Timer\r") sport.write(b"led = Pin(25, Pin.OUT)\r") sport.write(b"tim = Timer()\r") sport.write(b"def tick(timer):\r") sport.write(b"global led\r") sport.write(b"led.toggle()\r") sport.write(b"\r") sport.write(b"\r") sport.write(b"\r") sport.write(b"tim.init(freq=10, mode=Timer.PERIODIC, callback=tick)\r") printf(sport.read(10000).decode('utf-8')) #------------------------------------------------------------ # END OF FILE : TEST1.PY #============================================================

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      38

      39

      40

      41

      42

      43

      44

      45

      46

      47

      48

      49

      程序執行后的結果返回:

      Open sport port COM6 Ok. MPY: soft reboot MicroPython v1.14 on 2021-02-24; Raspberry Pi Pico with RP2040 Type "help()" for more information. >>> from machine import Pin, Timer >>> led = Pin(25, Pin.OUT) >>> tim = Timer() >>> def tick(timer): ... global led ... led.toggle() ... ... ... >>> tim.init(freq=10, mode=Timer.PERIODIC, callback=tick) >>>

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      ▌結論

      對于剛剛到貨的Raspberry PI Pico 電路板焊接相關外接的引腳,并通過Micro USB 線纜對于電路板初始化成對應的MicroPython狀態。

      通過實驗發現遇到了兩個問題:

      1) USB對應的CDC出現了初始化錯誤:這部分通過 第3部分,下載對應的Board-CDC驅動解決了。

      2)電路板初始化對應的串口輸出電平是低電平,說明電路板實際上并沒有工作在MicroPython的 REPL狀態。這部分根據手冊給出,說明內核需要重新進行編譯之后才能夠將REPL落實在對應的串口上。

      此時,這兩個電路板還無法進行相應的實驗。

      ■ 相關文獻鏈接:

      RP2040 DataSheet

      Raspberry Pi Pico 數據手冊

      Pico Python SDK

      RASPBERRY淘寶購買

      Getting started with MicroPython

      Download UF2 File

      Getting Started with Raspberry Pi Pico using MicroPython and C

      Raspbery PI RP2040

      Download Firmware.uf2

      史上最全ASCII碼對照表0-255(%d)

      單片機 硬件開發

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      上一篇:Visual studio2017+qt5.14安裝環境配置
      下一篇:盤點那些進行“網絡編程”必須要知道的基礎知識!
      相關文章
      亚洲精品字幕在线观看| 亚洲激情在线观看| 亚洲精品456播放| 亚洲国产亚洲片在线观看播放| 亚洲国产精品无码专区在线观看| 亚洲精品视频在线看| 亚洲AV成人片无码网站| 亚洲sm另类一区二区三区| 亚洲三级高清免费| 亚洲欧洲精品一区二区三区| 亚洲综合激情九月婷婷| 亚洲精品视频专区| 亚洲国产精品xo在线观看| 亚洲男人电影天堂| 亚洲人成人77777在线播放| 亚洲图片激情小说| 亚洲av永久无码精品天堂久久 | 亚洲AV综合色区无码二区偷拍 | 亚洲精品资源在线| 亚洲综合一区二区国产精品| 亚洲一区免费观看| 亚洲欧洲日产专区| 亚洲av无码专区在线| 亚洲人av高清无码| 国产精品亚洲综合网站| 苍井空亚洲精品AA片在线播放 | 久久精品国产亚洲av日韩| 99久久精品国产亚洲| 亚洲毛片基地日韩毛片基地| 亚洲专区中文字幕| 亚洲国产AV无码一区二区三区 | 久久久久亚洲精品无码蜜桃| 亚洲欧洲国产综合| 中日韩亚洲人成无码网站| 亚洲av乱码中文一区二区三区| 无码天堂va亚洲va在线va| 亚洲精品无码专区2| 国产亚洲精品国产| 在线观看亚洲一区二区| 国产精品亚洲精品青青青| 国产亚洲一卡2卡3卡4卡新区|