Skip navigation.
Home
The QNX Community Portal

View topic - Unable to launch Uart serial driver

Unable to launch Uart serial driver

For discussion of realtime and/or embedded programming.

Re: Unable to launch Uart serial driver

Postby Anant Pai » Mon Apr 24, 2017 3:22 pm

Hi Tim,

Thanks for your help so far.

I will give a try with launching the tinit.

On the shell prompt if we press Ctrl-Z or a Ctrl-C nothing happens the shell does not process these inputs.
When we use this to send a signal to a process like a ping command the behavior is different for a Ctrl-C and Ctrl-Z.
For Ctrl-C the ping stops and for Ctrl-Z the shell hangs.
We have a QNX x86 Virtual machine image running on windows host, on this system both the Ctrl-C and Ctrl-Z can be used to stop a process.
So we were trying to match the behavior of the esh shell with what we are observing with the virtual machine image.

One more observation is that if we don't launch the uart serial driver from the build script the ksh is getting launched.
The ksh during launch gives the following error

ksh: No controlling tty (open /dev/tty: No such device or address) 
ksh: warning: won't have full job control

With the ksh launched we can run all the commands but we cannot stop/signal any running processes.(No job control)
It is only when we launch our serial driver the ksh hangs and strangely enough only the esh is works with the serial driver.

Regards
Anant Pai
Anant Pai
Active Member
 
Posts: 19
Joined: Wed Mar 01, 2017 2:25 pm

Re: Unable to launch Uart serial driver

Postby Tim » Mon Apr 24, 2017 5:41 pm

Anant,

We have a QNX x86 Virtual machine image running on windows host, on this system both the Ctrl-C and Ctrl-Z can be used to stop a process.
So we were trying to match the behavior of the esh shell with what we are observing with the virtual machine image.


I'd need to see the build script for the virtual machine and compare it with the one you are using on your system to be able to make some sense out of what is different. One obvious difference is the virtual machine is using a regular keyboard console for input and your trying to use a keyboard over serial for input.

It's possible the serial driver itself could be changing the behavior of CTRL-C/CTRL-Z. Do you have any documentation for how it works?

One more observation is that if we don't launch the uart serial driver from the build script the ksh is getting launched.


How do you know that ksh isn't being launched when you run your uart serial driver? Maybe it's not printing out any error messages.

In any case I'd focus on using tinit. As long as you aren't really memory constrained it's the better way to go (it's what we use) because it relaunches shells automatically.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: Unable to launch Uart serial driver

Postby Anant Pai » Thu May 11, 2017 5:55 pm

Hi,

The table in this link says that command and filename completion feature is not supported on esh and only the ksh supports these features.
http://www.qnx.com/developers/docs/660/ ... Shell.html

We need to launch the ksh to support all the features of the shell.

The UART driver functionality is similar to the 8250 driver provided by the QNX.
http://www.qnx.com/developers/docs/qnxc ... eCode.html

Only flow control features are not supported yet, does this make a difference in launching different shells considering the same driver is able to launch esh but not the ksh.

Regards
Anant Pai
Anant Pai
Active Member
 
Posts: 19
Joined: Wed Mar 01, 2017 2:25 pm

Re: Unable to launch Uart serial driver

Postby Tim » Fri May 12, 2017 5:19 pm

Is this still your build file?
###########################################################################
##
## QNX Neutrino 6.6 on the (ARMv7 Cortex-A7 core) Board
##
###########################################################################
##
## SUPPORTED DEVICES:
## UART, I2C, SPI
##
###########################################################################
##
## NOTES:
##
###########################################################################

###########################################################################
## START OF BUILD SCRIPT
###########################################################################
[image=0xA0000000]
[virtual=armle-v7,raw] .bootstrap = {
# Options specific to this BSP:
# Increase or decrease the verbosity level of the startup
# by adding or removing 'v'
startup-test -v
#######################################################################
## PATH set here is the *safe* path for executables.
## LD_LIBRARY_PATH set here is the *safe* path for libraries.
## i.e. These are the paths searched by setuid/setgid binaries.
## (confstr(_CS_PATH...) and confstr(_CS_LIBPATH...))
#######################################################################
PATH=/proc/boot:/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib:/etc
LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/usr/lib:/etc procnto-smp
}

