You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Daniel Pereira Carvalho <da...@gmail.com> on 2022/10/21 00:04:32 UTC

Get control of NSH serial port?

Hi guys,

I am writing a program for a board that has only one serial port available,
the one used by NSH. My application needs to use this port for MODBUS so,
my application needs to take control of the serial port and give it back to
NSH when execution is done.

Is this possible? If yes, how can I do this?

Thanks

Daniel Pereira de Carvalho

Re: Get control of NSH serial port?

Posted by Gregory Nutt <sp...@gmail.com>.
>
> But the simplest thing that comes to mind is just to kill the NSH task,
> run modbus, and restart NSH when you are finished with modbus.
>

Maybe even simpler:  Run the modbus task at a higher priority than NSH.
Then all of the serial into should go to Modbus and not to NSH

Re: Get control of NSH serial port?

Posted by Gregory Nutt <sp...@gmail.com>.
I suppose there are lots of ways to do that by closing and redirecting
NSH's standard I/O.

But the simplest thing that comes to mind is just to kill the NSH task, run
modbus, and restart NSH when you are finished with modbus.

On Thu, Oct 20, 2022 at 6:05 PM Daniel Pereira Carvalho <da...@gmail.com>
wrote:

> Hi guys,
>
> I am writing a program for a board that has only one serial port available,
> the one used by NSH. My application needs to use this port for MODBUS so,
> my application needs to take control of the serial port and give it back to
> NSH when execution is done.
>
> Is this possible? If yes, how can I do this?
>
> Thanks
>
> Daniel Pereira de Carvalho
>