I am getting data from a current sensor through the adc of stm32f407. I want to export that data to MATLAB at real time or at least at sampling frequency of 10 kHz. I tried STM TrueStudio but its sampling rate is only 1 kHz. So please let me know what should I do to get data?
Hi Zahid,
You dont mention the mechanism that STM Studio is using to access the data (sorry I am not familiar with STM Studio) and you dont mention the board you are using and its trace capability.
In general the options available to you are:
The rate at which you can offload the data depends on the board and SoC package you are using. If you only have SWO (SWV) available then the offload rate will depend in its clock frequency. If you have a 4 bit TPIU port you would get much higher bandwidth - but then need a debug adapter that supports TPIU trace capture (like ULINKpro or DSTREAM).
Hope this helps - or at least gives you options to think about.
Regards Tony
Thanks Tony for your valuable suggestions. I don't know how to use DWT unit. Can you, please, suggest a comprehensive tutorial about using DWT unit. I am using STM32f407 discovery board.
It is usual for a debug tool to provide a friendly abstraction for programming up the DWT. For example, the tool might allow you to select a variable (static/global) or a memory mapped register and then select 'trace this'. The details on how this is done are very tool dependent.
If you were using Arm Keil tools I could likely find out how to do this for you. However I am not an expert in the other MCU tools (and there are lots of them!).
I would start out asking your tool vendor how to do this - or maybe there are others on this forum who know the ST tools better than I do who could help.
The good news is that looking at the discovery board (https://www.st.com/en/evaluation-tools/stm32f4discovery.html) the schematics (https://www.st.com/resource/en/schematic_pack/stm32f4discovery_sch.zip) show that SWO is available on pin 6 of Header 6 (CN2). I cant tell if the SWO data is available via the USB connection, but if not you should be able to use a tool such as ULINKplus (http://www2.keil.com/mdk5/ulink) and MDK (http://www2.keil.com/mdk5) to access the trace data.