标题: 新手心得 : HAL 练习 STM32F030F4P6 [打印本页]

作者: jj449    时间: 2018-11-1 07:13
标题: 新手心得 : HAL 练习 STM32F030F4P6
初始運作只需三個外圍器件 , SWDIO跟  SWCLK 要接 10K 電阻(手上沒有10K,我用8.2K 運作也是OK的),Boot0接560R接地即可運作。VDDA,VDD,VSS(GND) ,Boot0(GND) 都要適當接好,不要懸空。 如果要使用 I2C , SPI ,畫板時記得給上 pull-up R ,並預先考慮兩個以上I2C 或 SPI  devices的狀況,預留線路,應該就能使用愉快。唯一的困難是像我這樣的新手,要手焊 tssop20 有點難,需要練習一下。 ram看起來不大,不過一般應用應該是夠了,除非遇到像需要點陣字表這類的東西,很耗費存儲的,那就看情況是否需要加外部存儲。
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, 下载次数: 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  :
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. 设计的时候,就直接把CPU的BOOT1引脚接地(始终为0),就没有BOOT1引脚了


作者: cooleaf    时间: 2019-8-16 17:43
楼主厉害呀!




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1