How to transfer adc value to computer

I am working on a project using STM32F103C8. I need to store sample rate in memory.
But this STM32F103C8 has little memory can I send the sample as fast as possible to Computer?
my ADC sample rate is 48 kHz with 12 bit resolution

Use Serial.print() to sent the integer at the highest possible Baud rate.

Hi
But it takes more time

More time than what?

It takes 1 millisecond to send it

Post the code, using code tags. Describe "It" and "it".

Capture
I use FTDI to transfer data to a computer

	  	  for (k=0;k<SAMP;k++)
	  	  {
	  		  sprintf((char*)buf,"%d\r\n", dat[k]);
	  		  HAL_UART_Transmit(&huart1, buf, strlen((char*)buf), HAL_MAX_DELAY);
	  		  HAL_Delay(1);
	  	  }

Do you have a better offer?

Sigh.

What is the serial Baud rate?

768000

is there another way?

That is not a standard Baud rate, but if it works at all, then the problem is that you are sending just a few bytes at a time in one UART_transmit call, and are stuck because of the 1 millisecond poll rate for USB ports.

Send larger chunks of data in one transmit call, preferably binary data (two bytes per ADC sample). You will have to experiment to see how large a message you can send.

I think my main problem is speed

Because sampling is done in microseconds

This is not at all an Arduino question. You are not using the Arduino IDE. Your best bet is to ask on the STM forums.

Why?
What board are you using? According the ST web page the STM32F103C8 has a USB peripheral. That should allow you to send data to a PC at the data rate you need.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.