FAQ: [#6501] SocketCAN driver generates incorrect ERRORFRAME before each valid frame received(2011)

Document created by Aaronwu Employee on Sep 11, 2013
Version 1Show Document
  • View in full screen mode

[#6501] SocketCAN driver generates incorrect ERRORFRAME before each valid frame received

Submitted By: Jay Ku

Open Date

2011-03-02 18:27:22    

Priority:

Medium     Assignee:

steven miao

Status:

Open     Fixed In Release:

N/A

Found In Release:

2010R1-RC5     Release:

2010R1-RC5

Category:

Drivers     Board:

STAMP

Processor:

BF537     Silicon Revision:

0.2

Is this bug repeatable?:

Yes     Resolution:

Rejected

Uboot version or rev.:

2010.06     Toolchain version or rev.:

2010.04

App binary format:

N/A     

Summary: SocketCAN driver generates incorrect ERRORFRAME before each valid frame received

Details:

 

The SocketCAN driver is generating an ERRORFRAME before each valid frame received.  These ERRORFRAMES are not actually on the CAN bus... they are being incorrectly generated by the driver.  For example, if I run candump can0 -m 0 -e 0xffffffff on my host and generate a single 4-byte frame sent to SID 0, I see:

 

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0    0  [4] 00 01 02 03

 

The ERRORFRAME always seems to be the same (regardless of the data received).

 

See https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&_forum_action=ForumMessageBrowse&thread_id=44654 for more.

 

 

Follow-ups

 

--- steven miao                                              2011-03-21 23:31:41

I tested the socketcan with 2 bf537-stamp board, ran cangen on one board and

candump on the other board, but didn't see the error frame messages.

 

Linux version 2.6.34.7-ADI-2010R1-svn9517

 

root:/> ip link set can0 type can bitrate 500000

bfin_can bfin_can.0: setting CLOCK=0x0031 TIMING=0x0002

root:/> ifconfig can0 up 

 

 

root:/> candump can0 -m 0 -e 0xffffffff

  can0  567  [6] 69 98 3C 64 73 48

  can0  451  [8] 4A 94 E8 2A EC 58 55 62

  can0  729  [8] BA 58 1B 3D AB D7 7E 50

  can0  1F2  [8] E3 A9 E2 79 46 E1 45 75

  can0   7C  [2] 54 08

  can0  31B  [8] E7 CD 90 11 8D 43 EF 66

  can0  776  [8] 2E F9 9C 10 63 72 ED 0D

  can0  233  [8] C9 C4 A7 41 9A 07 68 6B

  can0  366  [2] 0D 50

  can0  231  [8] A3 30 71 25 5A D9 BB 62

  can0  125  [8] 05 B1 3A 33 17 A3 1D 72

  can0   58  [8] 5E 84 63 67 D4 A8 A2 75

  can0  5AB  [2] CD D0

  can0  69B  [4] 54 24 F3 71

  can0  40E  [2] 74 F8

  can0  521  [8] DC 8D 7B 73 87 F0 EA 6C

  can0  270  [8] 3E C8 06 30 A1 D4 4F 61

  can0  241  [1] FC

  can0  23E  [1] 7E

  can0  1EA  [8] 6B D3 EA 51 96 77 51 2D

  can0  78F  [8] 5C 58 55 38 2A 4E A6 70

  can0  2EC  [0]

  can0  232  [8] 3C 8D 6D 7A 54 8F 58 4B

  can0  1EC  [8] DB 7F 43 38 5C A4 44 76

  can0  102  [8] FE 78 94 57 43 BB 9A 74

  can0   FB  [8] AA DE A1 79 3A C3 C6 75

  can0  5FB  [8] D1 ED 0E 52 E6 3F 4A 37

  can0    5  [8] 7C B7 9B 64 94 C7 5A 27

  can0  575  [8] BE 15 01 18 61 A8 5B 23

  can0  489  [8] 5C AF B5 15 BB 26 12 74

  can0  6A8  [8] 0F B6 6A 3F 95 40 57 61

  can0  7B1  [8] F1 E4 9B 57 B3 50 0C 31

  can0  605  [8] F7 0B A7 25 00 BF BA 1D

  can0  4E9  [1] 3A

  can0  7CA  [8] CB 4A 01 15 D0 7F 5E 5F

  can0  148  [7] 64 47 B9 06 BD 96 C2

  can0  21F  [3] 1E 3F 1E

  can0  71C  [8] 64 C5 D9 51 C5 FD 3E 61

  can0  314  [3] 5A 3E 96

  can0  15E  [8] 79 D3 0F 3B 63 2F EB 68

  can0  13B  [0]

  can0  211  [8] 09 11 EA 71 DC 59 0F 10

  can0   AA  [4] AC D9 6D 6F

  can0  61B  [0]

  can0  633  [8] E3 0E DE 74 50 C5 EB 68

  can0  648  [7] 15 C3 2A 4A 5C 01 EE

  can0  7BB  [8] 22 84 F1 43 19 01 EF 60

  can0  4BA  [8] 7D 30 DA 49 F5 A5 55 70

  can0  70B  [1] 1A

  can0  77F  [3] F8 5A C7

 

--- Jay  Ku                                                  2011-04-01 16:14:26

No idea what what you're doing differently.

 

I tried to test with the latest version from

http://blackfin.uclinux.org/gf/project/uclinux-dist/frs/

(http://blackfin.uclinux.org/gf/download/frsrelease/509/8618/uImage-bf537-stamp-2010R1-RC5),

but this was built without ip and when I copied the ip utility I'm using on my

board and try to configure the port I get:

 

root:/> modprobe bfin-can

CAN device driver interface

bfin_can bfin_can.0: bfin_can device registered(&reg_base=ffc02a00,

rx_irq=22, tx_irq=23, err_irq=43, sclk=125000000)

root:/> ./ip link set can0 type can bitrate 500000

bfin_can bfin_can.0: bit-timing calculation not available

RTNETLINK answers: Invalid argument

 

Don't know what this is about, so I built an image for the BF537 board using

blackfin-linux-dist-2010R1-RC5.tar.  I built the CAN module in as a module,

loaded onto my board and I get the ERRORFRAMES as shown below (this is from my

BF537-STAMP v2.1 board loaded with the attached uImage).

 

I've attached the .config I built with and the actual uImage to this post.

 

 

---------- transcript follows ------------------------------------

 

U-Boot 2010.06 (ADI-2010R1-RC2) (Oct 20 2010 - 04:40:06)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (bypass boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MiB

Flash: 4 MiB

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Net:   bfin_mac

Hit any key to stop autoboot:  0

bfin> tftp 1000000 uImage

Using bfin_mac device

TFTP from server 192.168.1.4; our IP address is 192.168.1.222

Filename 'uImage'.

Load address: 0x1000000

Loading: T #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         ##############

done

Bytes transferred = 5396060 (52565c hex)

bfin> bootm 1000000

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   bf537-2.6.34.7-ADI-2010R1

   Created:      2011-03-02  22:36:49 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    5395996 Bytes = 5.1 MiB

   Load Address: 00001000

   Entry Point:  001ab684

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001ab684

Linux version 2.6.34.7-ADI-2010R1 (jayk@jayk-desktop) (gcc version 4.3.5

(ADI-2010R1-RC4) ) #4 Wed Mar 2 14:36:44 PST 2011

register early platform devices

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Limiting kernel memory to 56MB due to anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x0011b938

  rodata    = 0x0011b938-0x0017a5e8

  bss       = 0x0017b000-0x0018d5a8

  data      = 0x0018d5a8-0x001a0000

    stack   = 0x0019e000-0x001a0000

  init      = 0x001a0000-0x00a04000

  available = 0x00a04000-0x03800000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Reset caused by Software reset

Blackfin support (C) 2004-2010 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 125 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

  External memory: cacheable in instruction cache

Data Cache Enabled for CPU0

  External memory: cacheable (write-back) in data cache

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 14224

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000

earlyprintk=serial,uart0,57600 console=ttyBF0,57600

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 46520k/65536k RAM, (8592k init code, 1130k kernel code, 530k

data, 1024k dma, 7740k reserved)

Hierarchical RCU implementation.

NR_IRQS:138

Configuring Blackfin Priority Driven Interrupts

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (35 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

bio: create slab <bio-0> at 0

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0,

regs_base@ffc00500, dma channel@7

Switching to clocksource bfin_cs_cycles

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

msgmni has been set to 90

io scheduler noop registered

io scheduler cfq registered (default)

bfin-uart: Blackfin serial driver

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

brd: module loaded

CAN device driver interface

bfin_can bfin_can.0: bfin_can device registered(&reg_base=ffc02a00,

rx_irq=22, tx_irq=23, err_irq=43, sclk=125000000)

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1,

mdc_clk=2500000Hz(mdc_div=24)@sclk=125MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

can: controller area network core (rev 20090105 abi 8)

NET: Registered protocol family 29

can: raw protocol (rev 20090105)

can: broadcast manager protocol (rev 20090105 t)

rtc-bfin rtc-bfin: setting system clock to 1970-01-01 00:26:07 UTC (1567)

dma_alloc_init: dma_page @ 0x02958000 - 256 pages at 0x03f00000

Freeing unused kernel memory: 8592k freed

                           _____________________________________

        a8888b.           / Welcome to the uClinux distribution \

       d888888b.         /       _     _                         \

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |

       8'    .88       \        | |   | |  _ \| | | | \  /        |

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |

     dP   .    Y8b.       \   For embedded processors including   |

    d8:'  "  `::88b        \  à the Analog Devices Blackfin      /

   d8"         'Y88b        \___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

._/"Yaa_:   .| 88P|            - http://blackfin.uclinux.org/

\    YP"    `| 8P  `.          - http://docs.blackfin.uclinux.org/

/     \.___.d|    .'           - http://www.uclinux.org/

`--..__)8888P`._.'  jgs/a:f    - http://www.analog.com/blackfin

 

Have a lot of fun...

 

 

BusyBox v1.16.2 (2011-03-02 14:06:07 PST) hush - the humble shell

 

root:/> ip link set can0 type can bitrate 500000

bfin_can bfin_can.0: setting CLOCK=0x0031 TIMING=0x0002

root:/> ifconfig can0 up

root:/> candump can0 -e 0xffffffff

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

  can0  20000004  [8] 00 01 00 00 00 00 00 00   ERRORFRAME

  can0   60  [6] 00 00 00 00 00 00

 

--- steven miao                                              2011-04-22 04:19:02

Here is the log test with your attached uImage.

If there's no packets received, candump was just block and no error messages.

You should check your hardware, it seems some noisy packet is received from the

line.

 

Load address: 0x1000000

Loading: #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     ###########################################

done

Bytes transferred = 5396060 (52565c hex)

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   bf537-2.6.34.7-ADI-2010R1

   Created:      2011-03-02  22:36:49 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    5395996 Bytes =  5.1 MB

   Load Address: 00001000

   Entry Point:  001ab684

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001ab684

Linux version 2.6.34.7-ADI-2010R1 (jayk@jayk-desktop) (gcc version 4.3.5

(ADI-2010R1-RC4) ) #4 Wed Mar 2 14:36:44 PST 2011

register early platform devices

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Limiting kernel memory to 56MB due to anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x0011b938

  rodata    = 0x0011b938-0x0017a5e8

  bss       = 0x0017b000-0x0018d5a8

  data      = 0x0018d5a8-0x001a0000

    stack   = 0x0019e000-0x001a0000

  init      = 0x001a0000-0x00a04000

  available = 0x00a04000-0x03800000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Blackfin support (C) 2004-2010 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 125 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

  External memory: cacheable in instruction cache

Data Cache Enabled for CPU0

  External memory: cacheable (write-back) in data cache

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 14224

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000

earlyprintk=serial,uart0,57600 console=ttyBF0,57600

ip=10.99.29.105:10.99.29.111:192.168.0.1:255.255.255.0:bf537-stamp:eth0:off

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 46520k/65536k RAM, (8592k init code, 1130k kernel code, 530k

data, 1024k dma, 7740k reserved)

Hierarchical RCU implementation.

NR_IRQS:138

Configuring Blackfin Priority Driven Interrupts

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (35 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

bio: create slab <bio-0> at 0

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0,

regs_base@ffc00500, dma channel@7

Switching to clocksource bfin_cs_cycles

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

msgmni has been set to 90

io scheduler noop registered

io scheduler cfq registered (default)

bfin-uart: Blackfin serial driver

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

brd: module loaded

CAN device driver interface

bfin_can bfin_can.0: bfin_can device registered(&reg_base=ffc02a00,

rx_irq=22, tx_irq=23, err_irq=43, sclk=125000000)

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1,

mdc_clk=2500000Hz(mdc_div=24)@sclk=125MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

can: controller area network core (rev 20090105 abi 8)

NET: Registered protocol family 29

can: raw protocol (rev 20090105)

can: broadcast manager protocol (rev 20090105 t)

IP-Config: Gateway not on directly connected network.19:18:15 UTC (933495)

dma_alloc_init: dma_page @ 0x0297a000 - 256 pages at 0x03f00000

Freeing unused kernel memory: 8592k freed

                           _____________________________________

        a8888b.           / Welcome to the uClinux distribution \

       d888888b.         /       _     _                         \

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |

       8'    .88       \        | |   | |  _ \| | | | \  /        |

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |

     dP   .    Y8b.       \   For embedded processors including   |

    d8:'  "  `::88b        \    the Analog Devices Blackfin      /

   d8"         'Y88b        \___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

._/"Yaa_:   .| 88P|            - http://blackfin.uclinux.org/

\    YP"    `| 8P  `.          - http://docs.blackfin.uclinux.org/

/     \.___.d|    .'           - http://www.uclinux.org/

`--..__)8888P`._.'  jgs/a:f    - http://www.analog.com/blackfin

 

Have a lot of fun...

 

 

BusyBox v1.16.2 (2011-03-02 14:06:07 PST) hush - the humble shell

 

root:/> PHY: 0:01 - Link is Up - 100/Full

 

root:/> ip link set can0 type can bitrate 500000

bfin_can bfin_can.0: setting CLOCK=0x0031 TIMING=0x0002

root:/>

root:/> modprobe bfin-can

modprobe: module bfin-can not found in modules.dep

root:/> ifconfig can0 up

root:/> candump can0 -e 0xffffffff

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

uImage    application/octet-stream    5396060    Jay Ku

config    application/octet-stream    37580    Jay Ku

Attachments

Outcomes