Enabling the uart port on a Raspberry pi




Дата канвертавання26.04.2016
Памер5.46 Kb.

Enabling the UART port on a Raspberry PI

By default the serial port on the Raspberry PI is configured for console input/output. If you wish to use the serial port in your own software then you must make the following changes.


First use nano to open /boot/cmdline.txt and edit it to disable boot info being sent to the port.
$sudo nano /boot/cmdline.txt
The contents of the file should look a bit like this:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Remove the text highlighted in red, this will stop boot infor being sent on startup. Press Ctrl+O to write the changes and Ctrl+X to exit nano.
Now we need to edit /etc/inittab to disable console login on the serial port. Open this file with nano
$sudo nano /etc/inittab
Look for this line:
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
And comment it out by adding # to the start of it. You can then save this file and exit nano like you did before.
Now you have made these changes we can reboot the Raspberry PI.
$sudo reboot
Your serial port should now be ready for you to use in your own software.


База данных защищена авторским правом ©shkola.of.by 2016
звярнуцца да адміністрацыі

    Галоўная старонка