[+script] .script = {

procmgr_symlink ../../proc/boot/libc.so.3 /usr/lib/ldqnx.so.2
display_msg ------------------------------------------------
display_msg Welcome to QNX Neutrino 6.6.0

#Start some common servers
slogger &
display_msg slog launched
pipe &
display_msg pipe launched
devc-pty

#Launch UART Driver
#uart-pl011 -u3
#waitfor /dev/uart3
#display_msg UART driver launched
devc-serPl011 -e -S -F -b115200 -c51200000 -u3 0x50020000,59
waitfor /dev/ser3
reopen /dev/ser3

#Launch I2C Driver instances
i2c-stat -p 0x50160000
waitfor /dev/i2c0
display_msg i2c0 launched

i2c-stat -p 0x50040000
waitfor /dev/i2c1
display_msg i2c1 launched

i2c-stat -p 0x50030000
waitfor /dev/i2c2
display_msg i2c2 launched

#Launch SPI Driver
spi-master -d pl022
waitfor /dev/spi0
display_msg SPI driver launched


#NAND Driver has to launched Manually
#fs-etfs-at-micron -r 10164 -D ifs_maxblk=77 -e -m /etfs
#fs-etfs-at-micron -r 10164 -D ifs_maxblk=77 -m /etfs
#waitfor /dev/etfs2
#display_msg ETFS driver launched

#Launch Ethernet Driver
export LD_LIBRARY_PATH=:/lib:/usr/lib:/usr/lib/dll:/proc/boot
io-pkt-v4 -d /lib/dll/devnp-steth-slx.so mac=00123456789a -ptcpip

#Launch GPIO 0 Driver
gpio-stat -c0
waitfor /dev/gpio0
display_msg GPIO 0 driver launched

#Launch GPIO 1 Driver
gpio-stat -c1
waitfor /dev/gpio1
display_msg GPIO 1 driver launched

#Launch GPIO 2 Driver
gpio-stat -c2
waitfor /dev/gpio2
display_msg GPIO 2 driver launched

#Launch GPIO 3 Driver
gpio-stat -c3
waitfor /dev/gpio3
display_msg GPIO 3 driver launched

#Launch WDT Driver
wdt-stat &
display_msg WDT driver launched

#Launch RTC Driver
rtc-stat -f 32768
waitfor /dev/rtc0
display_msg RTC driver launched

#Launch MTU Driver
mtu -vix &
waitfor /dev/MTU
display_msg MTU driver launched

#Start the session
#[+session] ksh &
[+session] esh &
}

# Redirect console messages
#[type=link] /bin/sh=/proc/boot/ksh
[type=link] /bin/sh=/proc/boot/esh
[type=link] /tmp=/dev/shmem
[type=link] /var/log=/tmp
[type=link] /usr/tmp=/tmp


#Shared libraries
libc.so
libz.so
libm.so
libmq.so
libcpp.so.5
libcpp-ne.so.5
librpc.so
spi-pl022.so
libdma-sdma.so

libsocket.so
/lib/lsm-pf-v4.so = lsm-pf-v4.so
/lib/dll/devnp-steth-slx.so = devnp-steth-slx.so

# Executables
[data=c]
[perms=+r,+x]

#Serial Driver
#/bin/uart-pl011 = uart-pl011
/bin/devc-serPl011 = devc-serPl011
#Serial Test App
/usr/bin/uart-test =uart-test

#I2C Driver
/bin/i2c-stat = i2c-stat
#I2C Driver Test App
/usr/bin/i2c-test = i2c-test

#SPI Driver
/bin/spi-master = spi-master
#SPI Driver Test App
/usr/bin/spi-test = spi-test

#NAND Driver
/bin/fs-etfs-at-micron = fs-etfs-at-micron
#NAND Driver Test App
/usr/bin/nand_test_app = nand_test_app


#GPIO Driver
/bin/gpio-stat = gpio-stat
#GPIO Driver Test App
/usr/bin/gpio_test = gpio_test

#WDT Driver
/bin/wdt-stat = wdt-stat
#WDT Driver Support App
/usr/bin/wdt-support = wdt-support

#MTU Driver
/bin/mtu = mtu
#MTU Driver Test App
/usr/bin/mtu_test_app = mtu_test_app

#RTC Driver
/bin/rtc-stat = rtc-stat
#RTC Driver Test App
/usr/bin/rtc-test = rtc-test


#Ethernet Network stack
/sbin/io-pkt-v6-hc = io-pkt-v6-hc
/sbin/io-pkt-v4 = io-pkt-v4
/sbin/io-pkt-v4-hc = io-pkt-v4-hc




#DMA test application
dma-test

