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.

AM3517 loss of packets in reception on the bus CAN

Other Parts Discussed in Thread: AM3517

Overall software load of AM3517 module is about 35%-50% (Linux top command result). The module receives CAN packets at 1 Mbit/s. CAN bus load is about 15%. In this situation linux operating system not loses CAN packets. When loading of the bus CAN exceeds 15% the Linux operating system starts losing packets (in case of bus CAN loading about 80% of loss of packets make 0.03% for 1000000 packets). What is the reason of the packet loss? How can i solve this problem to make sure packets won't lose in future even at 80% CAN bus loading?

  • Hi Sergei,

    As far as I know the CAN HECC driver is tested at all the bit rate mentioned in the documentation:
    http://processors.wiki.ti.com/index.php/AM35x-OMAP35x-PSP_04.02.00.07_Feature_Performance_Guide#CAN.28HECC.29_Driver
    The drivers is tested in stand alone (ie without any other SW running on the Linux side).

    It is likely that what you are seeing is related to the fact that Linux is not an RTOS. Some higher priority Linux kernel services might pre-empt the CAN driver and prevent it to meet the realt time deadlines.
    You will need to investigate further on how you could find tune the SW in order to prevent this (for example to use the RT features of the Linux kernel (ie RT-patch)).


    Some different HECC related links and E2E posts:
    http://e2e.ti.com/support/embedded/linux/f/354/t/172346.aspx?pi196120=2
    http://e2e.ti.com/support/arm/sitara_arm/f/791/t/89345.aspx

    http://processors.wiki.ti.com/index.php/AM35x_High-End_CAN_Controller_%28HECC%29
    http://processors.wiki.ti.com/index.php/AM35x-OMAP35x-PSP_04.02.00.07_UserGuide#TI_HECC_CAN_Controller

    Hope it helps.

    Anthony

  • During the packets loss there are periodically repeating messages in kernel ring buffer:
    omap_device: omap_i2c.1: new worst case activate latency 0: 183105 or
    omap_device: omap_i2c.1: new worst case deactivate latency 0: 518798
    If there are no such messages in kernel ring buffer then linux doesn't lose the packets. What is the reason of mesgaes in kernel ring buffer? How can these messages be connected to packets loss?

  • I am not sure what it has to do with CAN in this case specifically but as far as I understand those message are related to the power management features.
    Some general information at:
    http://lists.infradead.org/pipermail/linux-arm-kernel/2010-January/007713.html

    A.

  • In each transmission of 1000000 packets. During the packets loss there are periodically repeating messages in kernel ring buffer (activate/deactivate). If there are no such messages in kernel ring buffer then linux doesn't lose the packets. How can these messages be connected to packets loss?

    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# [   28.936187] omap_device: omap_i2c.1: new worst case activate latency 0: 1403808
    [   67.201385] omap_device: omap_i2c.1: new worst case deactivate latency 0: 579833
    ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:999921 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:7999368 (7.6 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# [  775.389862] omap_device: omap_i2c.1: new worst case deactivate latency 0: 1159667
    [  776.851379] omap_device: omap_i2c.1: new worst case activate latency 0: 2685546
    ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:1999845 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:15998760 (15.2 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
     root@am3517-evm:~# [ 939.249969] omap_device: omap_i2c.1: new worst case activate latency 0: 2807617
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:2999810 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:23998480 (22.8 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:3999810 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:31998480 (30.5 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~#
  • If you make some search on the src code you will fond out that the fct the print this messages are  _omap_device_activate and _omap_device_deactivate from arch/arm/plat-omap/omap_device.c.

    Seems to be called from I2c driver context in this case. You will need to investigate when this code is called and why it would prevent the CAN driver to capture packets.

    A.

  • In the omap_device.c file from the _omap_device_activate and _omap_device_deactivate functions I deleted lines:

    148    pr_warning("omap_device: %s.%d: new worst case "
    149        "activate latency %d: %llu\n",
    150        od->pdev.name, od->pdev.id,
    151        od->pm_lat_level, act_lat);

    and

    216    pr_warning("omap_device: %s.%d: new worst case "
    217        "deactivate latency %d: %llu\n",
    218        od->pdev.name, od->pdev.id,
    219        od->pm_lat_level, deact_lat);

    accordingly. Then loss of packets on the bus CAN isn't watched.

  • root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:1000000 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:8000000 (7.6 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:2000000 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:16000000 (15.2 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:3000000 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:24000000 (22.8 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:4000000 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:32000000 (30.5 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~# ifconfig
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              UP RUNNING NOARP  MTU:16  Metric:1
              RX packets:5000000 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:40000000 (38.1 MiB)  TX bytes:0 (0.0 B)
              Interrupt:24 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    root@am3517-evm:~#