cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 UART 16 bits speech data sending?

H. Kartal
Associate II
Posted on August 21, 2017 at 14:58

I'am trying sending speech data between two STM32F4 board with. I take speech data from PCM buffer. But the data that in PCM buffer is 16 bits. I need to send this data with UART. I know that, UART data register is 8bits. How can I split data in PCM buffer.? Other problem about receive side. How can I collect these 2 byte data? And last one, this is a speech data. So Can I transmit and receive them like char data or someting? Or is there any important point about timing for transmitting and receiving datas?

PS: I am using 'STM32CubeExpansion_MEMSMIC1_V2.0.0' application with NUCLEO STM32f401RE board and X-NUCLEO-CCA02M1 MEMs board.

#stm32f401re #cca02m1-memsmic1 #data-register #cca02m1
9 REPLIES 9
Posted on August 21, 2017 at 15:35

Ok, so cast the uint16_t pointer in to a uint8_t one?

uint16_t arr[1000];

Send((uint8_t *)arr, sizeof(arr));

The data appears in memory as contiguous bytes, describing the low order, and high order 8-bit that compose the 16-bit word.

When sending you might want to consider how you initially synchronize.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
H. Kartal
Associate II
Posted on August 22, 2017 at 13:25

Thank you for answer.

So can I send speech data like char or someting ? Aren't there any important point about timing for speech datas?

AVI-crak
Senior
Posted on August 22, 2017 at 15:57

To start, learn to accept 0x00 via UART as data. Everything else will be easy.

H. Kartal
Associate II
Posted on August 22, 2017 at 16:07

I will use RS422 to send speech. It will be a fulll dublex communication system. By the way ever interested

X-NUCLEO-CCA02M1 MEMs board before? I can not use it when debugging nucleo board. How can use both of them while debugging evulation board?

Posted on August 22, 2017 at 14:45

In memory it is a collection of bytes, review memory representation of data.

Speech and Audio data are going to have hard timing deadlines, you must have sufficient bandwidth to transmit the data you are generating. Presumably you have a fixed frequency for the sample rate. Clocks on two independent systems are likely to have some drift with respect to each other. If this is sufficiently large you might have to insert or remove samples to maintain synchronization, or change the sample clock slightly.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on August 22, 2017 at 17:06

The interface is not important. You need to learn how to generate data at the package level.

The simplest option is to take the ready standard, but it's boring. It is much more fascinating to invent your own bicycle, and heroically overcome difficulties.

The 'data package' in the simplest form is a two-way agreement on the transmission and reception of data. Try to create a structure using a union, two options for presenting data-a data type for internal use and for a physical layer.

Have you already managed to send several 0x00 parcels via UART?

Posted on August 23, 2017 at 08:02

I can send data via uart. But I should take data from PCM buffer, devide this data and send it in a synchronous timing. These 3 issues are base problem.

Posted on August 23, 2017 at 15:27

There may be a translation error ...

Are you sure that you can send a data string via uart? :

0x01.0x00.0x00.0x00.0x01.

It looks simple at first sight, before the first real attempt.

You can send such data. To see the result, more precisely - to fix the coincident result is much more difficult.

You will have to abandon the existing software shell, and write your own - which is able to accept null data.

Combine the format of the data can be through the union, read the rules of the C language, there it is written.

Posted on August 24, 2017 at 10:03

Remember to divide and conquer. It seems to me that the problem can be broken down into smaller, simpler problems.

1. You want to transmit audio data with low latency. You need a control and timing strategy for this. You could send individual PCM samples as they are generated or you can buffer multiple samples before transmitting them as a block. The bigger you make your buffer, the longer your latency becomes.

2. You need to transmit a packet of data. You can design your own packet format or you can pick a standard.

3. You need to hook up the UART.

I hope that helps.