cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Data extraction at high sampling frequency

chanchal94
Associate II

ST moderator: Edited the tile to add "ADC"

I want to extract data at high sampling frequency ~10KHz at STM32N6570-DK, Is it possible with USART for three channels or we have any other mode for this purpose. I want to continuously stream data at 10KHz sampling frequency.

8 REPLIES 8
mƎALLEm
ST Employee

Hello,

What kind of data ?

How to write your question to maximize your chances to find a solution

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Andrew Neil
Super User

As @mƎALLEm said, you need to give more details.

Remember that we know nothing about you or your project other than what you provide in your post!

 

What is going to receive this "data"?

 


@chanchal94 wrote:

 we have any other mode for this purpose.


We don't know what the purpose is!

But the STM32N6570-DK also has USB HS and Gigabit Ethernet - among other interfaces...

The board documentation is here:

https://www.st.com/en/evaluation-tools/stm32n6570-dk.html#documentation

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User

It's possible, but you would be stretching the limits of UART. Do the math to see how many bytes per second you need to transfer and that will let you know the baud rate you need. Typically UART is run at 115200 baud but can be up to several Mbaud. If you convert values to string before sending, this increases bandwidth even more.

3 channels, 10 ksps, 2 bytes/sample would require around 600000 baud which is doable.

You also need to ensure the receiving software is up to the task.

If you feel a post has answered your question, please click "Accept as Solution".

@TDK wrote:

Typically UART is run at 115200 baud but can be up to several Mbaud.


@chanchal94 it also depends on how you are connecting the STM32's UART to whatever will be receiving this data.

@gbm suggests here that the ST-Link VCP is good for at least 921600 baud.

I have certainly used FTDI UART-to-USB converters at 921600 baud.

 


@TDK wrote:

You also need to ensure the receiving software is up to the task.


Indeed. Some apps/APIs don't allow to select particularly high baud rates ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

My project requirement is to extract the data from three voltage sensors with the help of STM32N6570-DK, so that I can capture the data in my PC at 10KHz sampling rate for 10 seconds. 

I have to use this same data for my ML model.

Is it feasible with this board? This is my query. As whatever boards I had tried previously was having data loss in real time streaming.

You haven't said how many bit per sample.

@TDK showed how to do the maths

 


@chanchal94 wrote:

 sampling rate for 10 seconds. 


So you could send later ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

ADC resolution is 12-bit
Three channels sampled at 10 kHz individually.
Data is streamed in real time to a PC via ST-Link VCP (UART)

I want to capture this data for 10seconds on PC, i.e. 100000 samples

I am trying this ADC+DMA+Timer code for 921600 baud rate using USART1 , I am able to run the code and see the values in live expressions, but I am enable to capture this data in PC (Tried using matlab code, visual studio code)
Can you suggest anything regarding this?


@chanchal94 wrote:

I want to capture this data for 10seconds on PC, i.e. 100000 samples


So you could do it in two steps:

  1. Capture the live data into the STM32's memory;
  2. After the capture has completed, send to the PC at leisure

That would save all the complications of trying to do both capture and transmission at the same time.

 


@chanchal94 wrote:

I am enable (sic?) to capture this data in PC (Tried using matlab code, visual studio code)


I guess you mean, "unable" ?

As already noted, 921600 baud should be possible from the STM32.

Do your Matlab and VSCode support 921600 baud?

Have you done a simple test just sending fixed data - to prove that all your connections and receiving software are correct & working ?

I would suggest testing at 115200 first ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.