LoginSignup
1
0

More than 5 years have passed since last update.

BeagleBoneGreenでGPSを受信する02

Last updated at Posted at 2019-03-03

前回
BeagleBoneGreenでGPSを受信する01

UART1をデフォルトで有効にする。

前回config-pinでGPIO端子の設定を変更してUARTの入出力をできるようにしましたが、これでは起動後毎回入力が必要になりますので、起動時からUART1が有効になるようにします。
→別の設定方法:BeagleBoneGreenのGPIO端子の設定
→デバイスツリーを自分で書く方法:BeagleBoneGreenのDeviceTree

/boot/uEnv.txtを編集します。

$ sudo nano /boot/uEnv.txt

###Overide capes with eepromの下に以下を追記します。

uboot_overlay_addr4=/lib/firmware/BB-UART1-00A0.dtbo

また、enable_uboot_cape_universal=1の下に以下を追記します。

cape_enable=bone_capemgr.enable_partno=BB-UART1

上書き保存[Ctrl-O]して再起動後します。

$ sudo shutdown -r now

再起動後、UART1の受信ができているか確認します。

$ cat /dev/ttyS1

gpsdをインストールする

gpsdとgasdクライアントをインストールします。
参考元
https://www.yslabannex.net/?p=1163

$ sudo apt-get update
$ sudo apt-get install gpsd gpsd-clients

サービスの停止
service * stopで現在起動しているサービスを停止します。
systemctl disable *でシステム起動時のサービス起動を無効にします。

$ sudo service gpsd stop
$ sudo systemctl disable gpsd.socket

スタートアップスクリプト/etc/default/gpsdの変更

gpsd
# Default settings for the gpsd init script and the hotplug wrapper.

# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyS1"

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"

GPSD_SOCKET="/var/run/gpsd.sock"

サービスの起動
service * startでサービスを起動します。
systemctl enable *でシステム起動時のサービス起動を有効にします。これで次回から電源を入れたときにgpsdが動きます。

$ sudo service gpsd start
$ sudo systemctl enable gpsd.socket

受信確認

$ cgps

image.png

続き
BeagleBoneGreenでGPSを受信する03

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0