#Commands needed for Ethernet
nicinfo
ping
ftp
ifconfig
if_up
dhcp.client
arp
tcpdump
sysctl
/usr/sbin/inetd=inetd
/usr/sbin/telnetd=telnetd
/usr/sbin/telnet=telnet
/bin/login=login
/usr/bin/passwd=passwd
/usr/bin/ssh=ssh
/usr/bin/scp=scp
/usr/sbin/sshd=sshd
ssh-keygen
ssh-add
ssh-agent
ssh-keyscan
ssh-keysign

#Commands needed for NAND
etfsctl
fs-etfs-ram
df

############################################################################
### General commands
############################################################################
ksh
hogs
ls
pipe
pidin
slogger
syslogd
slogger2
sloginfo
cp
rm
slay
mv
grep
more
mount
uname
umount
waitfor
shutdown
sleep
getconf
setconf
dumper
chmod
fdisk
mkdosfs
devb-ram
cat
vi
use
mkdir
out32
in32
random
date
tar
gzip
gunzip
zcat
mq
ln
top
route
sync
dd
on
mqueue
devc-pty
ldd
sysctl
pwd
echo
which
stty
esh

/etc/autoconnect=${QNX_TARGET}/etc/autoconnect
/etc/ftpusers=${QNX_TARGET}/etc/ftpusers
/etc/group=${QNX_TARGET}/etc/group
/etc/hosts=${QNX_TARGET}/etc/hosts
/etc/passwd=${QNX_TARGET}/etc/passwd
/etc/motd=${QNX_TARGET}/etc/motd
/etc/netconfig=${QNX_TARGET}/etc/netconfig
/etc/networks=${QNX_TARGET}/etc/networks
/etc/protocols=${QNX_TARGET}/etc/protocols
/etc/qversion=${QNX_TARGET}/etc/qversion
/etc/rpc=${QNX_TARGET}/etc/rpc
/etc/services=${QNX_TARGET}/etc/services
/etc/termcap=${QNX_TARGET}/etc/termcap
/usr/lib/terminfo=${QNX_TARGET}/usr/lib/terminfo
/etc/profile=../prebuilt/etc/profile
/usr/bin/logout=logout
/usr/bin/ps=ps
/usr/bin/nice=nice
/usr/bin/find=find
/usr/bin/touch=touch


Assuming it is, do you see this message printed with esh and ksh? That's the last printout before you launch the shell
'MTU driver launched'

Also I don't see where you assign the shell to the serial port like you did originally in the first post of your build file. That sets the console input/output to serial port #3 which is where I assume you've hooked up your keyboard.
[type=link] /dev/console=/dev/ser3

Lastly ksh is much more complex than esh. It's meant to be used with user accounts, configuration files etc. Maybe it can't work without them.

Tim

P.S. Here's a sample serial port ksh build file I found here http://www.qnx.com/developers/docs/6.3. ... mples.html

You should be able to remove the stuff you don't need (USB/network etc) and substitute in your serial driver/BSP stuff etc and get this to work assuming serial port 1 as in this example.


###########################################################################
##
## QNX Neutrino 6.x on the MIPS Malta evaluation board (Galileo GT64120A)
##
###########################################################################
##
## SUPPORTED DEVICES:
##
## SERIAL: RS-232 ports UART0 and UART1
## PCI: 4 PCI slots
## NETWORK: AMD 79C973
## FLASH: 4MB Intel Strata Flash
## USB: UHCI USB Host Controller
##
## - For detailed instructions on the default example configuration for
## these devices see the "CONFIGURING ON-BOARD SUPPORTED HARDWARE"
## section below the build script section, or refer to the BSP docs.
## - Tip: Each sub-section which relates to a particular device is marked
## with its tag (ex. SERIAL). You can use the search features of
## your editor to quickly find and add or remove support for
## these devices.
##
###########################################################################
##
## NOTES:
##
###########################################################################

###########################################################################
## START OF BUILD SCRIPT
###########################################################################

[image=0x800a0000]
[virtual=mipsle,srec] .bootstrap = {
###########################################################################
## default frequency for 4kc is 80Mhz; adjust -f parameter for different
## frequencies
###########################################################################
startup-malta -f 80000000 -v
PATH=:/proc/boot procnto-32 -v
}

