Can't type in NSH console


I have been doing development with the PX4 Matlab Toolbox. I use a custom startup script to launch the apps I need to use. Yesterday, I lost the ability to send commands in the NSH terminal but I can still see the output during startup. If I reboot the pixhawk without the SD card and custom startup script I can access the shell correctly. Can someone please identify where my startup script is conflicting with the shell?

usleep 1000
uorb start
usleep 1000
#nshterm /dev/ttyACM0 &
#usleep 1000
px4io start
usleep 1000
#commander start
#usleep 1000
#mavlink start -d /dev/ttyS2 -b 57600
#usleep 5000
#dataman start
#usleep 1000
#navigator start
#usleep 1000
sh /etc/init.d/rc.sensors
usleep 1000
#sh /etc/init.d/rc.logging
#usleep 1000
#gps start
#attitude_estimator_q start
ekf2 start
#position_estimator_inav start
usleep 1000
mtd start
usleep 1000
param load /fs/mtd_params
usleep 1000
rgbled start
usleep 1000
nshterm /dev/ttyS6 & #this will make ttyS6 the serial console
usleep 1000
px4_simulink_app start

EDIT: So I performed some debug tests. I had access to the shell when “position_estimator_inav start” was enabled because it caused the script to error out? After commenting that out, I start commenting out different commands but still have the same issue where I am unable to send NSH commands.


Is the px4_simulink_app written by you? Does it start a new task using px4_task_spawn_cmd? And does the main function of the px4_simulink_app exit. If it doesn’t exit or if you have started a thread in the main function using a pthread instead of px4_task_spawn_cmd, then your main function will not exit correctly and you won’t get back to the NSH shell.

What you can do to narrow down which module is causing your issues, is to start the modules from the NSH console directly. So don’t use the startup script ,but manually start each o the functions in turn until you find which one doesn’t return to the console.


Thank you for your reply. It ended up being a faulty startup script.


Hello blankered. How did you get access to the shell? Through a FTDI ?

I am working to get external mode with pixfalcon but i dont seem to get access to the shell through the TELEM (UART) port.