Jump to content
  • 0

Zybo with PmodCAN and RPi


LaTaupe

Question

Hello all,

I am trying to set up a CAN communication between a ZYBO Z7 Board with a PmodCAN Controller (connected on JE) and a Raspberry PI 3 using a Niren CAN Module as Controller. Letting 2 Raspberries communicating which each other via SocketCAN works fine, both can send and receive CAN data. Now if I try to let the Zybo communicate with the Raspberry using the example codes for transmit and receive data there seems to be no data on the bus. Neither the Zybo receives any data from the RPi nor the RPi from the Zybo. I have created a block design and tried the example codes according to the guide from the digilentinc website here . The LoopBack example does work as intended, Tera Term shows the messages being send, fetched and received. Just when I try to send data from the RPi the Zybo waits endlessly and any data send out from the Zybo wont be caught by the RPi. I have tried different bitrates to no avail. 

Any help or directing towards the right path in case i am way off in what i am trying is greatly appreciated. The block design is attached.

Cheers

zybopmod.JPG

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

Hi @LaTaupe,

Welcome to the Digilent Forums!

Looking at your Block Design I see you are using the interrupts on the Pmod CAN IP Core. The interrupts were not incorporated into the RX, TX and loopback examples. The examples and the PmodCAN.c and PmodCAN.h use polling to get data. 

Are you able to oscilloscope the CAN signals? Are the RPI and the Pmod CAN's bit rate the same?

Are you using 2 Pmod CAN's to facilitate the loopback example?

best regards,

Jon

Link to comment
Share on other sites

Hello @jpeyron,

thank you for your swift reply! Right, I actually read it another thread that polling is used. I re-made the block design without interrupts. I am gonna try to oscilloscope the signals and I only used 1 Pmod CAN so far to test but i do have 2.

On 6/26/2019 at 10:13 PM, jpeyron said:

Are the RPI and the Pmod CAN's bit rate the same?

I believe the following line in PmodCAN.c 

u8 CNF[3] = {0x86, 0xFB, 0x41};

sets the bit rate to 250 kbit/s ? So the RPI I set to the same rate with

~$ sudo ip link set can0 type can bitrate 250000

Is there anything else I need to pay attention to? New Block Design is attached.

Best regards

BlockNew.JPG

Link to comment
Share on other sites

Hello @jpeyron,

thank you a lot for your help so far. First I am trying to let just 1 pmod communicate with the niren can module on the RPi, I did ground them together and terminated both ends with 120 ohm, it remains a mystery to me why i can not receive any CAN data on the RPi which is send from the zybo. As stated in my previous post the bitrate of the pmod is set to 250kbs and the can clock 20mhz in following line of PmodCAN.c :

u8 CNF[3] = {0x86, 0xFB, 0x41};

The oscillator on the Raspberry side is 8mhz. Do the CNF value need to be changed to meet the Raspberry oscillator value? 

Also I do not have the means to oscilloscope the CAN values.

Best regards

Link to comment
Share on other sites

Hi @LaTaupe,

Please make sure that you are using the most current Pmod CAN IP Core here. We had an error in the Pmod Can IP Core that didn't allow users to change the bit rate.  We fixed this issue in May. 

Being able to see whats going on on the CAN Bus will be very helpful. 

The Analog Discovery 2: 100MS/s USB Oscilloscope, Logic Analyzer and Variable Power Supply would be able to view the can bus.

best regards,

Jon

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...