LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   serial console problem on imx31 target (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/serial-console-problem-on-imx31-target-894957/)

brmentink 08-01-2011 04:12 PM

serial console problem on imx31 target
 
Hi Guys,

I am trying to port linux to a custom imx31 based board which is similar to the LogicPD mx31litekit board.

I have u-boot working and the kernel seems to be booting as I can see the kernel messages in the RAM ring buffer and it only panics when trying to boot the root filesystem, which I havn't provided just yet.

My problem is that after the "booting kernel" message I get no serial output and have to look in the ring buffer with u-boot md to see the kernel messages.

If I turn on earlyprintk by passing that kernel parameter, I see those messages, the problem is the console output is not working.

Currently I am passing "noinitrd console=ttymxc0,115200n8 earlyprintk=serial,ttymxc0,115200,keep" to the kernel.

I have all the CONFIG_CONSOLE_xx config options turned on for the imx in the kernel.

In debugging this in the drivers/serial/mx.c file, I notice that the imx_console_xx style functions are NOT being called at all ... so not sure what I am missing here..

Can Anyone help here?

EDIT: I notice that this post has gone in the Linux newbie forum, wher it was intended to go into the Hardware forum, so moderator please transfer thsi post.

brmentink 08-03-2011 03:09 AM

Bump! Anyone?

brmentink 08-04-2011 05:41 PM

I went the next step and mounted the root filesystem via nfs ... that mounted ok, but I got a kernel panic after the warning message "Warning: no initial console found"

I guess this is all part of my problem of having no serial console working ..

Question: Should I have a /dev/ttymxc0 in my /dev directory for the imx31? I only see a ttyS0 and a ttySA0 in that directory, but these don't work when passed on the kernel bootarg line either..

Can someone please help me get this serial console working ...

brmentink 08-06-2011 06:26 PM

Anyone on this forum??

brmentink 08-08-2011 04:19 PM

help ..... Is this forum used at all? Or is it I have not provided enough info on the problem.
If the later, please indicate what info is missing ..... if the former ... I am stuffed ...

theNbomr 08-09-2011 11:28 AM

Does your kernel have a built-in driver for the serial hardware that is present on your board? Have you been able to successfully exercise it from a userspace application? I don't see where there should be any connection between an NFS mount and a serial console. Is there a getty being spawned on the respective port? There should be a /dev/whatever device node in order to access the port. Are you sure of the name? Are you sure that the kernel uses comm's parameters (bit rate, word size, parity, etc) appropriate to your terminal setup? Does the driver require any hardware flow control or handshake on modem control lines?

I assume you've read and understand all of the usual tutorials and howtos for this kind of stuff.

Linux Serial Console HOWTO
Remote Serial Console HOWTO

--- rod.

brmentink 08-09-2011 02:40 PM

Quote:

Originally Posted by theNbomr (Post 4437868)
Does your kernel have a built-in driver for the serial hardware that is present on your board? Have you been able to successfully exercise it from a userspace application? I don't see where there should be any connection between an NFS mount and a serial console. Is there a getty being spawned on the respective port? There should be a /dev/whatever device node in order to access the port. Are you sure of the name? Are you sure that the kernel uses comm's parameters (bit rate, word size, parity, etc) appropriate to your terminal setup? Does the driver require any hardware flow control or handshake on modem control lines?

I assume you've read and understand all of the usual tutorials and howtos for this kind of stuff.

Linux Serial Console HOWTO
Remote Serial Console HOWTO

--- rod.

To Answer your questions in order:
1. Does your kernel have a built-in driver for the serial hardware that is present on your board?
The kernel has configuration options for the iMX31 internal serial ports, and there is a ../drivers/serial/imx.c file, so I guess the answer is yes.

2. Have you been able to successfully exercise it from a userspace application?
What does this mean? I do not have a login to my kernel yet ..

3. Is there a getty being spawned on the respective port? There should be a /dev/whatever device node in order to access the port
There was not a getty for the name of the port (ttySMX0) so I put one in the inittab file and created a dev/ttySMX0 device, as there was not one created.

4. Are you sure of the name? Are you sure that the kernel uses comm's parameters (bit rate, word size, parity, etc)
No, I am not sure of the name, I have seen ttymxc used as well as ttySMX in reference to imx serial devices, I am sure of the baud rate etc though ..
In the imx.c code I changed the "#define DEV_NAME "ttySMX" from ttymxc .... the uboot I am using shows a ttySMX device.

In debugging this issue, I see that the function imx_serial_init() is called in imx.c but I see no probe call into the driver so in the kernel log all I am seeing
is: Serial: IMX driver ... which is printed out by the above init function.

I should be getting the following (as seen from other kernel posts for imx)

Serial: IMX driver
imx-uart.0: ttySMX0 at MMIO 0x1000a000 (irq = 20) is a IMX
console [ttySMX0] enabled

