This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3354: The DMTimer_1ms is inaccurate due to the insertion of the USB flash drive

Part Number: AM3354


Our product uses linux kernel that you released in 2012, when the AM3354 chip was just launched on the market. The Silicon version we use is Revisions 2.1.
Since no major problems have been encountered, the linux kernel we use has not been updated along with your official website. After all, the update requires a lot of manpower and material resources. We downloaded the kernel source code from this website,arago-project,The picture is as follows.The code we apply for the DMTimer_1ms is as follows

	g_prt_dev->print_timer = omap_dm_timer_request_specific(7);
	if (!g_prt_dev->print_timer) {
		//dev_err(priv->dev, "Error getting Rx Timer resource\n");
		result = -ENODEV;
        printk("err_timer\n");
		goto err_timer;
	}
    omap_dm_timer_enable(g_prt_dev->print_timer);
    // set the clock source to system clock
	omap_dm_timer_set_source(g_prt_dev->print_timer, OMAP_TIMER_SRC_SYS_CLK);

   //set prescalar to 1:1
	omap_dm_timer_set_prescaler(g_prt_dev->print_timer, 0);			
  // figure out what IRQ our timer triggers
	timer_irq = omap_dm_timer_get_irq(g_prt_dev->print_timer);  
  
    /* Install the interrupt handler */
    if (request_irq(timer_irq, 
					my_timer_irq, 
					IRQF_DISABLED | IRQF_TIMER,
					"my_timer", 
					g_prt_dev)) {
        result = -EBUSY;
        printk("err_irq\n");
        goto err_irq;
    }

Now, we have encountered a serious problem. Our program needs to rely on the DMTimer_1ms module provided by TI. However, when I am using this DMTimer_1ms, inserting a USB flash drive will cause the interval at which the DMTimer_1ms triggers the interrupt to become It is very long. Normally, it is triggered once every 1ms. After a problem occurs, the DMTimer_1ms takes about 13ms to trigger an interrupt. This phenomenon does not necessarily occur, but when I insert the U disk, the probability of this phenomenon is very high.

We now suspect that there is a problem with the old linux kernel,the linux version is v3.2. We have also checked the errata provided by you, but have not found any relevant clues.

