如何使用SWD&如何使用SWD& openOCD而不停止处理器?
我正在尝试学习如何使用SWD& OpenOCD。
while (1)
{
my_count++;
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
HAL_Delay(750);
}
在我的MCU上运行的代码具有免费的运行计数器“ my_count”。我想实时采样/跟踪存储在“ my_count”地址中的数据: 我这样做:
while(1){// generic algorithm no specific language
mdw 0x00000000200000ac; //openOCD command to read from an address
}
0x200000ac是.map文件中变量my_count的地址。 但是,此方法非常缓慢,并且经验数据以高频下降。 还有其他方法可以在高频下跟踪数据而不经历数据下降吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我做了一些餐巾,我有一个可能起作用的想法。
按照,STM32F334 UART的最大波特率为9mbit/s。
如果我们想在特定地址发送内存,则将是32位。 1位采用1/9Mbps或1.111*10^(-7)S,将其乘以32位,这使得它3.555微秒。显然,正如我所说,这纯粹是餐巾纸数学。涉及起点和停止位。但是我们有很多摆动的房间。您也可以轻松地将64位适合变速箱。
现在,我已经检查了互联网,似乎基于STM32F103的ST-Link的最大BAUD率为4.5Mbps。一个令人毛骨悚然的人,但我们只需要加倍时间。 3.55*2 = 7.1us,用于32位,14.2us用于64位传输。即使鉴于有一定的起点和停止的开销,我们似乎仍然适合25US的预算。
因此,建议如下:
您将计时器设置为25US时期,该计时器会启动中断,从而激活DMA UART传输。这样,您的MCU实际上几乎没有开销,因为DMA将自动处理变速箱,而您的MCU可以在此期间做任何想要的事情。实际上,进入和退出计时器ISR将是由此造成的间接费用的最大部分,因为在ISR中,您将实际上翻转一对位,告诉DMA通过uart @ 4.5Mbps发送东西。
I made some napkin math, and I have an idea that may work.
As per Reference Manual, page 948, the max baud rate for UART of STM32F334 is 9Mbit/s.
If we want to send memory at the specific address, it will be 32 bits. 1 bit takes 1/9Mbps or 1.111*10^(-7)s, multiply that by 32 bits, that makes it 3.555 microseconds. Obviously, as I said, it's purely napkin math. There are start and stop bits involved. But we have a lot of wiggle room. You can easily fit 64 bits into transmission too.
Now, I've checked with the internet, it seems the ST-Link based on STM32F103 can have max baud rate of 4.5Mbps. A bummer, but we simply need to double our timings. 3.55*2 = 7.1us for 32-bit and 14.2us for 64-bit transmission. Even given there is some start and stop bit overhead, we still seem to fit into our 25us time budget.
So the suggestion is the following:
You have a timer set to 25us period that fires an interrupt, that activates DMA UART transmission. That way your MCU actually has very little overhead since DMA will autonomously handle the transmission, while your MCU can do whatever it wants in the meantime. Entering and exiting the timer ISR will be in fact the greatest part of the overhead caused by this, since in the ISR you will literally flip a pair of bits to tell DMA to send stuff over UART @ 4.5Mbps.