找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

帖子
查看: 5298|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

新手心得 : HAL 練習(xí) STM32F030F4P6

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
初始運(yùn)作只需三個(gè)外圍器件 , SWDIO跟  SWCLK 要接 10K 電阻(手上沒有10K,我用8.2K 運(yùn)作也是OK的),Boot0接560R接地即可運(yùn)作。VDDA,VDD,VSS(GND) ,Boot0(GND) 都要適當(dāng)接好,不要懸空。 如果要使用 I2C , SPI ,畫板時(shí)記得給上 pull-up R ,並預(yù)先考慮兩個(gè)以上I2C 或 SPI  devices的狀況,預(yù)留線路,應(yīng)該就能使用愉快。唯一的困難是像我這樣的新手,要手焊 tssop20 有點(diǎn)難,需要練習(xí)一下。 ram看起來(lái)不大,不過一般應(yīng)用應(yīng)該是夠了,除非遇到像需要點(diǎn)陣字表這類的東西,很耗費(fèi)存儲(chǔ)的,那就看情況是否需要加外部存儲(chǔ)。
32位元  mcu   , 32 !! 32 !! 32 !!   up to 48MHZ
16kB of flash and 4kB of SRAM  , I2C x1  , SPI x 1 , USART x 2 , tssop20 package , with internal clock (HSI)
cheap , stable , easy to use .
參考 en.CD00167594.pdf (3.52 MB, 下載次數(shù): 36)
VDD , VDDA –> 3.3V (VDDA  must  >=  VDD)
VSS –> GND
BOOT0 –> R —> GND
SWDIO –> 10K –> adaptor
SWCLK –> 10K –> adaptor
diy a breakout board ?
hardiest part is soldering mcu chip onto pcb  (for me) , need a little practice ..

easiest way to download sketch is   stlink-v2, so simplest HAL in cubeMX looks like this :
here , we use cubeMx + sw4stm32  as development tool .
1. in sw4stm32 , create a workspace
2. in cubeMx ,  assign project location in  that workspace , and check  “Generate Under Root “
3. after generating code , click “open” , then  sw4stm32 start !  enjoy !
if encounter any problem when flash  program , in sw4stm32  check  project debug  option .
project -> properties -> debug/run setting-> edit (or new)
here , make sure Interface = SWD , Reset = Software , and Frequency must equal to adaptor’s frequency 。
if we want to use I2C device , ex:  I2C oled , in cubeMx must configure it  right .
done !   now can try to  upload 1st   program .


Using OLED 1306  :
  • driver :  https://github.com/4ilo/ssd1306-stm32HAL
copy  inc/ssd1306.h  &  inc/font.h  to   inc/
copy  src/ssd1306.c  &  src/font.c  to   src/
modify  all   stm32fXXX_hal.h   to ur   _hal.h

done !



if u want to use UART to upload firmware :

VDDA should be connected to power, otherwise chip is in reset state. If package has VSSA – it also should be connected (to GND).
To enter boot mode it is sufficient to connect BOOT0 to power during reset. Do not get confused with absent BOOT1 pin – it is in proper state internally. 設(shè)計(jì)的時(shí)候,就直接把CPU的BOOT1引腳接地(始終為0),就沒有BOOT1引腳了
  • pin 16 (VDD) to +3.3
  • pin 5 (VDDA) to +3.3
  • pin 15 (GND) to GND
  • pin 1 (BOOT0) to +3.3
  • pin 4 (RESET) to GND, temporarily
  • pin 17 (USART1_TX) to RX of the FTDI-cable
  • pin 18 (USART1_RX) to TX of the FTDI-cable

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:430492 發(fā)表于 2019-8-16 17:43 | 只看該作者
樓主厲害呀!
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表