[+script] .script = {
procmgr_symlink ../../proc/boot/libc.so.2 /usr/lib/ldqnx.so.2

display_msg Welcome to QNX Neutrino 6.x on the Malta evaluation board

#######################################################################
## SERIAL driver
#######################################################################
devc-ser8250 -e -c1843200 -b38400 0x180003f8,0x80020004 \
0x180002f8,0x80020003 &
waitfor /dev/ser1
reopen /dev/ser1

slogger &
pipe &

#######################################################################
## PCI server
#######################################################################
display_msg Starting PCI server...

pci-malta &
waitfor /dev/pci 4

#######################################################################
## FLASH driver
#######################################################################
# display_msg Starting flash driver...
#
# devf-malta &

#######################################################################
## NETWORK driver
## - substitute your IP address for 1.2.3.4
#######################################################################
display_msg Starting on-board ethernet with large TCP/IP stack...

io-net -dpcnet -ptcpip
waitfor /dev/io-net/en0 4
ifconfig en0 1.2.3.4

#######################################################################
## REMOTE_DEBUG (gdb or Momentics)
## - refer to the help documentation for the gdb, qconn and the IDE
## for more information on remote debugging
## - the commands shown require that NETWORK is enabled too
#######################################################################
# devc-pty &
# waitfor /dev/ptyp0 4
# qconn port=8000



#######################################################################
## USB driver
#######################################################################
# display_msg Starting USB driver...
#
# io-usb -duhci &
# waitfor /dev/io-usb/io-usb 4

#######################################################################
## These env variables are inherited by all the programs which follow
#######################################################################
SYSNAME=nto
TERM=qansi
PATH=:/proc/boot:/bin:/sbin:/usr/bin:/usr/sbin
LD_LIBRARY_PATH=:/proc/boot:/lib:/usr/lib:/lib/dll

#######################################################################
## NFS_REMOTE_FILESYSTEM
## - This section is dependent on the NETWORK driver
## - Don't forget to properly configure and run the nfsd daemon on the
## remote fileserver.
## - substitute the hostname or IP address of your NFS server for
## nfs_server. The server must be exporting
## "/usr/qnx630/target/qnx6/mipsle".
#######################################################################
display_msg Mounting NFS filesystem...

waitfor /dev/socket 4
fs-nfs3 nfs_server:/usr/qnx630/target/qnx6/mipsle /mnt

[+session] ksh &
}

[type=link] /bin/sh=/proc/boot/ksh
[type=link] /dev/console=/dev/ser1
[type=link] /tmp=/dev/shmem

###########################################################################
## uncomment for NFS_REMOTE_FILESYSTEM
###########################################################################
[type=link] /bin=/mnt/bin
[type=link] /sbin=/mnt/sbin
[type=link] /usr/bin=/mnt/usr/bin
[type=link] /usr/sbin=/mnt/usr/sbin
[type=link] /lib=/mnt/lib
[type=link] /usr/lib=/mnt/usr/lib
[type=link] /etc=/mnt/etc

libc.so
libm.so

###########################################################################
## uncomment for NETWORK driver
###########################################################################
devn-pcnet.so
libsocket.so
npm-tcpip.so

###########################################################################
## uncomment for USB driver
###########################################################################
# devu-uhci.so
# libusbdi.so

[data=c]
devc-ser8250

###########################################################################
## uncomment for REMOTE_DEBUG (gdb or Momentics)
###########################################################################
# devc-pty
# qconn

###########################################################################
## uncomment for PCI server
###########################################################################
pci-malta
pci

###########################################################################
## uncomment for FLASH driver
###########################################################################
# devf-malta
# flashctl

###########################################################################
## uncomment for NETWORK driver
###########################################################################
io-net
ifconfig
nicinfo
netstat
ping

###########################################################################
## uncomment for USB driver
###########################################################################
# io-usb
# usb

###########################################################################
## uncomment for NFS_REMOTE_FILESYSTEM
###########################################################################
fs-nfs3

###########################################################################
## general commands
###########################################################################
ls
ksh
pipe
pidin
uname
slogger
sloginfo
slay

###########################################################################
## END OF BUILD SCRIPT
###########################################################################
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: Unable to launch Uart serial driver

Postby Anant Pai » Tue May 30, 2017 5:39 am

Tim,

We were able to solve the issue of launching the ksh with the serial driver.
The problem was in one of the functions in the driver named drain_check.
In this function we were checking the FIFO empty condition against a wrong register bit because of which the shell was getting stuck in a indefinite loop.

During debug we found that this function affects the working of ksh only and does not impact the working of esh, because of which we were able to launch the esh and not ksh. With this change in the driver all the features of the shell including command completion and job control work fine.

Thanks for your support throughout it helped us make progress when we were having little clue on how to progress with this problem.

Regards
Anant Pai
Anant Pai
Active Member
 
Posts: 19
Joined: Wed Mar 01, 2017 2:25 pm

Previous

Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 0 guests