STM32 USART Lecture 12 – Communicating with PC over UART 

  • Post author:
  • Post category:Blog

 

Communicating with PC over UART 

 

 

If you want to send or receive some data from the PC into your microcontroller board over the UART communication, it is possible with virtual COM ports. 

For example, in the diagram shown in Figure 1, the PC is connected with the ST board. The USART peripheral of the STM32 microcontroller is able to send data to your PC if virtual COM port support is available.

In Figure 1, you can see that there is an in-between module, and it is called a converter chip.

Communicating with PC over UART 
Figure 1. Connections for PC and ST board.

 

Why is a converter chip used?

The converter chip takes the data from the USART peripheral of the microcontroller, and then it converts that data into USB data. It actually transmits that data to the PC, where the PC can analyze that data by using the serial monitor software. Whenever a PC wants to send some data, it sends that data over USB, this chip converts that data into serial data, and your microcontroller will then receive that data just like a UART frame. 

The converter chip is available onboard if you are using a Nucleo board.

On the discovery board, especially on the STM32F407 discovery board, it is not available. That’s why you have to buy this converter cable or converter module separately. In that case, you have to arrange for some type of cable that we call as USB or UART converter cable (Figure 2), by using which you can connect the USB to the PC.

You can connect the UART converter cable’s line to the USART pins, and then you can communicate with the PC and STM32 board. The meaning of the UART converter cable’s pins is mentioned in Figure 2.

No need to use a 5V pin. You can just leave that unconnected. Ground pin must be connected to the ground point of the STM32 board, and the remaining two pins are RX and TX pins. The RX pin of the cable will go to the TX line of the STM32 board, and the TX pin will go to the RX line of the STM32 board.

 

stm32 microcontroller- Communicating with PC over UART 
Figure 2. UART (USB) converter cable.

 

You can find the connections in Figure 1. The USB to UART converter, there is nothing but a cable. As shown in Figure 1, you can make connections to establish the connection between PC and the board over UART communication.

Instead of cable, you can also use the chips or OEM modules shown in Figure 3. This also does the same thing, but the only thing is it doesn’t come with a cable, whereas the UART converter cable comes with a cable. It is better to use a UART converter cable because it is very easy to handle since it comes with a long cable. But the OEM modules don’t come with a cable, so you have to arrange for some jumper wires.

stm32 microcontroller - Communicating with PC over UART 
Figure 3. OEM module.

In the following article, let’s discuss the USART interrupt.

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.

Leave a Reply