I'm trying to understand every section of the journey of data from a microphone via a microcontroller to a pc terminal.

I realize now after reading about serial data transfer that real-time audio data transfer through a serial port is not possible, since the maximum data transfer rate is around 115 kb/s, However, I would still like to know about serial data transfer in a microcontroller.

I have an electret microphone connected to an analogue input on a stm32 nucleo-144 development board with a stm32F746ZG microcontroller (https://os.mbed.com/platforms/ST-Nucleo-F746ZG/) and the development board is connected to a pc via a USB cable.

My understanding is that the audio signal is sampled by the adc on the microcontroller chip, this new digital data is then moved to memory via one of the Advanced peripheral buses (APB) and then the Advanced High-performance bus (AHB) it then comes back out of memory and goes via the APB and AHB into a UART within the microcontroller and after into a (RS-232/RS-485) line driver (don't know if this is in the microcontroller on on the development board) where the voltage is increased and then after this I'm lost.

Does the data just progress along the tx line from the line driver to the USB port on the development board? And is it then transmitted as USB data or as serial data using one of the USB data lines?

  • 1
    \$\begingroup\$ Nothing uses "one of the USB data lines"; the data lines are a differential pair and USB data always uses both. \$\endgroup\$ – Hearth Oct 28 '19 at 17:22
  • 3
    \$\begingroup\$ The situation you are describing sounds rather unlikely. Which STM32F4 development board has RS232? And why would you want to use it? Additionally, why do you want to send audio to a "terminal"? There are far better off-the-shelf ways to get audio into a PC. As for USB and various virtual serial schemes, these is something you can read up on - the purpose of Stack Exchange sites is not to replace documentation, but only to deal with questions which remain after consulting applicable documentation and references. \$\endgroup\$ – Chris Stratton Oct 28 '19 at 17:25
  • 1
    \$\begingroup\$ UART and USB are two separate things. \$\endgroup\$ – user110971 Oct 28 '19 at 17:25
  • 1
    \$\begingroup\$ STM32 doesn't use RS232 or RS485, then how does it send serial data? forgive my ignorance, I'm a beginner. Forget the audio situation I described, it's just an example to help my understanding, I just want to learn how data moves in the development board \$\endgroup\$ – A.Davies Oct 28 '19 at 17:49
  • 2
    \$\begingroup\$ RS-232/485 are not protocols, they are line levels at those levels you would blow up the mcu. They define line levels and connector pin outs. not protocols. A very common mistake folks make trying to connect the dots between the protocol and the voltage levels/connector pinout. I have yet to see an STM32 dev board with RS-232 connectors or line levels, they use the debug mcu as a virtual com port instead. and that is a confusing/misleading term as well, com port. \$\endgroup\$ – old_timer Oct 28 '19 at 19:22

The serial interface is actually a virtual com port that communicates using the USB interface. Your microcontroller does not need to convert the serial input/output between normal logic levels and the higher RS-232 voltages...the logic signals from the UART go directly to the USB interface. Software on the host computer must be able to recognize the virtual serial port and provide the appropriate driver, so it looks just like an old fashioned serial port to the host software.

  • 1
    \$\begingroup\$ Depending on which USB connector is used no actual UART may be involved at all. Using the one that goes through the on board debugger might be a default for experiments but would be less common when we creating a potential application product that used USB. \$\endgroup\$ – Chris Stratton Oct 28 '19 at 18:04
  • \$\begingroup\$ I understand now, thank you \$\endgroup\$ – A.Davies Oct 28 '19 at 18:21
  • \$\begingroup\$ You can create a virtual com port using the usb interface of the microcontroller? \$\endgroup\$ – A.Davies Oct 28 '19 at 18:22
  • \$\begingroup\$ Does this mean speed of the data transfer is not limited to 115 kb/s? \$\endgroup\$ – A.Davies Oct 28 '19 at 18:36
  • 1
    \$\begingroup\$ @A.Davies You are asking new questions now, and the answers depend on whether you are asking about a specific microcontroller or about USB in general. You should probably create a new question and provide more details. \$\endgroup\$ – Elliot Alderson Oct 28 '19 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.