cancel
Showing results for 
Search instead for 
Did you mean: 

How to import stm32 PCM data into my computer

EEnco.1
Associate III

I'm trying to convert a PDM data stream from a MEMS microphone into PCM. I think I managed to get a code working and now I want to verify that the acquisition is good. In my test code, I store all the PCM data into "uint16_t pcm_data[30000];"

While in debug mode, I can go into Live expression and see the data getting stored into pcm_data. Now I'd like to import pcm_data in my computer and check it using something like Audacity, but I can't find an easy way to do it. What solution do you recommend ?

8 REPLIES 8
KnarfB
Principal III

If you're using a board with ST-LINK, serial port (UART) is a natural choice.

You can often pimp the UART speed to 921600 baud, so even online transmission seems possible.

hth

KnarfB

Thanks you, I will check it. Do I need any software to see the data sent by the stm32 ?

A terminal program comes handy, like TeraTerm on Windows, minicom on Linux.

hth

KnarfB

Thanks, I'm trying to use TeraTerm. I'm sending uint16_t data using HAL_UART_Transmit, but in the terminal I see data like " ¥ó®®®Š›Û°í›Û³´í¥®²¯¥®²äº ¥¥óó ÌÌŠŠ››Û°°í퀀€€€ ­­¾¾ �?�?ÃÃÕÕ æòòååññõõå". How can I see the uint16_t data ?

The UART settings on both ends must match, e.g. 115200 8N1.

Terminal progs are mainly for ASCII transfer, do you print the values using printf?

No I'm not, should I ?

In another community post, I found this code :

char aTxBuffer[16];
HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sprintf(aTxBuffer, ''%d'', 111), 5000);

(The question was : )0693W00000Kc8dgQAB.png 

Should I use something like this ? I was thinking about something like ;

for (int g=0; g<3000; g++){
			char data[16];
			HAL_UART_Transmit(&huart1,(uint8_t*) data, sprintf(jsp,'%d',pcm_data[g]),5000);
		}

With this code all I get on TeraTerm is "{{2+]G4-6"

But I dont really understand the char aTxBuffer[16] part

>> How can I see the uint16_t data ?

If you can code in C, perhaps you can compile a small app on your PC, that opens a COM/TTY and read the bytes directly from the serial port?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..