ユーザ用ツール

サイト用ツール


xg_series_devel:kyocera_kyw01:start

KDDI LTE-M 拡張ボード(OB-KM)の利用

XG-50 に、KDDI LTE-M 回線用オプションボード FutureNet OB-KM を搭載し、 LTE-M 回線を利用してみます。

OB-KM オプションボード


ファームウェアのビルド

ソースコードの準備

リポジトリから clone

GitLab のリポジトリを clone します。

まずは、NuttX 本体部分を clone します。

kikuchi@develop:~/src/OB-KM$ git clone https://gitlab.com/centurysystems/XG-50/nuttx.git
Cloning into 'nuttx'...
remote: Enumerating objects: 5919, done.
remote: Counting objects: 100% (5919/5919), done.
remote: Compressing objects: 100% (2636/2636), done.
remote: Total 380023 (delta 3950), reused 4234 (delta 2914)
Receiving objects: 100% (380023/380023), 89.82 MiB | 2.63 MiB/s, done.
Resolving deltas: 100% (296357/296357), done.
Checking connectivity... done.

アプリケーション部分も clone します。

kikuchi@develop:~/src/OB-KM$ git clone https://gitlab.com/centurysystems/XG-50/apps.git
Cloning into 'apps'...
remote: Enumerating objects: 36232, done.
remote: Counting objects: 100% (36232/36232), done.
remote: Compressing objects: 100% (7216/7216), done.
remote: Total 36232 (delta 29165), reused 35827 (delta 28843)
Receiving objects: 100% (36232/36232), 8.36 MiB | 2.35 MiB/s, done.
Resolving deltas: 100% (29165/29165), done.
Checking connectivity... done.

clone された結果です。

kikuchi@develop:~/src/OB-KM$ ls -l
total 8
drwxrwxr-x 21 kikuchi kikuchi 4096  8月 10 13:38 apps
drwxrwxr-x 20 kikuchi kikuchi 4096  8月 10 13:37 nuttx


ブランチの変更

それぞれブランチを “XG-50/KYW01” に変更します。

kikuchi@develop:~/src/OB-KM$ cd nuttx/
kikuchi@develop:~/src/OB-KM/nuttx$ git checkout XG-50/KYW01
Branch XG-50/KYW01 set up to track remote branch XG-50/KYW01 from origin.
Switched to a new branch 'XG-50/KYW01'
kikuchi@develop:~/src/OB-KM/nuttx$ cd ../apps/
kikuchi@develop:~/src/OB-KM/apps$ git checkout XG-50/KYW01
Branch XG-50/KYW01 set up to track remote branch XG-50/KYW01 from origin.
Switched to a new branch 'XG-50/KYW01'


コンフィグレーション

コンフィグレーションを行います。“centurysys-xg50/nsh_kyw01” を使用します。

kikuchi@develop:~/src/OB-KM/apps$ cd ../nuttx/tools/
kikuchi@develop:~/src/OB-KM/nuttx/tools$ ./configure.sh centurysys-xg50/nsh_kyw01
  Copy files
  Refreshing...
kikuchi@develop:~/src/OB-KM/nuttx/tools$ 


追加のアプリケーションなどを使う場合は、make menuconfig でコンフィグレーションを変更して追加することもできます。


ビルド

make でバイナリをビルドします。

kikuchi@develop:~/src/OB-KM/nuttx/tools$ cd ..
kikuchi@develop:~/src/OB-KM/nuttx$ make
make[1]: Entering directory '/home/kikuchi/src/OB-KM/nuttx/tools'
make[1]: Leaving directory '/home/kikuchi/src/OB-KM/nuttx/tools'
No .version file found, creating one
make[1]: Entering directory '/home/kikuchi/src/OB-KM/nuttx/tools'
make[1]: Leaving directory '/home/kikuchi/src/OB-KM/nuttx/tools'
LN: include/arch to arch/arm/include
LN: include/arch/board to /home/kikuchi/src/OB-KM/nuttx/configs/centurysys-xg50/include
LN: include/arch/chip to arch/arm/include/stm32l4
LN: arch/arm/src/board to /home/kikuchi/src/OB-KM/nuttx/configs/centurysys-xg50/src
LN: arch/arm/src/chip to arch/arm/src/stm32l4
...
CC:  builtin.c
CC:  libbuiltin/libbuiltin_getname.c
CC:  libbuiltin/libbuiltin_isavail.c
AR:   binfmt_globals.o binfmt_register.o binfmt_unregister.o binfmt_loadmodule.o binfmt_unloadmodule.o binfmt_execmodule.o binfmt_exec.o binfmt_copyargv.o binfmt_dumpmodule.o binfmt_schedunload.o builtin.o libbuiltin_getname.o libbuiltin_isavail.o
make[1]: Leaving directory '/home/kikuchi/src/OB-KM/nuttx/binfmt'
IN: binfmt/libbinfmt.a -> staging/libbinfmt.a
make[1]: Entering directory '/home/kikuchi/src/OB-KM/nuttx/arch/arm/src'
make[2]: Entering directory '/home/kikuchi/src/OB-KM/nuttx/configs/centurysys-xg50/src'
CC:  stm32_boot.c
CC:  stm32_clockconfig.c
stm32_clockconfig.c: In function 'stm32l4_board_clockconfig':
stm32_clockconfig.c:180:2: warning: #warning todo: regulator voltage according to clock freq [-Wcpp]
 #warning todo: regulator voltage according to clock freq
  ^