I am not getting that so the kernel is not seeing a serial device ..

theNbomr 08-09-2011 06:26 PM

I didn't know whether you had some other way to login to the host, perhaps SSH or telnet over ethernet. Even still, it is possible to launch userspace applications as daemon processes.

That the kernel doesn't report the existence of some serial hardware seems likely to be the root of the problem. Is there any configuration issue that needs to be addressed? Jumpers on the board? BIOS/flash setup? When you changed the name of the serial port, did you make the accordant changes to the kernel commandline arguments?

--- rod.

brmentink 08-09-2011 06:42 PM

Quote:

Originally Posted by theNbomr (Post 4438230)
I didn't know whether you had some other way to login to the host, perhaps SSH or telnet over ethernet. Even still, it is possible to launch userspace applications as daemon processes.

That the kernel doesn't report the existence of some serial hardware seems likely to be the root of the problem. Is there any configuration issue that needs to be addressed? Jumpers on the board? BIOS/flash setup? When you changed the name of the serial port, did you make the accordant changes to the kernel commandline arguments?

--- rod.

Hi Rod,

Since I am having this trouble getting serial console support, I tried logging in via ssh, but I get a "connection refused" error. I notice that dropbear is used as the ssh server in the image I built, but I don't even know if the init process is being called .... is there a way to verify the init process, or provide a simple inittab file that launches something simple (i.e just run dropbear ssh daemon) that I can login to .. I don't know anything about the init process, so some help here would be useful.

(I am used to Archlinux which has a much simpler BSD style init process ..)

Regarding configuration, I have attached some of my .config ... please see if there is a problem.
and Yes, I did change the kernel arguments when I changes the serial port name.

Quote:

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.36.1
# Wed Aug 10 08:20:11 2011
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

"
"

#
# System Type
#
CONFIG_MMU=y
# CONFIG_ARCH_AAEC2000 is not set
# CONFIG_ARCH_INTEGRATOR is not set
# CONFIG_ARCH_REALVIEW is not set
# CONFIG_ARCH_VERSATILE is not set
# CONFIG_ARCH_VEXPRESS is not set
# CONFIG_ARCH_AT91 is not set
# CONFIG_ARCH_BCMRING is not set
# CONFIG_ARCH_CLPS711X is not set
# CONFIG_ARCH_CNS3XXX is not set
# CONFIG_ARCH_GEMINI is not set
# CONFIG_ARCH_EBSA110 is not set
# CONFIG_ARCH_EP93XX is not set
# CONFIG_ARCH_FOOTBRIDGE is not set
CONFIG_ARCH_MXC=y
# CONFIG_ARCH_STMP3XXX is not set
# CONFIG_ARCH_NETX is not set
# CONFIG_ARCH_H720X is not set
# CONFIG_ARCH_IOP13XX is not set
# CONFIG_ARCH_IOP32X is not set
# CONFIG_ARCH_IOP33X is not set
# CONFIG_ARCH_IXP23XX is not set
# CONFIG_ARCH_IXP2000 is not set
# CONFIG_ARCH_IXP4XX is not set
# CONFIG_ARCH_DOVE is not set
# CONFIG_ARCH_KIRKWOOD is not set
# CONFIG_ARCH_LOKI is not set
# CONFIG_ARCH_LPC32XX is not set
# CONFIG_ARCH_MV78XX0 is not set
# CONFIG_ARCH_ORION5X is not set
# CONFIG_ARCH_MMP is not set
# CONFIG_ARCH_KS8695 is not set
# CONFIG_ARCH_NS9XXX is not set
# CONFIG_ARCH_W90X900 is not set
# CONFIG_ARCH_NUC93X is not set
# CONFIG_ARCH_TEGRA is not set
# CONFIG_ARCH_PNX4008 is not set
# CONFIG_ARCH_PXA is not set
# CONFIG_ARCH_MSM is not set
# CONFIG_ARCH_SHMOBILE is not set
# CONFIG_ARCH_RPC is not set
# CONFIG_ARCH_SA1100 is not set
# CONFIG_ARCH_S3C2410 is not set
# CONFIG_ARCH_S3C64XX is not set
# CONFIG_ARCH_S5P6440 is not set
# CONFIG_ARCH_S5P6442 is not set
# CONFIG_ARCH_S5PC100 is not set
# CONFIG_ARCH_S5PV210 is not set
# CONFIG_ARCH_S5PV310 is not set
# CONFIG_ARCH_SHARK is not set
# CONFIG_ARCH_LH7A40X is not set
# CONFIG_ARCH_U300 is not set
# CONFIG_ARCH_U8500 is not set
# CONFIG_ARCH_NOMADIK is not set
# CONFIG_ARCH_DAVINCI is not set
# CONFIG_ARCH_OMAP is not set
# CONFIG_PLAT_SPEAR is not set
CONFIG_IMX_HAVE_PLATFORM_IMX_UART=y
CONFIG_IMX_HAVE_PLATFORM_MXC_NAND=y
CONFIG_IMX_HAVE_PLATFORM_SPI_IMX=y

