UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer jirhus
Observer
3,419 Views
Registered: ‎06-19-2013

CAN controller does't work in NORMAL MODE

Jump to solution

Hi,

I'm trying send and receive CAN frames on ZC702. When I use demo Peripherals Test, CAN is in LOOPBACK mode and it works. But I want to comunicate with external CAN controller (CAN J52 header). What shall I change in code?

 

In this topic http://forums.xilinx.com/t5/Xilinx-Boards-and-Kits/CAN-controller-issue-on-ZC702/td-p/276886 is similar problem, but I don't know, how to set MIO9 pin low.

 

Thanks

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer jirhus
Observer
4,352 Views
Registered: ‎06-19-2013

Re: CAN controller does't work in NORMAL MODE

Jump to solution

I've solved my problem.

1. In function  CanPsPolledExample() change 2 lines to NORMAL MODE:

XCanPs_EnterMode(CanInstPtr, XCANPS_MODE_NORMAL);
while(XCanPs_GetMode(CanInstPtr) != XCANPS_MODE_NORMAL);

 

2. turn off stand by mode on TI CAN controller (pin MIO9, LOC=C4)

//declaration variables:

static XGpioPs PsIO; // MIO and EMIO
XGpioPs_Config* PsIO_ConfigPtr;

 

//inicialization:
PsIO_ConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
     if(PsIO_ConfigPtr == NULL){
        print(" PS GPIO INIT FAILED \n\r");
        return XST_FAILURE;
}
int xStatus;
 xStatus = XGpioPs_CfgInitialize(&PsIO,
 PsIO_ConfigPtr,
 PsIO_ConfigPtr->BaseAddr);
  if(XST_SUCCESS != xStatus){
        print(" PS GPIO INIT FAILED \n\r");
  }

 

//set MIO9 low:

XGpioPs_SetDirectionPin(&PsIO, 9, 1);
XGpioPs_SetOutputEnablePin(&PsIO, 9, 1);
XGpioPs_WritePin(&PsIO, 9, 0);

 

Then CAN works with external device.

3 Replies
Highlighted
Observer jirhus
Observer
4,353 Views
Registered: ‎06-19-2013

Re: CAN controller does't work in NORMAL MODE

Jump to solution

I've solved my problem.

1. In function  CanPsPolledExample() change 2 lines to NORMAL MODE:

XCanPs_EnterMode(CanInstPtr, XCANPS_MODE_NORMAL);
while(XCanPs_GetMode(CanInstPtr) != XCANPS_MODE_NORMAL);

 

2. turn off stand by mode on TI CAN controller (pin MIO9, LOC=C4)

//declaration variables:

static XGpioPs PsIO; // MIO and EMIO
XGpioPs_Config* PsIO_ConfigPtr;

 

//inicialization:
PsIO_ConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
     if(PsIO_ConfigPtr == NULL){
        print(" PS GPIO INIT FAILED \n\r");
        return XST_FAILURE;
}
int xStatus;
 xStatus = XGpioPs_CfgInitialize(&PsIO,
 PsIO_ConfigPtr,
 PsIO_ConfigPtr->BaseAddr);
  if(XST_SUCCESS != xStatus){
        print(" PS GPIO INIT FAILED \n\r");
  }

 

//set MIO9 low:

XGpioPs_SetDirectionPin(&PsIO, 9, 1);
XGpioPs_SetOutputEnablePin(&PsIO, 9, 1);
XGpioPs_WritePin(&PsIO, 9, 0);

 

Then CAN works with external device.

Newbie ayobi
Newbie
3,109 Views
Registered: ‎01-22-2014

Re: CAN controller does't work in NORMAL MODE

Jump to solution

would you kindly send your complete c file. I'm looking for this solution for quite some time. thanks very much in advance

0 Kudos
Newbie ayobi
Newbie
3,092 Views
Registered: ‎01-22-2014

Re: CAN controller does't work in NORMAL MODE

Jump to solution

it works now,

 

just need to include the gpio header files in the program

0 Kudos