STM32F302中的SWV - printf()具有不同的字符

发布于 2025-01-11 06:43:27 字数 771 浏览 4 评论 0原文

我发现一些答案并没有解决我的 STM32F302 问题。 我将调试运行配置为 SWV ITM 数据控制台中的 printf()

IMG-Debug_Config

我实现了 _write 函数,如下所示:

int _write(int file, char *ptr, int len)
{
     int DataIdx;
     for (DataIdx = 0; DataIdx < len; DataIdx++)
     {
         ITM_SendChar((*ptr++));
     }
     return len;
}

并尝试为“异步跟踪”和“串行线”设置系统时钟,但没有成功,而且我一直得到相同的结果输出(SWV Graph 也不起作用):

IMG-SWV_Output

关于此问题有什么建议吗?我只想调试变量以确保获得正确的测量结果。

PS。我的项目简介:用于光传感器的 ADC。我需要根据激光样品测量生成图表。使用 STM32 和光电二极管进行测量,完成测量并将 .csv 或 .txt 从 USB 发送到计算机以分析数据。

I found some answers that didn't solve my issue for STM32F302.
I configured the debug run as follows, to printf() in the SWV ITM Data Console:

IMG-Debug_Config

I implemented the _write function as follows:

int _write(int file, char *ptr, int len)
{
     int DataIdx;
     for (DataIdx = 0; DataIdx < len; DataIdx++)
     {
         ITM_SendChar((*ptr++));
     }
     return len;
}

And tried to setup the sys clock for "Asynchronous Trace" and "Serial Wire", none worked and I keep getting the same output (SWV Graph does not work either):

IMG-SWV_Output

Any suggestion about this issue? I just want to debug the variable to make sure I'm getting the correct measurement.

PS. Just a brief of my project: An ADC for a light sensor. I need to generate a graph from a laser sample measurement. Make this measurement with the STM32 and a photodiode, finish the measurement and send the .csv or .txt from USB to a computer to analyse the data.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

书间行客 2025-01-18 06:43:27

我发现我的问题是:

调试设置中的“核心时钟(MHz)”是错误的,这就是我的 SWV 无法正常工作的原因

I found what my problem was:

My "Core Clock (MHz)", in the debug settings, was wrong and that's why my SWV was not working properly

寄意 2025-01-18 06:43:27

如果没有 SWV 数据 - 您需要将 SWO 引脚连接到 ST-LINKV2。 SWV 数据传输位于 SWO 引脚上。在我的 STM32F3DISCOVERY 上,SB10 没有焊接,SB10 将 PB3 SWO 引脚连接到 T_SWO 调试器网络。焊接后SB10 SWV 工作完美。

If no SWV data - you need to connect the SWO pin to ST-LINKV2. The SWV data transmission is on the SWO pin. On my STM32F3DISCOVERY, the SB10 was not soldered, SB10 connecting the PB3 SWO pin to the T_SWO debugger net. After soldering SB10 SWV work perfectly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文