3

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
Mike Causer
  • 156
  • 1
  • 1
  • 5

1 Answers1

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 :)

leader
  • 41
  • 2