You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Philippe Leduc <ph...@mailfence.com.INVALID> on 2023/08/18 18:14:10 UTC

Porting NuttX - console management trouble

Hello,

I am currently in the process of porting NuttX to the i.MX8MP (Cortex-M7) SoC 
from NXP. I managed to have a POC that boot and the serial seems to work 
properly. However the console seems to behave strangely: I need to configure my 
client to handle the echo and to transform input and output. An example with 
picocom client:
picocom -b 115200 --omap crlf --imap lfcrlf --echo /dev/ttyUSB2

This seems to be unnecessary on other targets (I tried on a picopi and on an 
xmc4700).

Is it a normal behavior? If not is someone have any clues to track this bug?

Thank you in advance,

Best regards,

-- 
Philippe LEDUC
philippe.leduc@mailfence.com





Re: Porting NuttX - console management trouble

Posted by Philippe Leduc <ph...@mailfence.com.INVALID>.
> > from NXP. I managed to have a POC that boot and the serial seems to work
> > properly. However the console seems to behave strangely: I need to
> > configure my
> > client to handle the echo and to transform input and output. An example
> > with
> > 
> > picocom client:
> > picocom -b 115200 --omap crlf --imap lfcrlf --echo /dev/ttyUSB2
> > 
> > This seems to be unnecessary on other targets (I tried on a picopi and on
> > an
> > 
> > xmc4700).
> > 
> > Is it a normal behavior? If not is someone have any clues to track this
> > bug?
> 
> It should work without these parameters. Did you try minicom as well?
> 
> Try to force the ttyUSBx to use the expected configuration for NuttX
> (115200 8N1)
> 
> # stty 115200 cs8 -parenb -crtscts -F /dev/ttyUSB0
> 
> Maybe the serial controller of i.MX8 has some peculiarity that needs
> to be considered.
> 
> BR,
> 
> Alan

Hi Alan,

> 
> Did you see that: https://github.com/apache/nuttx/pull/10294
> 
> Maybe you can reuse or merge part of it.
> 
Yes I see it :)
Unfortunately, the iMX8QM is a very different beast than the iMX8MP (I wonder 
why NXP put theses two SoC with a common naming...).
But fortunately, the iMX8Mxx subfamily share the UART IP with the i.MX6 so I 
managed to reuse it almost completely (I removed GIC interrupt reference since 
I'm working on the Cortex M7 and not the A53 complex).

> It should work without these parameters. Did you try minicom as well?
> 
> Try to force the ttyUSBx to use the expected configuration for NuttX
> (115200 8N1)
> 
> # stty 115200 cs8 -parenb -crtscts -F /dev/ttyUSB0
Same problem with minicom and after forcing the tty configuration.

Note that I test the termios example and everything works so it seems that the 
serial driver is working properly at least.

Best regards,

--
Philippe




Re: Porting NuttX - console management trouble

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Philippe,

On 8/18/23, Philippe Leduc <ph...@mailfence.com.invalid> wrote:
> Hello,
>
> I am currently in the process of porting NuttX to the i.MX8MP (Cortex-M7)
> SoC

Did you see that: https://github.com/apache/nuttx/pull/10294

Maybe you can reuse or merge part of it.

> from NXP. I managed to have a POC that boot and the serial seems to work
> properly. However the console seems to behave strangely: I need to configure
> my
> client to handle the echo and to transform input and output. An example with
>
> picocom client:
> picocom -b 115200 --omap crlf --imap lfcrlf --echo /dev/ttyUSB2
>
> This seems to be unnecessary on other targets (I tried on a picopi and on an
>
> xmc4700).
>
> Is it a normal behavior? If not is someone have any clues to track this
> bug?
>

It should work without these parameters. Did you try minicom as well?

Try to force the ttyUSBx to use the expected configuration for NuttX
(115200 8N1)

# stty 115200 cs8 -parenb -crtscts -F /dev/ttyUSB0

Maybe the serial controller of i.MX8 has some peculiarity that needs
to be considered.

BR,

Alan

Re: Porting NuttX - console management trouble

Posted by Philippe Leduc <ph...@mailfence.com.INVALID>.
Hello,

> Sounds like the console device is in RAW mode.  For proper NSH behavior,
> the console TTY must be configured in COOKED mode.  That configuration
> should occur automatically if the uart was configured as the serial
> console.  I suppose that could use the termios interfaces to force
> COOKED mode, but should not be necessary.
> 
> Do you have a serial port configured as console device (in
> drivers/serial)?  Do you have picocom connected to that uart port? If so
> then you probably have some error in your configuration so that the uart
> is not recognized as the console device in drivers/serial/serial.c
I have a console enabled (at least there is a /dev/console file and when I echo 
on it I received the echoed value). However a configuration error in my project 
is likely (I'm discovering the under the hood of this project after all :)).
I'll recheck this part carefully :)

> Is /dev/ttyUSB2 a USB serial adaptor?  Or are you trying to use a USB
> port for console?
This a serial adaptor, so no trick here I guess.

Best regards,

--
Philippe




Re: Porting NuttX - console management trouble

Posted by Gregory Nutt <sp...@gmail.com>.
On 8/18/2023 12:14 PM, Philippe Leduc wrote:
> Hello,
>
> I am currently in the process of porting NuttX to the i.MX8MP (Cortex-M7) SoC
> from NXP. I managed to have a POC that boot and the serial seems to work
> properly. However the console seems to behave strangely: I need to configure my
> client to handle the echo and to transform input and output. An example with
> picocom client:
> picocom -b 115200 --omap crlf --imap lfcrlf --echo /dev/ttyUSB2
>
> This seems to be unnecessary on other targets (I tried on a picopi and on an
> xmc4700).
>
> Is it a normal behavior? If not is someone have any clues to track this bug?
>
> Thank you in advance,
>
> Best regards,
Sounds like the console device is in RAW mode.  For proper NSH behavior, 
the console TTY must be configured in COOKED mode.  That configuration 
should occur automatically if the uart was configured as the serial 
console.  I suppose that could use the termios interfaces to force 
COOKED mode, but should not be necessary.

Do you have a serial port configured as console device (in 
drivers/serial)?  Do you have picocom connected to that uart port? If so 
then you probably have some error in your configuration so that the uart 
is not recognized as the console device in drivers/serial/serial.c

Is /dev/ttyUSB2 a USB serial adaptor?  Or are you trying to use a USB 
port for console?