行業動態

Current Position: Home > News > 行業動態

Problems and solutions of debugger unable to connect to stm32

Source: 未知 Time:2020.06.22 View:3046

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.
主站蜘蛛池模板: 狠狠人妻久久久久久综合蜜桃 | 精品人人搡人妻人人玩A片 性无码一区二区三区无码免费 | 国产美女裸体网站 | 999zyz玖玖资源站永久无码 | 精品成人AV一区二区在线播放 | AV无码高清 | 日韩有码在线视频 | 国模大胆无码一区二区 | 69成人电影 | 亚洲精品久久久久久久蜜桃 | (高潮3)无删减)无码 | 亚洲午夜AV久久乱码 | 国产精品成人AV禁果AV | 免费看无码一级A片放24小时 | 免费看无码 | 国产激情第二页 | 亚洲一区av| 91精品久久久 | 91天媒传媒A在线视频.全程高清完整版免费看 | 亚洲一区二区三区乱码 | 亚洲AV无码A片在线观看蜜桃 | 国产精品伦子伦露脸 | 免费 无码 在线观看国产不 | 国产十日韩十成人 | 少妇无码无套av一区 | AV无码在线免费 | 亚洲AV无码成人网站国产网址 | 精品人妻无码一区二区三级精东 | 东京热AV网站 | 午夜10000 | 欧美日韩午夜 | 亚洲AV无码成人网站国产网站 | 美女写真理伦片在线看 | AV无码在线免费观看 | 69久蜜桃人妻无码精品一区 | 精品无码av无码免费专区 | 亚洲AV无码成人片在线观看一区 | 天天综合网,7799精品视频天天看 | 69成人电影 | 丰满人妻熟妇乱又伦精品凤鸣阁 | 免费 无码 国产在线观看午夜 |