今更STM32G0はぢめました
皆様あけましておめでとうございました!!
今年は初詣期間が2か月くらいあるそうなので全然遅くはないですね(手遅れ
さて、先月さらっと紹介したSTM32G0、秋月さんのところで9月に発売されていたのを
12月にようやく手に入れ、そして今ようやく記事にしてみた次第です。
STM32もついに8pinの世界に足を踏み入れてしまいましたがコアのほうもCorte-M0
じゃなくてM0+にパワーアップしています。しかしながらメモリ容量32kb、SRAMも
8kbもあるという小さなボディに大きな力を秘めているわけです!!
メモリ構造も慣れ親しんだSTM32の伝統のアドレス配置で移植も苦ではありません!
このマイコン用のプロジェクトの作成に当たってはSTM32G0-DISCOを参考にさせて
もらっております。
しかしピン数さすがに少なすぎできついですねこれ…どうしたらいいものか…
7,8ピンはSWDで潰れる…そして6ピンはLEDに使用済み…
この小規模なマイコンでもきることはやはり一つ…!I2C!!
PA9がリマップ済みになってるようなので用検討ですね…
ひとまずLチカできるレベルのプロジェクトをF0のプロジェクトをベースに拵えて
見ました…確認用の基板もやっけつ仕事で昔のLPC810基板に乗っけました。
デバッガの接続は定番のSWDです。8PinがSWCLK,7PinがSWDIOあとは電源の配線を
すればつながります。また、購入直後のSTM32G0の接続ではnReset(4Pin)の接続は
特に不要です!(重要)将来的にnResetをGPIO化して使う際には逆に邪魔になって
しまいますので…
OpenOCDはすでにG0シリーズの多くに対応しております。ねむいさんもG0用の
フラッシュ書き込み用のcfgを作成しました。
すでにOpenOCDのバイナリに収録済みです!
まずはVersaloonで書き込みしたところです。
> "C:¥Devz¥Coreutils¥bin¥make.exe" program
openocd -s C:/Devz/ARM/OCD/tcl -f interface/vsllink_swd.cfg -f target/stm32g0x_swd_flash.cfg -c "mt_flash main.elf"
Open On-Chip Debugger 0.11.0-rc1+dev-00032-gbd1adcffe (2021-01-23-19:37)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : VSLLink SWD mode enabled
swd
Info : Versaloon(0x15)by Simon(compiled on Sep 16 2014)
Info : USB_TO_XXX abilities: 0x0000176E:0x010001EF:0xC0000007
Info : clock speed 500 kHz
Info : SWD DPIDR 0x0bc11477
Info : stm32g0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32g0x.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08000c9c msp: 0x20002000
Info : device idcode = 0x10016466 (STM32G03/G04xx - Rev Z : 0x1001)
Info : flash size = 32kbytes
Info : flash mode : single-bank
Info : Padding image section 1 at 0x08000eac with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x08000eb0 .. 0x08000fff
Info : wrote 3760 bytes from file main.elf in 0.188402s (19.490 KiB/s)
Info : verified 3756 bytes in 0.029309s (125.148 KiB/s)
shutdown command invoked
> Process Exit Code: 0
> Time Taken: 00:01
Win10ではレジスタウインドウ使えませんがInsightのデバッグもすいすい
できちゃいます。
お次はSTLink(STM32-NucleoのSTLink/V2-1)でHLAデバイスとして
書き込んでみます。
> "C:¥Devz¥Coreutils¥bin¥make.exe" program
openocd -s C:/Devz/ARM/OCD/tcl -f interface/stlink.cfg -c "transport select hla_swd" -f target/stm32g0x_swd_flash.cfg -c "mt_flash main.elf"
Open On-Chip Debugger 0.11.0-rc1+dev-00032-gbd1adcffe (2021-01-23-19:37)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 500 kHz
Info : STLINK V2J33M25 (API v2) VID:PID 0483:3752
Info : Target voltage: 3.272439
Info : stm32g0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32g0x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08000c9c msp: 0x20002000
Info : device idcode = 0x10016466 (STM32G03/G04xx - Rev Z : 0x1001)
Info : flash size = 32kbytes
Info : flash mode : single-bank
Info : Padding image section 1 at 0x08000eac with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x08000eb0 .. 0x08000fff
Info : wrote 3760 bytes from file main.elf in 0.156605s (23.447 KiB/s)
Info : verified 3756 bytes in 0.031977s (114.706 KiB/s)
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
> Process Exit Code: 0
> Time Taken: 00:01
こんな感じでサクッと書くこむことができます。
ということでSTM32も8bitマイコンの牙城に続々と乗り込んできたおかげで
小粒マイコンも立派にSTM32として使えるような局面が出てくると思います。
今回はLEDの点滅だけですが豊富なメモリ資源とCPUスピードを利用してI2C
デバイスの制御にちゃれんぢしてみようと思います!
注:プロジェクトはまだ作成中のためもうしばらくお待ちください。
-
免責・連絡先は↑のリンクを
↓SNSもやってます↓
powered by まめわざ- ARM/STM32 (116)
- OpenOCD (27)
- ARM/NxP (34)
- ARM/Cypress (5)
- ARM/Others (3)
- ARM/Raspi (1)
- AVR (13)
- FPGA (4)
- GPS/GNSS (19)
- MISC (81)
- STM8 (2)
- Wirelessなアレ (16)
- おきぱ (1)
- ブラウザベンチマーク (28)
- 日本の自然歩道 (25)
- STM32U0はぢめました
⇒ ねむい (08/07) - STM32U0はぢめました
⇒ ひかわ (07/28) - STM32H5を使ってみる3 -待ち受ける初見殺しの罠たち-
⇒ ねむい (05/17) - STM32H5を使ってみる3 -待ち受ける初見殺しの罠たち-
⇒ どじょりん (05/16) - STM32H5を使ってみる3 -待ち受ける初見殺しの罠たち-
⇒ どじょりん (05/16) - いろいろ試す61(と今年の反省会)
⇒ ねむい (01/02) - いろいろ試す61(と今年の反省会)
⇒ ひかわ (01/02) - いろいろ試す61(と今年の反省会)
⇒ ひかわ (01/01) - STM32H5を使ってみる3 -待ち受ける初見殺しの罠たち-
⇒ ねむい (12/31) - STM32H5を使ってみる3 -待ち受ける初見殺しの罠たち-
⇒ ひかわ (12/31)
- October 2024 (1)
- September 2024 (1)
- August 2024 (1)
- July 2024 (1)
- June 2024 (1)
- May 2024 (1)
- April 2024 (1)
- March 2024 (1)
- February 2024 (2)
- January 2024 (1)
- December 2023 (4)
- November 2023 (2)
- October 2023 (2)
- September 2023 (1)
- August 2023 (2)
- July 2023 (1)
- June 2023 (2)
- May 2023 (3)
- April 2023 (1)
- March 2023 (1)
- February 2023 (1)
- January 2023 (1)
- December 2022 (2)
- November 2022 (1)
- October 2022 (1)
- September 2022 (1)
- August 2022 (1)
- July 2022 (1)
- June 2022 (1)
- May 2022 (1)
- April 2022 (1)
- March 2022 (1)
- February 2022 (1)
- January 2022 (1)
- December 2021 (2)
- November 2021 (2)
- October 2021 (1)
- September 2021 (1)
- August 2021 (1)
- July 2021 (1)
- June 2021 (1)
- May 2021 (1)
- April 2021 (1)
- March 2021 (1)
- February 2021 (1)
- January 2021 (1)
- December 2020 (3)
- November 2020 (1)
- October 2020 (1)
- September 2020 (1)
- August 2020 (1)
- July 2020 (1)
- June 2020 (2)
- May 2020 (1)
- April 2020 (1)
- March 2020 (1)
- February 2020 (1)
- January 2020 (1)
- December 2019 (3)
- November 2019 (1)
- October 2019 (1)
- September 2019 (2)
- August 2019 (1)
- July 2019 (1)
- June 2019 (1)
- May 2019 (1)
- April 2019 (1)
- March 2019 (1)
- February 2019 (1)
- January 2019 (1)
- December 2018 (3)
- November 2018 (2)
- October 2018 (1)
- September 2018 (1)
- August 2018 (1)
- July 2018 (1)
- June 2018 (1)
- May 2018 (1)
- April 2018 (2)
- March 2018 (1)
- February 2018 (1)
- January 2018 (1)
- December 2017 (2)
- November 2017 (2)
- October 2017 (1)
- September 2017 (1)
- August 2017 (1)
- July 2017 (1)
- June 2017 (1)
- May 2017 (1)
- April 2017 (1)
- March 2017 (2)
- February 2017 (2)
- January 2017 (2)
- December 2016 (7)
- November 2016 (2)
- October 2016 (2)
- September 2016 (1)
- August 2016 (1)
- July 2016 (1)
- June 2016 (1)
- May 2016 (2)
- April 2016 (1)
- March 2016 (2)
- February 2016 (1)
- January 2016 (1)
- December 2015 (3)
- November 2015 (1)
- October 2015 (3)
- September 2015 (2)
- August 2015 (2)
- July 2015 (3)
- June 2015 (3)
- May 2015 (4)
- April 2015 (2)
- March 2015 (4)
- February 2015 (1)
- January 2015 (3)
- December 2014 (3)
- November 2014 (2)
- October 2014 (1)
- September 2014 (2)
- August 2014 (2)
- July 2014 (3)
- June 2014 (2)
- May 2014 (1)
- April 2014 (1)
- March 2014 (4)
- February 2014 (4)
- January 2014 (3)
- December 2013 (5)
- November 2013 (4)
- October 2013 (3)
- September 2013 (2)
- August 2013 (2)
- July 2013 (2)
- June 2013 (3)
- May 2013 (2)
- April 2013 (2)
- March 2013 (2)
- February 2013 (2)
- January 2013 (3)
- December 2012 (4)
- November 2012 (2)
- October 2012 (2)
- September 2012 (4)
- August 2012 (1)
- July 2012 (3)
- June 2012 (2)
- May 2012 (3)
- April 2012 (3)
- March 2012 (2)
- February 2012 (3)
- January 2012 (3)
- December 2011 (5)
- November 2011 (3)
- October 2011 (2)
- September 2011 (2)
- August 2011 (2)
- July 2011 (2)
- June 2011 (2)
- May 2011 (2)
- April 2011 (2)
- March 2011 (2)
- February 2011 (2)
- January 2011 (3)
- December 2010 (7)
- November 2010 (1)
- October 2010 (1)
- September 2010 (1)
- August 2010 (3)
- July 2010 (4)
- May 2010 (1)
- April 2010 (2)
- March 2010 (2)
- February 2010 (2)
- January 2010 (3)
- December 2009 (3)
- November 2009 (8)
- October 2009 (7)
- September 2009 (5)
- August 2009 (4)
- July 2009 (6)
- June 2009 (6)
- May 2009 (14)
- January 1970 (1)
Copyright(C) B-Blog project All rights reserved.