LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Sponsors
  • Mirrors
  • Logos
  • Contact us
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cores > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: jmakias at sun3.oulu.fi<jmakias@s...>
    Date: Tue Jul 5 09:52:55 CEST 2005
    Subject: [oc] CAN protocol controller
    Top
    I am using CAN protocol controller and it is connected via Avalon Bus to
    the Nios II processor. The problem is that every time I try to give
    Transmission Request CAN controller goes to the reset mode and
    transmits nothing. What could be the reason for that?

    The code I used is below:

    ////*Configuration and Initialization *////

    /*Controller to reset-mode, register 0*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,0 ,0x21 );
    usleep(1);

    usleep(1);
    /*Initialize clock divider, register 31*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,124 ,0x8 );

    usleep(1);
    /*Acceptance code, register 4*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,16 ,0xFF );

    usleep(1);
    /*Acceptance mask, register 5*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,20 ,0xFF );

    usleep(1);
    /*Bus timing 0, register 6 */
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,24 ,0x0 );

    /*Bus timing 1, register 7 */
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,28 ,0x53 ); //0x27


    usleep(1);
    /*Operation mode, register 0*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,0,0x20);
    usleep(2000000);

    ////*End of initialization *////

    ///*The code for packet transmission*///

    /*identifier 1, register 10*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,40,0xFF);

    /*identifier 2 (DLC=8), register 11*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,44,0x28);

    /* data to databuffer 1, register 12*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,48,0x58);

    /*transmission request, register 1*/
    IOWR_8DIRECT(CAN_CONTROLLER_BASE,4,0x01);
    usleep(1000000);

    ///*End of the code for packet transmission*///




     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.