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: 
Visitor sarsenbayev
Visitor
10,839 Views
Registered: ‎11-28-2012

CAN controller issue on ZC702

Jump to solution

Hello All,

 

    I'm using ZC702 (XC7Z020-1CLG484C ) evaluation board    and working on a project with  CAN controller of ZYNQ but it  doesn't work. It is not impossible that probably I’ve  done something wrong when I was  testing  the hardware but the point is, that I used     “xcanps_polled_example.c” (canps v1_01_a), then “xcan_polled_example.c” (Example Applications for the driver can_v2_00_a – to check  CAN bus communication -   both drivers have failed (no signs of life on the bus)  - when I tried  to  change  the  mode instead  XCAN_MODE_LOOPBACK  to XCAN_MODE_NORMAL  in  XCan_EnterMode function.   It seems to be  that ZYNQ CAN controller either on  inactive mode  or improperly programmed coz as I checked the TXS104E - TJA1040 chain works good.  I have double checked  the MIO_PIN_46(slcr) MIO_PIN_47(slcr), CAN_CLK_CTRL(slcr)  register’s values  in BSP files during initialization ,  ZC702 schematics, pin assignment  in   Xilinx  Platform Studio  everything is OK. . Maybe  drivers’ examples  work only in  loopback mode?  I have  been looking  for the  info  concerning  of this issue  in Xilinxs'  docs,  forums - everywhere but nothing. Has anybody expirience with this issue? Ideas? Thanks in advance.  Any info would be helpful.

 

Regards.

 

0 Kudos
1 Solution

Accepted Solutions
Visitor sarsenbayev
Visitor
13,917 Views
Registered: ‎11-28-2012

Re: CAN controller issue on ZC702

Jump to solution

Hi All,

I've resolved the issue. The point is than TJA1040 CAN transceiver was in StandBy mode and to switch over to NORMAL mode  STB pin need to  be set  in LOW level. To do that  I  set  LOW level  of  pin the   PS_MIO9  which connected STB pin to. 

 

10 Replies
Scholar norman_wong
Scholar
10,829 Views
Registered: ‎05-28-2012

Re: CAN controller issue on ZC702

Jump to solution

Not sure if I can help. I did port the can_v2_00_a code tp u-boot and I could successfully run the selftest code. The selftest is an internal loopback. For external loopback, I used the polled code as a base. The HW does appear to work.

 

0 Kudos
Visitor sarsenbayev
Visitor
10,824 Views
Registered: ‎11-28-2012

Re: CAN controller issue on ZC702

Jump to solution

Thanks for reply! But how did you check it. if  You  meant  the same LOOPBACK MODE  by saying external loopback  -everything is ok.       I've got no signal on the bus when in NORMAL MODE. I used for testing another CAN controller which properly  works.SW on ZC702  just sends CAN frames every 1 sec to other controller. To check internal status of the ZC702 CAN controller    XCan_GetBusErrorStatus   function     invoked   and it returns  "bit error". Normaly if even ZC702 can't  see other CAN controller-  the above mentioned function  would return - ACK error. I began  thinking that something wrong with with ZC702  HW  but to check fully I haven't got diagnostic  tools  on hand.

0 Kudos
Scholar norman_wong
Scholar
10,820 Views
Registered: ‎05-28-2012

Re: CAN controller issue on ZC702

Jump to solution

It's been a a few months since I worked with the ZC702 board. Misremembered. I think I based my external loopback code on internal loopback code in xcan_selftest.c. I parameterized the code to send out on specified one port instance and receive on another specified port instance. The internal loopback first setup the XCAN_MODE_LOOPBACK on one port and used that port for both send and receive. The external loopback used XCAN_MODE_NORMAL on two ports and used one port for send and the other for receive. Then reversed the send and receive ports. I cross wired the two ports together. Messages were getting across from one port to the port. Pulling wires resulted in a fail.

 

For me, I needed to just verify the connectivity of the CANBus pins. Perhaps. the SW stack is not good enough to talk to "real" CANBus devices. I vaguely remember a CANBus network requires some pretty exacting timing considerations.

Visitor sarsenbayev
Visitor
10,805 Views
Registered: ‎11-28-2012

Re: CAN controller issue on ZC702

Jump to solution

Anyway thanks Norman. Are there Xilinx guys who can comment this issue?

0 Kudos
Visitor sarsenbayev
Visitor
13,918 Views
Registered: ‎11-28-2012

Re: CAN controller issue on ZC702

Jump to solution

Hi All,

I've resolved the issue. The point is than TJA1040 CAN transceiver was in StandBy mode and to switch over to NORMAL mode  STB pin need to  be set  in LOW level. To do that  I  set  LOW level  of  pin the   PS_MIO9  which connected STB pin to. 

 

Visitor alarrucea
Visitor
10,508 Views
Registered: ‎01-18-2011

Re: CAN controller issue on ZC702

Jump to solution

Hey,

 

I have the same CAN BUS usage issue. I am using the Zynq board CAN bus interface and it can't send/receive frames from/to outside. I used the polling example with a modification (change from Loopbakc mode to Normal Mode) and also I changed the the baudrate configuration.

 

In the XPS Zynq PS Configuration -> CAN0->MIO CLK is necessary assign the MIO9 IO pin to MIO CLK??

 

Someone has used successfully the Zynq board CAN interface to send and receive frames from/to external device??

 

Thanks.

 

 

0 Kudos
Visitor keiraduffy
Visitor
10,399 Views
Registered: ‎06-04-2013

Re: CAN controller issue on ZC702

Jump to solution

How do you set the MIO9 pin low?

0 Kudos
Adventurer
Adventurer
9,564 Views
Registered: ‎05-10-2013

Re: CAN controller issue on ZC702

Jump to solution

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

 

 

0 Kudos
Newbie ella2408
Newbie
346 Views
Registered: ‎05-15-2019

Re: CAN controller issue on ZC702

Jump to solution

/*
* Initialize the transceiver device.
*/
GpioCfg = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
if (GpioCfg == NULL) {
return XST_FAILURE;
}
Status = XGpioPs_CfgInitialize(&Gpio, GpioCfg, GpioCfg->BaseAddr);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}

/*
* Setup GPIO9 to low (CAN_STB/SP_MIO9)
*/
XGpioPs_SetDirectionPin(&Gpio, 9, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 9, 1);
XGpioPs_WritePin(&Gpio, 9, 0);

0 Kudos
Newbie ella2408
Newbie
345 Views
Registered: ‎05-15-2019

Re: CAN controller issue on ZC702

Jump to solution

I have forgot the types

 

XGpioPs Gpio;
XGpioPs_Config * GpioCfg;

0 Kudos