找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4618|回复: 1
打印 上一主题 下一主题
收起左侧

新手心得 : 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  :
  • 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. 设计的时候,就直接把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

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:430492 发表于 2019-8-16 17:43 | 只看该作者
楼主厉害呀!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表