
NPort 5000 Series User Manual
159
Install a Moxa layer into the Yocto Project
1.
Install the Moxa layer and Real TTY recipes into the Yocto Project.
$ cd /home/user/poky
$ source oe-init-build-env
2.
Use a text editor to add the following content to the configuration file:
'./conf/bblayers.conf':
3.
Add this line "/home/user/poky/meta-moxa' to BBLAYERS
BBLAYERS ?= " \
/home/user/poky/meta \
/home/user/poky/meta-poky \
/home/user/poky/meta-yocto-bsp \
/home/user/poky/meta-raspberrypi \
/home/user/poky/meta-moxa \
"
4.
Use a text editor to add the following content to the configuration file:
'./conf/local.conf':
IMAGE_INSTALL_= " realtty-tools realtty-kernel"
Deploy the Yocto image in Raspberry Pi
Build the image with the Real TTY driver:
$ cd /home/user/poky
$ source oe-init-build-env
$ bitbake core-image-base
An SD-card format image (.rpi-sdimg) is generated under
/home/user/poky/build/tmp/deploy/images/raspberrypi3. It is suggested to use the Raspberry Pi official tool
‘rpi-imager’ to burn the image into the SD-card and then boot it into the Linux kernel in Raspberry Pi.
Start the Real TTY driver in Raspberry Pi
After logging into the system, start the Real TTY driver
root@raspberrypi3:~# modprobe npreal2
[ 39.906812] npreal2: loading out-of-tree module taints kernel.
[ 39.913379] MOXA Async/NPort server family Real TTY driver ttymajor 33 calloutmajor 38 verbose 1
(Ver5.1)
For example, we illustrate how to add a 4-port NPort with the IP address: 192.168.127.254
root@raspberrypi3:~# cd /usr/lib/npreal2/driver
root@raspberrypi3:/usr/lib/npreal2/driver# ./mxaddsvr 192.168.127.254 4
Adding Server...
ttyr00, cur00
ttyr01, cur01
ttyr02, cur02
ttyr03, cur03
Added Real Com IP : 192.168.127.254
Now the device node /dev/ttyr00 ~ /dev/ttyr03 is created for tty port use.