CC:  stm32_autoleds.c
CC:  stm32_userleds.c
CC:  stm32_adc.c
CC:  stm32_timer.c
CC:  stm32_appinit.c
AR:   stm32_boot.o stm32_clockconfig.o stm32_autoleds.o stm32_userleds.o stm32_adc.o stm32_timer.o stm32_appinit.o 
make[2]: Leaving directory '/home/kikuchi/src/OB-KM/nuttx/configs/centurysys-xg50/src'
LD: nuttx
make[1]: Leaving directory '/home/kikuchi/src/OB-KM/nuttx/arch/arm/src'
CP: nuttx.hex
CP: nuttx.bin
kikuchi@develop:~/src/OB-KM/nuttx$ 


ファームウェアのバイナリができました。

kikuchi@develop:~/src/OB-KM/nuttx$ ls -l nuttx*
-rwxrwxr-x 1 kikuchi kikuchi 2822452  8月 10 13:52 nuttx
-rwxrwxr-x 1 kikuchi kikuchi  166136  8月 10 13:52 nuttx.bin
-rw-rw-r-- 1 kikuchi kikuchi  467362  8月 10 13:52 nuttx.hex
kikuchi@develop:~/src/OB-KM/nuttx$ 


XG-50 への書き込み

OpenOCD + gdb を使用してファームウェアを書き込みます。


動作確認

gdb から “c”(continue) で実行します。

�ABCDF

NuttShell (NSH)
nsh> 


KYW01 への設定

APN などを設定します。cuコマンドを利用します。

nsh> cu -r
AT
OK
AT+CGDCONT=1,"IP","kddiint.lpwa.kddi.com"   <--- PDPコンテキスト設定
OK
AT+CGAUTH=1,1,"hogehoge","fugafuga"         <--- PDPコンテキストの認証パラメータ設定
OK
AT+KCOMSET=1                                <--- データ通信方式設定 (PPP)
OK
AT+CFUN=6                                   <--- モジュールリセット
OK

認証パラメータは、SIM により認証される回線なので使用されないため任意です。
“~” のあと “.” を入力することで cuコマンドを終了します。


PPP 接続

pppd コマンドにより接続を行います。“&” をつけてバックグラウンドで起動1)します。

nsh> pppd &
pppd [11:100]
nsh> 


しばらくすると接続が完了します。dmesg でログを確認することができます。