What we want to know now is whether it is necessary to upgrade the kernel to solve this problem, or whether there are related patches that can solve this problem.

  • Hi Qingyong,

    Does the 13ms interval issue only happen for a short period time during the USB device insertion? Or the interval doesn't come back to normal even after the USB device insertion? If so, does it back to normal internal after removed the USB device?

  • The code we apply for the DMTimer_1ms is as follows

    Which kernel file is this code applied to?

  • Hi Bin Liu,

    中文你可能看得更明白,下面的英文是谷歌翻译的。DMTimer_1ms的定时器出现13ms延时后,一直不能恢复,只有重启设备才能恢复,而且出现问题时,U盘拔掉后,问题依然存在,不能恢复,并且此时还能通过lsusb命令查看到这个拔掉的U盘的USB设备节点,感觉像是上一次U盘卸载时,出现了问题从而引起USB模块和定时器模块出现问题。出现问题时,上层Qt程序看起来运行是正常的,我们的触屏也依赖USB,触摸也是正常的,WIFI也依赖USB,WIFI连接也是正常的,但是当使用这个DMTimer_1ms的定时器时,界面就开始出现卡顿,非常卡,通过打印日志看出每隔13ms左右才调用一次中断函数,停止使用这个DMTimer_1ms的定时器后,界面又恢复正常。

    The timer of DMTimer_1ms has a 13ms delay and cannot be restored. It can only be restored by restarting the device, and when a problem occurs, after the U disk is unplugged, the problem still exists and cannot be restored, and at this time, you can also view the USB device node of the unplugged U disk through the lsusb command, it feels like a problem occurred the last time the U disk was uninstalled, which caused problems with the USB module and the timer module. When the problem occurs, the upper-level Qt program seems to be running normally, our touch screen also relies on USB, touch is also normal, WIFI also relies on USB, WIFI connection is also normal, but when using this DMTimer_1ms timer, the UI interface started to freeze,very stuck,It can be seen from the print log that the interrupt function is called only once every 13ms or so.after stopping using this DMTimer_1ms timer, the interface returned to normal.

  • Hi Bin Liu,
    这段是我们自己写的打印驱动代码,我们需要依赖这个DMTimer_1ms定时器,每隔1ms定时向SPI设备发送打印的数据。

    This code is our own print driver code. We need to rely on this DMTimer_1ms timer to send the printed data to the SPI device regularly every 1ms.

  • [09:37:36][  233.909576] Unable to handle kernel NULL pointer dereference at virtual address 00000004
    [09:37:36][  233.918395] pgd = cd03c000
    [09:37:36][  233.921447] [00000004] *pgd=8e6c7831omap2_mcspi_txrx_pio, word_len:8
    [09:37:36][  233.928344] Internal error: Oops: 17 [#1]
    [09:37:36][  233.932525] Modules linked in: mt7601Usta(O) zq_bat zq_beep(O) ftdi_sio ti_adc(C) ti_tsc ti_tscadc zq_thermal_printer spi_omap2_mcspi zq_keyboard compat(O)
    [09:37:36][  233.947082] CPU: 0    Tainted: G        WC O  (3.2.0-svn41 #13)
    [09:37:36][  233.953277] PC is at sd_revalidate_disk+0x18/0x1a60
    [09:37:36][  233.958374] LR is at rescan_partitions+0xa8/0x4c8
    [09:37:36][  233.963287] pc : [<c0253adc>]    lr : [<c00fdd14>]    psr: a00f0013
    [09:37:36][  233.963287] sp : ce6a3c38  ip : ce6a3cc0  fp : ce6a3cbc
    [09:37:36][  233.975280] r10: 0000001d  r9 : 00000068  r8 : cd1bc800
    [09:37:36][  233.980712] r7 : ce91a050  r6 : ffffff85  r5 : cd1bc800  r4 : 00000000
    [09:37:36][  233.987518] r3 : c0253ac4  r2 : 00000000  r1 : 00000001  r0 : cd1bc800
    [09:37:36][  233.994323] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    [09:37:36][  234.001770] Control: 10c5387d  Table: 8d03c019  DAC: 00000015
    [09:37:36][  234.007751] Process udevd (pid: 3579, stack limit = 0xce6a22f0)
    [09:37:36][  234.013946] Stack: (0xce6a3c38 to 0xce6a4000)
    [09:37:36][  234.018463] 3c20:                                                       cd1bc800 ffffff85
    [09:37:36][  234.027008] 3c40: ce91a050 cd1bc800 cd1bc868 ce91a040 ce6a3c7c ce6a3c60 ce91a040 00000000
    [09:37:36][  234.035552] 3c60: ce6a3c7c ce6a3c70 ce6a3c94 ce6a3c78 c00bf3ac cd1bc800 ce91a0b0 ce91a040
    [09:37:36][  234.044067] 3c80: 00000000 ffffff85 ce6a3ca4 ce6a3c98 00000001 ce91a040 cd1bc800 ffffff85
    [09:37:36][  234.052612] 3ca0: ce91a050 cd1bc800 00000068 0000001d ce6a3d2c ce6a3cc0 c00fdd14 c0253ad0
    [09:37:36][  234.061126] 3cc0: ce6a3ce4 ce6a3cd0 c0243fa8 c022b938 c073480c ce0a8e00 00000000 c0495150
    [09:37:36][  234.069671] 3ce0: c0721a80 ce91a040 00000000 ffffff85 cd1bc800 00000000 00000001 00000002
    [09:37:36][  234.078186] 3d00: c0252bac ce91a040 cd1bc800 ffffff85 ce91a050 00000000 00000000 0000001d
    [09:37:36][  234.086730] 3d20: ce6a3d6c ce6a3d30 c00d6a04 c00fdc78 00000000 00000003 ce6a3d5c 00000000
    [09:37:36][  234.095275] 3d40: c0057bbc ce91a040 ce157bc0 00000000 ce9b9b18 cf010ec0 c00d6e20 ce6dfa10
    [09:37:36][  234.103790] 3d60: ce6a3dbc ce6a3d70 c00d6c24 c00d67d0 c00d5f38 0000001d ce6a3d84 00000000
    [09:37:36][  234.112335] 3d80: 00000000 00800000 00000000 ce6dfa10 ce157bc0 ce157bc0 00000000 ce157bc0
    [09:37:36][  234.120849] 3da0: ce9b9b18 cf010ec0 c00d6e20 ce6dfa10 ce6a3dd4 ce6a3dc0 c00d6e94 c00d6b40
    [09:37:36][  234.129394] 3dc0: c047e610 00000000 ce6a3e04 ce6a3dd8 c00a7ef8 c00d6e2c 00000000 ce122ec0
    [09:37:36][  234.137939] 3de0: 00000000 ce157bc0 ce6a3ed8 ce6dfa10 00000000 00000000 ce6a3e2c ce6a3e08
    [09:37:36][  234.146453] 3e00: c00a8df0 c00a7cec ce122ec0 ce6a3e18 ce6a3ed8 000a0000 00000000 00000024
    [09:37:36][  234.154998] 3e20: ce6a3e74 ce6a3e30 c00b6208 c00a8d94 cf259005 ce6a3e40 ce6a3e74 cf010ec0
    [09:37:36][  234.163513] 3e40: ce801598 ce6dfa10 c00aad70 ce6a3ed8 ce6a3f60 cf259000 ce6a2000 ce6a3e94
    [09:37:36][  234.172058] 3e60: ce6a2000 00000000 ce6a3ecc ce6a3e78 c00b68f4 c00b6150 ce6a3e9c ce158440
    [09:37:36][  234.180603] 3e80: 00000000 cd03d000 ce6a3ecc ce6a3e98 c0095ba4 cf010ec0 ce9b9b18 00000000
    [09:37:36][  234.189117] 3ea0: ce031980 00000001 ce6a3f60 ffffff9c cf259000 ffffff9c ce6a2000 00000000
    [09:37:36][  234.197662] 3ec0: ce6a3f54 ce6a3ed0 c00b6cdc c00b6840 00000041 00000017 cf010ec0 ce9b9b18
    [09:37:36][  234.206176] 3ee0: 0028bcfd 00000003 cf259005 00000000 ce881998 ce6dfa10 00000101 00000004
    [09:37:36][  234.214721] 3f00: 00000000 00000000 0003f5e8 ce09d740 ce09d748 00000000 000a0000 00000005
    [09:37:36][  234.223236] 3f20: ce6a3f54 ce6a3f30 c00c1344 000a0000 00000000 00000000 cf259000 000a0000
    [09:37:36][  234.231781] 3f40: 00000005 00000001 ce6a3f94 ce6a3f58 c00a8ee0 c00b6cb4 ce6a2000 00000000
    [09:37:36][  234.240325] 3f60: 000a0000 00000000 00000024 00000100 00038dd0 be8c3b64 0003f5e8 00000005
    [09:37:36][  234.248840] 3f80: c0014428 00000000 ce6a3fa4 ce6a3f98 c00a8fa0 c00a8e04 00000000 ce6a3fa8
    [09:37:36][  234.257385] 3fa0: c0014280 c00a8f84 00038dd0 be8c3b64 00038dd0 000a0000 00000000 00000000
    [09:37:36][  234.265899] 3fc0: 00038dd0 be8c3b64 0003f5e8 00000005 0003cc30 00031770 00000000 00032008
    [09:37:36][  234.274444] 3fe0: 00000005 be8c3a70 401e6ead 40179276 600f0030 00038dd0 00000000 00000000
    [09:37:36][  234.282958] Backtrace: 
    [09:37:36][  234.285522] [<c0253ac4>] (sd_revalidate_disk+0x0/0x1a60) from [<c00fdd14>] (rescan_partitions+0xa8/0x4c8)
    [09:37:36][  234.295532] [<c00fdc6c>] (rescan_partitions+0x0/0x4c8) from [<c00d6a04>] (__blkdev_get+0x240/0x370)
    [09:37:36][  234.304962] [<c00d67c4>] (__blkdev_get+0x0/0x370) from [<c00d6c24>] (blkdev_get+0xf0/0x2ec)
    [09:37:36][  234.313690] [<c00d6b34>] (blkdev_get+0x0/0x2ec) from [<c00d6e94>] (blkdev_open+0x74/0x80)
    [09:37:36][  234.322235] [<c00d6e20>] (blkdev_open+0x0/0x80) from [<c00a7ef8>] (__dentry_open+0x218/0x2cc)
    [09:37:36][  234.331115]  r4:00000000 r3:c047e610
    [09:37:36][  234.334838] [<c00a7ce0>] (__dentry_open+0x0/0x2cc) from [<c00a8df0>] (nameidata_to_filp+0x68/0x70)
    [09:37:36][  234.344207] [<c00a8d88>] (nameidata_to_filp+0x0/0x70) from [<c00b6208>] (do_last.clone.38+0xc4/0x6b4)
    [09:37:36][  234.353820]  r7:00000024 r6:00000000 r5:000a0000 r4:ce6a3ed8
    [09:37:36][  234.359741] [<c00b6144>] (do_last.clone.38+0x0/0x6b4) from [<c00b68f4>] (path_openat+0xc0/0x398)
    [09:37:36][  234.368927] [<c00b6834>] (path_openat+0x0/0x398) from [<c00b6cdc>] (do_filp_open+0x34/0x88)
    [09:37:36][  234.377624] [<c00b6ca8>] (do_filp_open+0x0/0x88) from [<c00a8ee0>] (do_sys_open+0xe8/0x180)
    [09:37:36][  234.386352]  r7:00000001 r6:00000005 r5:000a0000 r4:cf259000
    [09:37:36][  234.392272] [<c00a8df8>] (do_sys_open+0x0/0x180) from [<c00a8fa0>] (sys_open+0x28/0x2c)
    [09:37:36][  234.400634] [<c00a8f78>] (sys_open+0x0/0x2c) from [<c0014280>] (ret_fast_syscall+0x0/0x30)
    [09:37:36][  234.409240] Code: e24cb004 e24dd05c e59041e8 e50b0048 (e5949004) 
    [09:37:36][  234.415740] omap2_mcspi_txrx_pio, word_len:8
    [09:37:36][  234.420196] 1
    [09:37:36][  234.421844] 2
    [09:37:36][  234.423675] 8
    [09:37:36][  234.425292] 11
    [09:37:36][  234.427032] 12
    [09:37:36][  234.428863] ---[ end trace cd24593098d317fb ]---
    [09:37:36][  234.433685] omap2_mcspi_txrx_pio, word_len:8
    [09:37:36][  234.438140] 1
    [09:37:36][  234.439788] 2
    [09:37:36][  234.441619] 8
    [09:37:36][  234.443267] 11
    [09:37:36][  234.444976] 12
    [09:37:36][  234.446777] omap2_mcspi_txrx_pio, word_len:8
    [09:37:36][  234.451232] 1
    [09:37:36][  234.452850] 2
    [09:37:36][  234.454681] 8
    [09:37:36][  234.456329] 11
    [09:37:36][  234.458068] 12
    [09:37:36][  234.460784] omap2_mcspi_txrx_pio, word_len:8
    [09:37:36][  234.465270] 1
    [09:37:36][  234.466918] 2
    [09:37:36][  234.468750] 8
    [09:37:36][  234.470397] 11
    [09:37:36][  234.472137] 12
    [09:37:36][  234.474792] omap2_mcspi_txrx_pio, word_len:8

    Hi Bin Liu,
    今天早上我们又重新复现了一次,在打印过程中,也就是调用这个DMTimer_1ms定时器时,插入U盘,查看到了内核崩溃的日志。以下是出现异常时udevd时的进程号,与正常的设备对比,发现进程号变大了,说明这个进程重启过。

    This morning we reproduced this problem again. During the printing process, that is, when calling the timer of DMTimer_1ms, insert the U disk and check the kernel crash log.The following is the process number of udevd when an exception occurs. Compared with the normal device, it is found that the process number has become larger, indicating that the process has been restarted.

    root@am335x-evm:~# ps|grep udevd
      941 root      2496 S    /lib/udev/udevd -d
     3642 root      2492 S    /lib/udev/udevd -d
     3714 root      2492 S    /lib/udev/udevd -d

    正常的设备如下,udevd的进程号最大为1462:

    The normal equipment is as follows, the maximum process number of udevd is 1462:

    root@am335x-evm:~# ps|grep udevd
      945 root      2808 S    /lib/udev/udevd -d
     1343 root      3016 S    /lib/udev/udevd -d
     1462 root      2804 S    /lib/udev/udevd -d




  • Hi Qingyong,

    If you don't add/enable your kernel printer driver, do you have any issue in USB usage or anything abnormal in kernel?

  • Hi Bin Liu,
    我只能通过不做打印动作,这样就不去调用我的打印驱动,在不做打印时,我不停测试U盘的插拔,至少100次,问题没有出现。没有看到上面回复中出现的内核崩溃日志。
    I can only do so by not printing, so that I don’t call my printer driver. When I am not printing, I keep testing the plugging and unplugging of the U disk for at least 100 times. The problem does not appear.Did not see the kernel crash log in the above reply.

  • Hi Qingyong,

    I sounds to me your kernel printer driver causes the issue. But you would have to debug it by yourself, since TI doesn't support custom code, also kernel v3.2 is obsolete and no longer supported.