1/1

|
CAN protocol controller
by Unknown on Jul 5, 2005 |
Not available! | ||
|
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*/// |
|||
1/1

