Hello,
I developped a serial port application with the linux kernel 2.6.24 and it worked well. Now I'm using the 2.6.25-rc6 kernel and when i want to execute this command:
echo "hello world" > /dev/ttymxc1
The following error occurs:
[ 3.220000] Division by zero in kernel.
[ 3.220000] [] (dump_stack+0x0/0x14) from [] (__div0+0x18/0x20)
[ 3.220000] [] (__div0+0x0/0x20) from [] (Ldiv0+0x8/0x10)
[ 3.220000] [] (imx_set_termios+0x0/0x314) from [] (uart_change_speed+0x98/0x9c)
[ 3.220000] [] (uart_change_speed+0x0/0x9c) from [] (uart_open+0x404/0x550)
[ 3.220000] [] (uart_open+0x0/0x550) from [] (tty_open+0x158/0x328)
[ 3.220000] [] (tty_open+0x0/0x328) from [] (chrdev_open+0x124/0x21c)
[ 3.220000] [] (chrdev_open+0x0/0x21c) from [] (__dentry_open+0x104/0x234)
[ 3.220000] [] (__dentry_open+0x0/0x234) from [] (nameidata_to_filp+0x48/0x50)
[ 3.220000] [] (nameidata_to_filp+0x0/0x50) from [] (do_filp_open+0x4c/0x50)
[ 3.220000] r4:00000241
[ 3.220000] [] (do_filp_open+0x0/0x50) from [] (do_sys_open+0x58/0x9c)
[ 3.220000] r5:00000003 r4:00000241
[ 3.220000] [] (do_sys_open+0x0/0x9c) from [] (sys_open+0x24/0x28)
[ 3.220000] r8:c001f724 r7:00000005 r6:00000000 r5:00076928 r4:000769a8
[ 3.220000] [] (sys_open+0x0/0x28) from [] (ret_fast_syscall+0x0/0x2c)
Has anybody an idea? Thanks in advance!
Arnaud
which settings
which are that device's settings when you echo into it? from the last functions in the call stack imx_set_termios() and uart_change_speed() i would assume that some default setting, e.g. baud rate, is wrong. you can use the program setserial or the functions listed in the man page to termios to query the default setting and to set sane values. to work around the problem -- most people want to initialize their serial ports before use anyway, because the default settings are very slow. some systems store the settings in a disk file and restore them on reboot. either the persistent state is wrong or the driver sets invalid defaults.
Thanks for your answer!
Thanks for your answer! First I tried to get information on my first serial port :
root@192:~> setserial /dev/ttymxc0 -a/dev/ttymxc0, Line 0, UART: undefined, Port: 0x0000, IRQ: 20
Baud_base: 153935, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal
Then I tried to do that with the second one :
root@192:~> setserial /dev/ttymxc1 -a[ 27.440000] Division by zero in kernel.
[ 27.450000] [] (dump_stack+0x0/0x14) from [] (__div0+0x18/0x20)
[ 27.460000] [] (__div0+0x0/0x20) from [] (Ldiv0+0x8/0x10)
[ 27.460000] [] (imx_setup_ufcr+0x0/0x68) from [] (imx_startup+0x1c/0x1a0)
... and a lot of debug mesg ...
[ 27.710000] [] (do_sys_open+0x0/0x9c) from [] (sys_open+0x24/0x28)
[ 27.710000] r8:c001f724 r7:00000005 r6:be9a3f46 r5:00000003 r4:be9a3e84
[ 27.710000] [] (sys_open+0x0/0x28) from [] (ret_fast_syscall+0x0/0x2c)
/dev/ttymxc1, Line 1, UART: undefined, Port: 0x0000, IRQ: 19
Baud_base: 0, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal
First, I don't understand why the UART field is "undefined", it can't work properly according to the setserial man page if I understand well (although it works well for the first serial port).
I tried to change the baud_base which can't obviously stay at zero :
root@192:~> setserial /dev/ttymxc1 baud_base 115200[ 35.870000] Division by zero in kernel.
[ 35.880000] [] (dump_stack+0x0/0x14) from [] (__div0+0x18/0x20)
[ 35.890000] [] (__div0+0x0/0x20) from [] (Ldiv0+0x8/0x10)
... and a lot of debug mesg ...
and then
root@192:~> setserial /dev/ttymxc1 -a[ 37.610000] Division by zero in kernel.
[ 37.610000] [] (dump_stack+0x0/0x14) from [] (__div0+0x18/0x20)
... and a lot of debug mesg ...
[ 37.610000] [] (sys_open+0x0/0x28) from [] (ret_fast_syscall+0x0/0x2c)
/dev/ttymxc1, Line 1, UART: undefined, Port: 0x0000, IRQ: 19
Baud_base: 0, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal
It is unchanged ... I don't know what I missed, may be something in kernel configuration. I use a patched 2.6.25-rc6 kernel for my board which is based on ARM iMX27. Thank you again for helping me!