2022-03-10 01:24 AM
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 ?
2022-03-10 01:30 AM
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
2022-03-10 02:23 AM
Thanks you, I will check it. Do I need any software to see the data sent by the stm32 ?
2022-03-10 02:24 AM
A terminal program comes handy, like TeraTerm on Windows, minicom on Linux.
hth
KnarfB
2022-03-10 02:39 AM
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 ?
2022-03-10 03:12 AM
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?
2022-03-10 04:41 AM
No I'm not, should I ?
2022-03-10 07:42 AM
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 : )
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
2022-03-10 09:28 AM
>> 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?