GPS Debugging Demo
1 Demo overview
This demo shows how to test the GPS positioning-information feature.
2 Connecting the GPS to the board
As shown in the figure, the GPS can be connected to the board's TTL interface, i.e. UART4.
3 Procedure
Open a terminal and copy the executable smdt_gps_demo from this demo's bin directory (05-Development Materials\Software Development Materials\linux_demo\smdt_gps_demo\bin) to the board's filesystem (the source code is available under the src path).
In the terminal, run the following commands to switch to the directory containing the smdt_gps_demo executable.
#切换到 smdt_gps_demo 可执行程序所在目录
cd ‘可执行文件所在目录’
#查看 smdt_gps_demo 是否在该目录下
lsIf the executable smdt_gps_demo is in the current directory, change its permissions.
#添加可执行权限
chmod +x smdt_gps_demo
#查询是否修改成功
ls -ld smdt_gps_demoAfter confirming the permission change succeeded, run ./smdt_gps_demo -h to view the program's help information. The default parameters set in this test script are as follows:
- device: /dev/ttyS4 (UART4)
- baud: 9600 (default baud rate 9600)
#查看帮助信息
./smdt_gps_demo -hThe result is shown below:

Run the following command to obtain the current GPS data. If positioning succeeds, coordinates and other data are displayed. If positioning fails, a prompt is shown — please check whether the GPS antenna module is correctly receiving a positioning signal.
#GPS显示定位信息
./smdt_gps_demo -d /dev/ttyS4 -b 9600Successful positioning displays the positioning information at 1-second intervals. The result is shown below:

Failed positioning shows the prompt. The result is shown below:

Press Ctrl+C to force-exit the program.