nsh> dmesg
[     0.000000] stm32l4_rng_initialize: Initializing RNG
[     0.000000] registered UART4 as /dev/console.
[     0.000000] registered UART4 as /dev/ttyS0.
[     0.000000] registered UART1 as /dev/ttyS1.
[     0.000000] registered USART2 as /dev/ttyS2.
[     0.000000] registered USART3 as /dev/ttyS3.
[     0.001500] Mounting procfs to /proc
[     0.002500] board_ioctl: BIOC_CONFIG_GPIO GPIO configured.
[     0.002500] board_ioctl: BIOC_ENABLE_B2B
[  1221.077500] chat: expect ()
[  1221.077500] chat: 
[  1221.077500] chat: -- got it
[  1221.078000] chat: send ATE0
[  1221.078000] chat: expect (OK)
[  1221.097500] chat: ATE0^M^M
[  1221.102000] chat: OK^M
[  1221.102000] chat: -- got it
[  1221.102500] chat: abort on (BUSY)
[  1221.103000] chat: abort on (NO CARRIER)
[  1221.103000] chat: abort on (ERROR)
[  1221.103000] chat: timeout is 10 s
[  1221.103000] chat: expect ()
[  1221.103500] chat: 
[  1221.103500] chat: -- got it
[  1221.103500] chat: send AT
[  1221.103500] chat: expect (OK)
[  1221.115500] chat: ^M
[  1221.120000] chat: OK^M
[  1221.120000] chat: -- got it
[  1221.120000] chat: send ATD*99***1#
[  1221.120000] chat: expect (CONNECT)
[  1221.145500] chat: ^M
[  1221.155000] chat: CONNECT^M
[  1221.155500] chat: -- got it
[  1222.156000] pppd: sent [LCP ConfReq <asyncmap 0x0>]
[  1222.258500] pppd: rcvd [LCP ConfReq id=0x0 <mru 1420> <asyncmap 0x0> <auth pap> <magic 0x47ccc461> <pcomp> <accomp>]
[  1222.259000] pppd: sent [LCP ConfAck id=0x0]
[  1222.289000] pppd: rcvd [LCP ConfAck id=0x0]
[  1222.290000] pppd: sent [PAP AuthReq id=0x0 user="user@dream.jp" password=<hidden>]
[  1222.402000] pppd: rcvd [PAP AuthAck id=0x0 ""]
[  1222.402000] pppd: PAP authentication succeeded
[  1222.402500] pppd: sent [IPCP ConfReq id=0x0 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
[  1222.482000] pppd: rcvd [IPCP ConfReq id=0x0]
[  1222.482000] pppd: sent [IPCP ConfAck id=0x0]
[  1222.514000] pppd: rcvd [IPCP ConfNak id=0x0 <addr 10.29.8.10> <ms-dns1 210.196.3.183> <ms-dns2 210.141.112.163>]
[  1223.644500] pppd: rcvd [IPCP ConfReq id=0x1]
[  1223.644500] pppd: sent [IPCP ConfAck id=0x1]
[  1224.924000] pppd: rcvd [IPCP ConfReq id=0x2]
[  1224.924500] pppd: sent [IPCP ConfAck id=0x2]
[  1228.927000] pppd: sent [IPCP ConfReq id=0x1 <addr 10.29.8.10> <ms-dns1 210.196.3.183> <ms-dns2 210.141.112.163>]
[  1229.014000] pppd: rcvd [IPCP ConfAck id=0x1 <addr 10.29.8.10> <ms-dns1 210.196.3.183> <ms-dns2 210.141.112.163>]
[  1229.014500] pppd: local  IP address 10.29.8.10
[  1229.014500] pppd: remote IP address 10.64.64.64
[  1229.015000] pppd: primary   DNS address 210.196.3.183
[  1229.015000] pppd: secondary DNS address 210.141.112.163
[  1229.015000] pppd: DNS server added.

nsh> 


ping で通信が確認できます。

nsh> ping -c 5 www.yahoo.co.jp
PING 183.79.250.123 56 bytes of data
56 bytes from 183.79.250.123: icmp_seq=0 time=329 ms
56 bytes from 183.79.250.123: icmp_seq=1 time=369 ms
56 bytes from 183.79.250.123: icmp_seq=2 time=328 ms
56 bytes from 183.79.250.123: icmp_seq=3 time=367 ms
56 bytes from 183.79.250.123: icmp_seq=4 time=327 ms
5 packets transmitted, 5 received, 0% packet loss, time 5003 ms
nsh> 


切断するときには、pppd のプロセスを KILL します。

nsh> ps
  PID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK COMMAND
    0     0   0 FIFO     Kthread N-- Ready              00000000 000000 Idle Task
    1     1  50 FIFO     Kthread --- Waiting  Signal    00000000 002028 lpwork
    2     1 100 FIFO     Task    --- Running            00000000 004076 init
   11     3 100 RR       Task    --- Waiting  Semaphore 00000000 002028 pppd
nsh> kill -15 11
nsh> 
nsh> ps
  PID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK COMMAND
    0     0   0 FIFO     Kthread N-- Ready              00000000 000000 Idle Task
    1     1  50 FIFO     Kthread --- Waiting  Signal    00000000 002028 lpwork
    2     1 100 FIFO     Task    --- Running            00000000 004076 init
nsh> dmesg
[  1381.103500] pppd: Connection Terminated.
[  1385.106000] chat: expect ()
[  1385.106000] chat: 
[  1385.106000] chat: -- got it
[  1385.107500] chat: send ATE0
[  1385.107500] chat: expect (OK)
[  1385.124000] chat: ^M
[  1385.128000] chat: OK^M
[  1385.128000] chat: -- got it
[  1385.128500] TIOCMBIC(TIOCM_DTR) -> -1

nsh> 


1)
フォアグラウンドで起動すると何もできなくなります。
xg_series_devel/kyocera_kyw01/start.txt · 最終更新: 2018/08/10 14:32 by admin