#
# Freescale MXC Implementations
#
# CONFIG_ARCH_MX1 is not set
# CONFIG_ARCH_MX2 is not set
# CONFIG_ARCH_MX25 is not set
CONFIG_ARCH_MX3=y
# CONFIG_ARCH_MXC91231 is not set
# CONFIG_ARCH_MX5 is not set
CONFIG_ARCH_MX31=y

#
# MX3 platforms:
#
# CONFIG_MACH_MX31ADS is not set
# CONFIG_MACH_PCM037 is not set
CONFIG_MACH_MX31LITE=y
# CONFIG_MACH_MX31_3DS is not set
# CONFIG_MACH_MX31MOBOARD is not set
# CONFIG_MACH_MX31LILLY is not set
# CONFIG_MACH_QONG is not set
# CONFIG_MACH_PCM043 is not set
# CONFIG_MACH_ARMADILLO5X0 is not set
# CONFIG_MACH_MX35_3DS is not set
# CONFIG_MACH_KZM_ARM11_01 is not set
# CONFIG_MACH_EUKREA_CPUIMX35 is not set
CONFIG_MXC_IRQ_PRIOR=y
CONFIG_MXC_PWM=y
# CONFIG_MXC_DEBUG_BOARD is not set
CONFIG_ARCH_HAS_RNGA=y
CONFIG_ARCH_MXC_AUDMUX_V2=y

#
# Processor Type
#
CONFIG_CPU_V6=y
# CONFIG_CPU_32v6K is not set
CONFIG_CPU_32v6=y
CONFIG_CPU_ABRT_EV6=y
CONFIG_CPU_PABRT_V6=y
CONFIG_CPU_CACHE_V6=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_COPY_V6=y
CONFIG_CPU_TLB_V6=y
CONFIG_CPU_HAS_ASID=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y

#
# Processor Features
#
CONFIG_ARM_THUMB=y
# CONFIG_CPU_ICACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_DISABLE is not set
# CONFIG_CPU_BPREDICT_DISABLE is not set
CONFIG_OUTER_CACHE=y
CONFIG_OUTER_CACHE_SYNC=y
CONFIG_CACHE_L2X0=y
CONFIG_ARM_L1_CACHE_SHIFT=5
CONFIG_ARM_DMA_MEM_BUFFERABLE=y
CONFIG_CPU_HAS_PMU=y
CONFIG_ARM_ERRATA_411920=y
CONFIG_COMMON_CLKDEV=y

#
# Bus support
#
# CONFIG_PCI_SYSCALL is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
# CONFIG_PCCARD is not set

"
"

#
# Device Drivers
#

"
"

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_DEVKMEM=y
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_N_GSM is not set

#
# Serial drivers
#
# CONFIG_SERIAL_8250 is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_IMX=y
CONFIG_SERIAL_IMX_CONSOLE=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_TIMBERDALE is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
# CONFIG_LEGACY_PTYS is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_R3964 is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
# CONFIG_RAMOOPS is not set
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_MUX is not set
CONFIG_I2C_HELPER_AUTO=y

#
# I2C Hardware Bus support
#

#

theNbomr 08-09-2011 07:44 PM

From a cursory inspection, it looks like your kernel config contains everything I'd expect with respect to the serial port. What does 'CONFIG_SERIAL_NONSTANDARD' do (wondering aloud...)?

When I used the word 'configuration' I was really referring to something outside the OS; hardware or firmware.

You can run anything as the init process. Many small system use busybox as the init process. As long as it is statically linked, you should be able to drop in your own simple code the exercise the serial port as a test & diagnostic of the serial port. I've been using Microcore Linux on small systems lately, and I find their init system very simple to understand and modify.

--- rod.

brmentink 08-09-2011 07:54 PM

Quote:

Originally Posted by theNbomr (Post 4438269)
From a cursory inspection, it looks like your kernel config contains everything I'd expect with respect to the serial port. What does 'CONFIG_SERIAL_NONSTANDARD' do (wondering aloud...)?

When I used the word 'configuration' I was really referring to something outside the OS; hardware or firmware.

Well, the kernel actually prints out to the serial port just before the serial console is configured so I don't see how the hardware etc is an issue, i.e I get:

Starting kernel ................. <-- This line printed by uboot

Uncompressing Linux ..... done, booting the kernel. <--- This line is printed by the kernel



All other kernel messages I only see in the kernel log in RAM (displayed by uboot after doing a reset of the box ..)

Quote:

