Input/Output error when opening serial port

Ask questions about Arch Linux ARM. Please search before making a new topic.

Input/Output error when opening serial port

Postby shinagan » Thu Mar 26, 2015 7:22 pm

Hi everyone,

I have a code that at some point opens a serial port by doing:
$this->bbcode_second_pass_code('', 'char *portname = "/dev/ttyAMA1";
...
...
...
int fd = open (portname, O_RDWR | O_NOCTTY | O_SYNC);')

This code runs well on raspbian with my B+ but does not work on my A+ with archlinux! It says:

$this->bbcode_second_pass_code('', ' Input/output error')

Anyone knows how I could solve that issue? The only USB device that I have on the usb port is my wifi dongle which is identified as ttyAMA0.

Thanks,

Alex
shinagan
 
Posts: 5
Joined: Fri Dec 05, 2014 5:31 am

Re: Input/Output error when opening serial port

Postby shinagan » Thu Mar 26, 2015 11:54 pm

Solution:

This is due to the fact that archlinux for the Raspberry Pi uses the UART as a serial console.

First, I made a backup of the /boot/cmdline.txt file, which contains the kernel parameters:

$this->bbcode_second_pass_code('', ' sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt')

Then I edited it:

$this->bbcode_second_pass_code('', ' sudo nano /boot/cmdline.txt')

Originally it contained:

$this->bbcode_second_pass_quote('', ' ') dwc_otg.lpm_enable=0 rpitestmode=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait


I deleted the two parameters involving the serial port (ttyAMA0) to get the following:

$this->bbcode_second_pass_quote('', ' ') dwc_otg.lpm_enable=0 rpitestmode=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait


I rebooted ($this->bbcode_second_pass_code('', 'sudo reboot')) to confirm that kernel output was no longer going to the serial port.

Source: http://www.irrational.net/2012/04/19/using-the-raspberry-pis-serial-port/
shinagan
 
Posts: 5
Joined: Fri Dec 05, 2014 5:31 am


Return to User Questions

Who is online

Users browsing this forum: No registered users and 16 guests