2

I have a ITead Studio GPS attached to my RasPi Model B 2.0's UART serial port and it's specifications require baud rate to be set at 38400.

I am using gpsd on Raspbian, which attempts to use baud rates 4800, 9600, 19200 then after a while it attempts 38400 and eventually starts working after a lot of timeouts.

Each time I reboot, I need to manually run the following:

$ sudo stty -F /dev/ttyAMA0 38400

After reboot, the baud rate returns to the default 115200.

Is it possible to set the default baud rate to 38400, so that I do not have to run the above command each time I reboot?

My /boot/cmdline.txt:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

My /etc/iniitab:

# /sbin/getty invocations for the runlevels.
1:2345:respawn:/sbin/getty --noclear 38400 tty1 
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
  • The /dev/ttyAMA0 is a UART connected to a pair of gpio pins. As far as I'm aware there in no link between /dev/ttyAMA0 and any serial port presented by the USB hardware (normally something like /dev/ttyUSB0). Are you using two serial devices? – joan Jun 5 '14 at 16:10
4

well it's an old issue, but maybe for others who are searching for a solution, just edit the crontab like follows :

@reboot sudo stty -F /dev/ttyAMA0 38400

works also with other commands :)

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.