Discussion:
NuttShell using Telnet only
(too old to reply)
bhaumikbhatt3@yahoo.com [nuttx]
2015-11-06 03:37:49 UTC
Permalink
Hi Greg and NuttX group members,

I have been using a SAMA5D3-xplained dev board and am having trouble getting to a NuttShell telnet session as the only console. I have a setup working with telnet sessions also working well, if I do 2 dedicated serial ports for console and SLIP. However, the target custom board will only have 1 UART.


I want to use only one UART and have that dedicated for SLIP, which talks to a Linux box as a point to point connection. Combined with that, as I will have network connectivity enabled, I would like to spawn a telnet session using that connection to get to the NuttShell. What configuration options should I use for this?


I already use the custom board_initialize and slip_initialize() in board_app_initialize(), which spawn the slip_rx/tc tasks. I also have all network connectivity options for the NSH_LIBRARY and so on.


Thanks in advance,
Bhaumik
spudarnia@yahoo.com [nuttx]
2015-11-06 04:08:03 UTC
Permalink
I have never actually tried to do that. There could be some trivial OS- or NSH-related issues that you may need to deal with but what you want to do should be possible.

The primary is issue is the system needs to be able to boot without a console device at /dev/console. By default, the system assumes that there is a console device at /dev/console and tries to open that for file descriptors 0, 1, and 2 when the first task, nsh_main, is spawned.

A secondary issue is that you need to suppress the warnings and errors that you see because there is not serial console.

A Telnet NSH session differs from fixed serial console in several ways but for one, there is no Telnet when the system first boots up. The Telnet session can only be started some time later when the host PC establishes the Telnet connection.

This is not really different from using a USB session if you think about it: The USB session also does not exist at boot time and there is no serial console. There are several USB-based NSH configurations:

$ find configs -name usbnsh
configs/hymini-stm32v/usbnsh
configs/maple/usbnsh
configs/mikroe-stm32f4/usbnsh
configs/sam4e-ek/usbnsh
configs/spark/usbnsh
configs/stm32f3discovery/usbnsh
configs/stm32f429i-disco/usbnsh
configs/stm32f4discovery/usbnsh
configs/stm32_tiny/usbnsh
configs/sure-pic32mx/usbnsh

If you compare a usbnsh configuration with and nsh configuration, you will see many differences:

$ cd configs/stm32f4discovery
$ ../../tools/cmpconfig.exe nsh/defconfig usbnsh/defconfig

The important differences that allow the USB console version of NSH to work are the following

nsh/defconfig usbnsh/defconfig
------------- ----------------
CONFIG_DEV_CONSOLE=y (not selected)
CONFIG_USART2_SERIAL_CONSOLE=y CONFIG_NO_SERIAL_CONSOLE=y

There may be more to getting the job done than just those to settings. That that is where you need to start.

Greg
spudarnia@yahoo.com [nuttx]
2015-11-06 04:11:49 UTC
Permalink
I see that the spacing in my little table got badly mangled when it was HTML-ized. Maybe it will make more sense if I present the settings like this:

nsh/defconfig:

CONFIG_DEV_CONSOLE=y
# CONFIG_NO_SERIAL_CONSOLE is not set
CONFIG_USART2_SERIAL_CONSOLE=y

usbnsh/defconfig:

# CONFIG_DEV_CONSOLE is not set
CONFIG_NO_SERIAL_CONSOLE=y
# CONFIG_USART2_SERIAL_CONSOLE is not set

Greg
spudarnia@yahoo.com [nuttx]
2015-11-06 04:16:20 UTC
Permalink
You will probably need to experiment. Looking at apps/examples/nsh/nsh_main.c, I think you might also have to deselect CONFIG_NSH_CONSOLE:


# CONFIG_NSH_CONSOLE is not set


Greg
bhaumikbhatt3@yahoo.com [nuttx]
2015-11-06 22:08:06 UTC
Permalink
Thanks a lot for your inputs Greg. Appreciate your effort in helping on this! I will check on these and get back to you.

I have been comparing the usbnsh config to my intended one, and I comment out stuff based on what I saw. I don't see any activity over SLIP though, ping doesn't work. And nothing can be seen on the serial console of course, since there is none. Will still try a few more things.


I was also wondering if I could use SYSLOG_CONSOLE as the /dev/telnetdX device? For that, I would need syslog to wait and register only after a telnet session is spawned. Would that be a good approach?
spudarnia@yahoo.com [nuttx]
2015-11-06 22:11:22 UTC
Permalink
I have never found any good use for a SYSLOG_CONSOLE. That was an idea that I tried several years ago but I don't think it is useful.


Greg
bhaumikbhatt3@yahoo.com [nuttx]
2015-11-06 22:27:19 UTC
Permalink
Can I leave the serial console setting be (CONFIG_UART0_SERIAL_CONSOLE) and disable CONFIG_NSH_CONSOLE? I have a feeling, if there is nothing happening/ no activity, no debug messages, and/or no DEV_CONSOLE and no LOWCONSOLE, maybe this should still work.
bhaumikbhatt3@yahoo.com [nuttx]
2015-11-06 23:18:20 UTC
Permalink
With this config option mentioned above, I can actually ping over the SLIP connection from my Linux box to the IP address assigned to my Atmel SAM board. However, as soon as the telnet session starts, I don't see the nsh> prompt and nothing works in spite of telnet session being active and connection being successful to 10.0.0.2 from the Linux side. Seems to be stuck somewhere and Wireshark shows TCP Retransimission, meaning, it can't send packets to destination?
bhaumikbhatt3@yahoo.com [nuttx]
2015-11-09 17:20:15 UTC
Permalink
I got it to work. This is the working .config file - attached.

Continue reading on narkive:
Loading...