Latest Post
Mango-AM335x CAN 통신 테스트 (첨부 참조)

CAN Transceiver가 필요하다망고 보드에는 CX-CAN Transcevier 모듈이 있다.

 

http://www.ti.com/lit/ds/symlink/am3351.pdf 에 PIN function

가능한 GPIO PIN Name 확인 결과

PIN Name

DCAN0_RX

DCAN0_TX

DCAN1_RX

DCAN1_TX

가능 여부

UART0_RXD

O

NG(Debug)

UART0_TXD

O

NG(Debug)

UART0_CTSn

O

NG(I2C1 과 충돌

UART0_RTSn

O

NG( I2C1 과 충돌

UART1_RXD

O

OK

UART1_TXD

O

OK

UART1_CTSn

O

OK

UART1_RTSn

O

OK

MMC0_CLK

O

NG(Micro SD )

MMC0_CMD

O

NG(Micro SD )

MII1_TXD3

O

NG(이더넷)

MII1_TXD2

O

NG(이더넷)

 

Mango-AM335x CAN Pin MAP은 아래와 같다.



 

망고AM335x 보드 2대를 이용하여 연결 한다.

 

 

 

1.    Kernel 3.2 수정 사항

 

static struct pinmux_config d_can_0_pin_mux[] = {

        {"uart1_ctsn.d_can0_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},

        {"uart1_rtsn.d_can0_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},

        {NULL, 0},

};

 

static struct pinmux_config d_can_1_pin_mux[] = {

        {"uart1_rxd.d_can1_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},

        {"uart1_txd.d_can1_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},

        {NULL, 0},

};

 

static void d_can_init(int evm_id, int profile)

{

        printk("CRZ can init\n");

        setup_pin_mux(d_can_0_pin_mux);

        /* Instance zero */

        am33xx_d_can_init(0);

        setup_pin_mux(d_can_1_pin_mux);

        /* Instance one */

        am33xx_d_can_init(1);

}

 

 

static struct evm_dev_cfg evm_sk_dev_cfg[] = {

        {mmc0_init,     DEV_ON_BASEBOARD, PROFILE_ALL},

//      {uart1_init,            DEV_ON_BASEBOARD, PROFILE_ALL},//CRZ_icanjji crazyboys 20170411

 

        {d_can_init, DEV_ON_BASEBOARD, PROFILE_ALL },//CRZ_icanjji crazyboys 201704011

 

관련 파일을 아래와 같다.

S.No

Location

Description

1

drivers/net/can/d_can/d_can.c

DCAN driver core file

2

drivers/net/can/d_can/d_can_platform.c

Platform DCAN bus driver

3

arch/arm/mach-omap2/board-am335xevm.c

DCAN board specific data addition

4

arch/arm/mach-omap2/devices.c

DCAN soc specific data addition

 

1.1.    CAN1 테스트

 

buildroot에서 route2, can, canutil 설정해야 한다.

 

BR2_PACKAGE_IPROUTE2=y

BR2_PACKAGE_SOCKETCAND=y

BR2_PACKAGE_CAN_UTILS=y

 

$cd buildroot-2013.11

$./build_rootFS.sh

$ ls output/images/

rootfs.tar.gz => 파일 시스템을 사용한다.

 

커널 컴파일 후 이미지를 보드에 Write를 한다

보드는 아래와 같이 연결한다.




테스트는 2대 모두 아래와 같이 명령을 입력한다.  

ip link set can1 type can bitrate 50000 triple-sampling on

 

ip link set can1 down

ip link set can1 up

candump can1 &

 

 

다른 1대에서 아래와 같이 send 명령을 수행한다.

 

cansend can1 500#1E.10.10

 

테스트 결과 로그는  아래와 같다.

[root@localhost ~]# ip link set can1 type can bitrate 50000 triple-sampling on

ip link set can1 down

[root@localhost ~]#

[root@localhost ~]# ip link set can1 down

[root@localhost ~]# ip link set can1 up

[   24.988433] d_can d_can.1: can1: setting CAN BT = 0x1c1d

[root@localhost ~]# candump can1 &

[1] 887

[root@localhost ~]#   can1  500   [3]  1E 10 10

cansend can1 500#1E.10.10

[root@localhost ~]#   can1  500   [3]  1E 10 10

 

# cat /proc/net/can/stats

 

        1 transmitted frames (TXF)

        2 received frames (RXF)

        2 matched frames (RXMF)

 

      100 % total match ratio (RXMR)

        0 frames/s total tx rate (TXR)

        0 frames/s total rx rate (RXR)

 

      100 % current match ratio (CRXMR)

        0 frames/s current tx rate (CTXR)

        0 frames/s current rx rate (CRXR)

 

      100 % max match ratio (MRXMR)

        1 frames/s max tx rate (MTXR)

        1 frames/s max rx rate (MRXR)

 

        1 current receive list entries (CRCV)

        1 maximum receive list entries (MRCV)

 

 

관련 링크는 http://processors.wiki.ti.com/index.php/AM335X_DCAN_Driver_Guide

참조해서 configuration 하면 된다.

 

Comments 0
:    :    :
이름 / 2014-11-20 / ★★★☆☆ [수정 / 삭제]

내용

New Products +more
Mango-AM62x Main Board
Mango-AM62x 보드 시리즈