Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure uart serial communication in raspberry pie

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to configure uart serial communication in raspberry pie. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Of course, you need to install it before you do this, and type the following command in turn:

Sudo apt-get install git-core

Sudo git clone git://git.drogon.net/wiringPi

Cd wiringPi

Sudo. / build

Once wiringPi is installed, we can use the library functions directly. Now let's introduce how to configure the serial communication of raspberry pie 3.

Raspberry pie 3 only needs two steps to configure the Uart serial port:

Sudo vim/boot/config.txt

Add at the end of the file:

Dtoverlay=pi3-miniuart-bt

After that:

Sudo vim/boot/cmdline.txt

Delete the red part:

Dwc_otg.lpm_enable=0 console=serial10,115200 console=tty1root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

Change to:

Dwc_otg.lpm_enable=0 console=tty1root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

After that, you can start testing with the serial port test code of wiringPi (serialRead.c and serialTest.c), in which serialRead.c is used to read the serial data sent from the computer and displayed on the terminal, while serialTest.c continues to send cumulative data to the serial port of the computer.

Compile using gcc using the following statement:

Sudo gccserialRead.c-lwiringPi and sudo gcc serialTest.c-lwiringPi use sudo. / a.out to run the compiled program, and that's fine. Thank you for reading! This is the end of the article on "how to configure uart serial communication in raspberry pie". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report