Originally Posted by theNbomr (Post 4438269)

You can run anything as the init process. Many small system use busybox as the init process. As long as it is statically linked, you should be able to drop in your own simple code the exercise the serial port as a test & diagnostic of the serial port. I've been using Microcore Linux on small systems lately, and I find their init system very simple to understand and modify.

--- rod.

Not enough information ... can you give examples of a simple inittab file

Thanks,
B

theNbomr 08-10-2011 12:23 PM

inittab is a configuration script used by some/most larger scale Linux distros, and is more or less standard in that class of Linux installation. The actual process that uses it is the init process (the name of the binary executable, as well as the generic name of the initial userspace process launched by the kernel). In some systems, init, the binary is just a part of busybox, and it treats it's 'inittab' script as just another shell script. As such, you can put anything in the script that you want.
I suggest you look at the Microcore Linux distro to see how they have done it. You don't have to install the system, just mount the ISO on a loop device, and browse the filesystem. Look specifically at the file '/etc/init.d/rcS' which is their version of the init startup script. It can be simplified even more that what they've provided, to the extent that the only thing you would run is some diagnostics. Or, to simplify even more, simply create a program (assuming you have the wherewithal to do so), statically linked, that does something that you can witness; blinks an LED, toggles an IO bit forever, whatever is available on your board. Specify that program as the init process in the kernel commandline args. If it gets launched by the kernel, you should be able to see it doing its thing. When you see it, you know the process is getting launched. The next step would be to see if you can access the serial port with a userspace tool. Again a simple statically linked binary that opens the serial port and repeatedly sends some data, which you should be able to see with a terminal running on another host.
Of course, all of this requires a root filesystem, which upon re-reading this thread, I see that you don't yet have. Are you planning to mount an initrd, an NFS root, or some other media? How far away from being implemented is your root filesystem?
I am still concerned that all of this is a moot point if the driver isn't seeing the serial port hardware. I do not know anything specific to your hardware or the respective driver, so I'm sorry I can't make any suggestion there. Is it possible to specify any details of the hardware (IO address, interrupt assignments, etc) to the serial port driver via the kernel commandline?

--- rod.

brmentink 08-10-2011 02:14 PM

Hi Rod,

I have mounted an NFS root filesystem to see if I can get a console working, but my boot only gets to the "Freeing init memory: 104K" message, I don't see any messages on init starting up.

I have created a root filesystem with openembedded, decompressed it into my /export directory on my host computer and it "seems" to be mounted correctly i.e this is from the kernel ring buffer

Quote:

device=
eth0, addr=10.3.
16.116, mask=255
.0.0.0, gw=255.2
55.255.255,.<4>
host=10.3.16
.116, domain=, n
is-domain=(none)
,.<4> bootse
rver=255.255.255
.255, rootserver
=10.3.16.71, roo
tpath=.<4>Warnin
g: unable to ope
n an initial con
sole..<5>Looking
100003/3 on 10.3
up port of RPC
.16.71.<5>Lookin
g up port of RPC
100005/3 on 10.
3.16.71.<4>VFS:
Mounted root (nf
s filesystem) on
device 0:11..<6
>Freeing init me
mory: 104K......
................
My etc/inittab on that filesystem is:

Quote:

# The default runlevel.
id:5:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
S:2345:respawn:/sbin/getty 115200 ttymxc0
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#

1:2345:respawn:/sbin/getty 38400 tty1

frieza 08-10-2011 02:45 PM

if the device file didn't exist as expected then either
1) it is named something other than expected
2) the kernel isn't loading the driver properly
was the driver compiled into the kernel or as a module?
if it was compiled as a module you can either
1) re-compile the kernel with the driver built into the kernel (recommended for anything needed at time of boot since the modules load later in the boot sequence than can be used for time of boot options)
2) create an initramfs that loads the driver at boot time, then make sure the driver is in the modprobe.conf (or equivilent) for your system. (more complicated and less reliable)

brmentink 08-10-2011 03:04 PM

Quote:

Originally Posted by frieza (Post 4439000)
if the device file didn't exist as expected then either
1) it is named something other than expected

I have tried both names ttymxc0 and ttySMX0, both don't work ... I would like to hear any other suggestions.

Quote:

Originally Posted by frieza (Post 4439000)
2) the kernel isn't loading the driver properly
was the driver compiled into the kernel or as a module?

The serial driver can only be configured as a built in driver (you can't hit "M" on configuration, can only select "*")

I still don't understand the connection between uboot and kernel when you give it a "console=ttySMX0,115200n8" kernel argument ..
I know that the kernel when it sees that uses the argument as the console instead of the default tty1. But how does it know what serial port on the imx to use?

If a driver gets registered (which it does) what stops it being "probed".. that bit is blank in my understanding ..


All times are GMT -5. The time now is 11:46 PM.