之前很是慚愧,寫了幾篇,雖然嘴上說太忙,還是懶病發作,就停了。沒有養成好習慣。 還有一個想吐槽下,這個傳圖片好麻煩啊啊啊 估計之前也是因為這個停了。。。
雖然還是對之前公司的項目非常感興趣,因為地域緣故,今年來還是換了工作,這邊項目還沒開始,陸陸續續到現在也有好幾個月時間,
也看了很多東西。回頭看看,啥記錄也沒有,也不知道是不是現在年紀大了,感覺啥東西也沒記住。看了點啥也不知道了。這次重新下決心,
爭取能夠每天記錄一下。最少也得把這個事情做完,以此勉勵自己。
本人之前ARM7 M0 M3 430 CY68013等等也都有接觸過,板子也買了一堆,不過原來那邊因為各種原因,基本上都是一個人在弄,事情
太多,軟件上的一直沒有系統的學習。430還算用的最多了,寫了一個生產檢測治具的代碼。其他相當於就是入了個門。這次項目下來,很可能是基於STM32 UCOS系統。重新學習下。爭取跟上時代。
雖然STM32已經很久,真的相當於是從0開始。這次一定要完完整整啃下來。
網上現在的資料基本上都是基於STM32官方固件庫V3.5的版本。各種視頻各種資料。這個是后面才看到的版本。
小白起手就直奔ST官網下來一堆資料,結果發現官方已經更新了固件庫,還有配套軟件幫助你自動生成代碼。但是固件庫已經是新版的V1.0 ,姑且稱他為V4.0吧。與原來的結構V3.5還是有一定的區別。
各種命名都有了一些變化。為了逼迫自己這次不要再各種參考代碼,還是覺得從最新的版本入手。多花一些時間,搞清楚為什么這么寫吧。
翻箱很久,找到一塊N年前買的基於STM32F107VCT 神州IV號的開發板。就基於這塊平台做我的STM32學習吧。
下載器原來的JLINK找不到了,公司有配ulink2,那就用ulink2吧。
背景介紹完畢,下面來講碰到的第一個心碎的問題,直接搞了半天,那個揪心。。。
問題1.1:開發板連接Ulink2后,只能下載一次程序,第二次就識別不了ULINK2,下載不了程序
為什么這么設置,是因為新手小白沒用過ULINK2啊,所以設置是參考ULINK2官方給的幫助文檔設置的。結果。。。。
將就解決:將BOOT0的跳線帽從FLASH啟動改成從ROM啟動,就不會出現上面問題。但是總不能老是這樣啊。然后各種查,各種試,各種崩潰
最終解決:把下面紅框那個從normail改成under Reset就好了。。。血淚教訓啊
那這個到底是什么意思,參考官方文檔,如下:
Debug
The Debug section controls caching, downloading, and device resetting options applied each time a debugging session is started.
Connect & Reset Options
control the instructions executed while connecting to target.
Connect controls the connection conditions.
- Connect — Normal stops the CPU at the currently executed instruction after connecting.
- Connect — with Pre-reset applies a hardware reset(HW RESET) before connecting to the device.
- Connect — under Reset holds the hardware reset(HW RESET) signal active while connecting to the device. Use this option when the user program disables the JTAG/SW interface.
Reset after Connect, if enabled, performs a reset operation as defined in the Reset drop-down list (see below), after connecting to the target. If disabled, the debugger just stops the CPU at the currently executed instruction after connecting. Refer also to Start Sequence for details.
Reset controls the RESET operations.
- Reset — HW RESET performs a hardware reset by asserting the hardware reset (HW RESET) signal.
- Reset — SYSRESETREQ performs a software reset by setting the SYSRESETREQ bit. The Cortex-M core and on-chip peripherals are reset.
- Reset — VECTRESET performs a software reset by setting the VECTRESET bit. Only the Cortex-M core is reset. The on-chip peripherals are not affected. For some Cortex-M devices, VECTRESET is the only way to reset the core. VECTRESET is not supported on Cortex-M0 and Cortex-M1 cores.
- Reset — Autodetect selects one of the above reset methods based on the target device. The SYSRESETREQ method is used if an unknown device is detected.
Stop after Bootloader stops the CPU after executing the bootloader instructions.
看上面的信息,就是Under Reset 與Normal區別就是一個只是停了CPU 一個在按整版的復位鍵。不知道是不是因為我的神州IV板子設計的緣故。。。
網上也有找到有人跟我碰到一樣的問題,如果親也是什么都試了不行的話,可以改這個看一下。。。
至於為什么。。。我也不知道。。。先Next吧。。。回頭理完再來看看。
如果有知道的大牛,還請多多指點。
——————————————————————————————————————————————————
。。因為未知的原因,又一次識別不了了。這次改什么設置都不能用。
然后最后用串口下載的方式,擦除整個FLASH,又可以了!
如果親們也再碰到,可以一試