cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
3,532 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
Observer
4,465 Views
Registered: ‎06-19-2013

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.

View solution in original post

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

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.

View solution in original post

Highlighted
Newbie
Newbie
3,222 Views
Registered: ‎01-22-2014

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
Highlighted
Newbie
Newbie
3,205 Views
Registered: ‎01-22-2014

it works now,

 

just need to include the gpio header files in the program

0 Kudos