STM32F4-传感器数据处理-ADC-> USB/以太网 - > PC -USB示波器
我目前正在研究一个有关“传感器信号数字化”的项目。传感器信号应使用ADC数字化,并通过接口(例如USB或以太网)传递到PC。理想情况下,ADC在2个Megasample/s和12位的连续模式下工作。连续数字化期间发生的数据量可能只能通过以太网管理。另外,不连续的记录为5毫秒记录,暂停为45ms。
目前,我使用核-F429ZI。可以通过HAL或MATLAB/SIMULINK完成编程。 Matlab Simulink为编程提供了合适的GUI,除其他方面用于以太网。但是,GUI并不适用于所有核板。不幸的是,不支持F429ZI。
我目前正在考虑如何最好地实施该项目。 MATLAB之后,我也想处理数字化数据。在这方面,在Simulink中执行编程是很有意义的。为此,我也愿意切换到另一个董事会。
我已经有MATLAB的经验,但是在HAL中编程的经验较少。你会建议我什么?您还有其他提示吗?
非常感谢!
I am currently working on a project about "Digitization of sensor signals". The sensor signal is to be digitized with an ADC and passed on to the PC via an interface, e.g. USB or Ethernet. Ideally, the ADC works in continuous mode at 2 megasample/s and 12 bit. The amount of data that occurs during continuous digitization will probably only be manageable via Ethernet. Alternatively, discontinuous recording with 5ms recording each and a pause of 45ms.
Currently I use a Nucleo-F429ZI. Programming can be done via HAL or Matlab/Simulink. Matlab Simulink provides a suitable GUI for programming, among other things for Ethernet. However, the GUI is not available for all Nucleo boards. Unfortunately, the F429ZI is not supported.
I am currently considering how best to implement the project. I would like to process the digitized data afterwards also by Matlab. In this respect, it would make sense to carry out the programming in Simulink. For this I would also be willing to switch to another board.
I already have experience with Matlab, but less with programming in HAL. What would you advise me? Do you have any other tips?
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的ADC在12BIT分辨率中以2msa/s的速度工作,并且使用UINT16_T存储数据示例,则需要使用PC的4MB/s(或32mbit/s)连接。 STM32F429具有用于USB高速的硬件外围设备,理论上可以实现480mbit/s,远远超出了所需。
就个人而言,我将尝试在VCP(虚拟COM端口)模式中使用USB,该模式被检测为PC中的简单COM端口,就像Arduino或任何具有串行端口的设备一样,但要快得多。然后,您可以实时从中读取数据以MATLAB脚本或将其保存在日志文件中以进行进一步处理。
最有效的方法是使用双缓冲区以DMA模式启动ADC。虽然一个缓冲区由ADC+DMA填充,但第二个缓冲区是通过USB传输的。这给CPU留出了足够的时间处理数据传输,但是必须等到整个缓冲区填充。您可以使用计时器触发ADC转换,因此采样时间将是一致的 - 只有数据传输才会在块中发生。
如果您有可能获得与您所经历的环境兼容的董事会,那么一定要努力。开始USB,ADC,DMA和计时器对低级编程经验的人并不是一件容易的事。
这一切都取决于您在嵌入式编程和您可以花在这个项目上的时间的个人技能。
If your ADC works at 2MSa/s in 12bit resolution and if you use uint16_t for storing data samples, you need 4MB/s (or 32Mbit/s) connection with a PC. STM32F429 has a hardware peripheral for USB High Speed, that can theoretically achieve 480Mbit/s, so much more than is needed.
Personally, I would try using USB in VCP (Virtual COM Port) mode, that is detected as a simple COM port in a PC, just like Arduino or any device with serial port, but is much faster. Then you can read data from it in real time to Matlab script or save it in log file for further processing.
Most efficient way would be to start ADC in DMA mode with dual buffer. While one buffer is filled by ADC+DMA, the second one is transmitted via USB. This leaves plenty of time for CPU to handle data transmission, but it has to wait until entire buffer is filled. You can trigger ADC conversion with timer, so sampling time will be consistent - only data transmission will occur in chunks.
If you have possibility to get board that is compatible with environment that you are experienced with - definitely go for it. Starting USB, ADC, DMA and timers is not trivial to someone who has little experience with low-level programming.
This all comes down to your personal skills in embedded programming and time that you can spend on this project.