行業動態

Current Position: Home > News > 行業動態

Problems and solutions of debugger unable to connect to stm32

Source: 未知 Time:2020.06.22 View:3244

Many people have encountered the problem that debugger can not connect to STM32, whether it is j-link of IAR, ULINK of KEIL, or ST link of St. When this problem occurs, the debugging software will prompt that the connection with Cortex-M3 cannot be established, the program cannot be downloaded, or the device to be debugged cannot be found, etc.

Such problems occur when debugging modules that can run automatically without CPU intervention, or when debugging low-power mode programs.
The so-called "modules that can run automatically without CPU intervention" include: DMA, timer, ADC in continuous conversion mode, watchdog and other modules.
The root cause of this problem is:
1) The debugger needs to execute a program in RAM to write flash. If these auto running modules are not stopped, they will interfere with the execution of the program in RAM, resulting in download failure. For example, the DMA module is configured to copy a piece of data area continuously, and the debugger just needs to use the target area of DMA data transmission. At this time, the DMA operation will conflict with the debugger operation. For another example, if the watchdog is started and the hardware reset is not performed, the watchdog timeout will trigger the chip reset when the debugger needs to download the program next time, resulting in the download operation failure.

2) Low power consumption is realized by stopping the CPU clock. JTAG debugging is realized by communicating with the CPU. If the CPU clock is stopped, the debugger will lose communication with the CPU.
Some people say that "when I stop debugging, these modules have stopped running and should not interfere with subsequent debugging". This problem should be seen from several aspects:
1、 The debugger stops the running of the debugged program by stopping the clock of the CPU core. In fact, the hardware modules of the debugged chip have not been reset and they are still in the enabled state. Those modules that can run automatically are only in the suspended state. Once the clock is recovered, they will continue to run.
2、 At present, the commonly used debugging software, whether IAR EWARM or keil MDK, can not reset the hardware of the chip by the "reset" button on the debugging software interface. This "reset" button can only reset the software of the program in the chip, that is, to point the running pointer back to the address of the reset.
3、 The reset button on the board can be used to manually reset the hardware, so that all modules (including those capable of automatic operation) stop working and return to the reset state. But before the debugger needs to control the CPU, it needs to provide the clock for the CPU core, and then it needs a long period of time to do some initialization actions, and then it can take over the control of the CPU core. After the debugger provides the clock for the CPU core, the user program has started to run. If the user program initializes the hardware module and starts to run before the debugger takes over the control of the CPU core, there will still be conflicts with the debugger.
According to the above analysis, the key to solve this problem is that before the debugger takes over the control of the CPU core, all the operations that can automatically run the modules must be stopped to make them in a closed state. To achieve this, there are several schemes as follows:;
1) Every time you exit the debugging state, stop all modules, such as deinit() operation of the module.
2) At the beginning of the main() function, no matter what state each module is in, first execute the deinit() operation of the module, and then open the corresponding module at a later time in the program or when it is really needed. This ensures that the debugger has sufficient time to complete the initialization and download of the program when it just enters the debugging state. The deinit() operation of the module is performed first to close the modules that were opened by the last operation.
3) Adjust the setting of boot0 / boot1, change the startup mode to start from internal SRAM, and then combine with manual hardware reset. Since the state of BOOT0/BOOT1 is only meaningful when the hardware is reset, and the debugger does not make hardware reset, this setting will not affect the debugger's downloading program to Flash, nor will it affect the debugger in Flash.
主站蜘蛛池模板: 91精品欧美激情在线播放 | 日韩欧美在 | 最新热门电影电视剧免费在线观看 | 麻酥酥哟视频在线播放 | 国产伦精| 五月天婷婷丁香中文字幕 | 91精品国产乱码在线观看入 | 亚洲中文字幕一区精品自拍 | 国产精品秘入口免 | 手机午夜福利1000视频 | 全亚洲最大 | 亚洲精品国产美女在线观看 | 性直播视频在线观看免费 | 国产在线精品手机播放 | 亚洲欧美国产精品一区二区 | 欧美午夜成午夜成年片在线观看 | 亚洲日本aⅴ片在线观看香蕉 | 中文字幕在线不卡精品视频99 | 亚洲欧美日韩综合一区二区 | 欧美日韩国产一区二区三区不卡 | 日韩日日日 | 97dounai豆奶视频| 亚洲欧洲日产国码久在线观看 | 国产激情a∨在线视频播放 国产激情自拍亚洲精品国产精品精 | 亚洲中文字幕在线停止 | 天天射寡妇射 | 国产精品主播视频 | 青青在线视频 | 亚洲欧美日韩中文字幕在线不卡 | 国产极品翘臀在线观看 | 精品免费一区二区三区视频 | 天天a3极品a3私服 | 成人国产精品日韩 | 亚洲美女视频网 | 久热国产精品视频 | 国精产品48x国精产品 | 天堂资源中文在线 | 欧美性色黄大片www喷水 | 亚洲一区二区三区不卡在线播放 | 亚洲精品欧 | 国产精选在线观看 |