FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5151 Discussions

Cyclon V SoC CAN bus driver implementation using Hardware Libs alt_can.c and alt_can.h

AmitD
Novice
325 Views

Hi,
Recently I have started to work on implementation of the CAN bus controller on a Cyclone V SoC.
1. As the OS used in the project is Threadx instead of Linux, I have thought to use the functions offered by the Hardware Lib int the files can_alt.c and can_alt.h, from Altera.
Unfortunately I could not find documentation of those functions, especially the initialization sequence, nor could I find any example of a driver using those functions.
Can anyone help? 
2. During the search for an example,  I have downloaded the Linux kernel used by the SoC, thinking I will be able to find there the used driver, and learn from there. Again Unfortunately, there are multiple implementations of CAN in the kernel, and I fail to pin-point the one actually used (among those implementations there is a Xilinx driver - which I'm almost certain is not really used on an Altera SoC).
Can anyone point me to the implementation actually used in the SoC?
Help will be much appreciated,
Thanx in advance,
Amit Dar

0 Kudos
5 Replies
AnilErinch_A_Intel
270 Views

Hi Amit,


Please refer to the below link for an overview of HWLIB

https://rocketboards.org/foswiki/Documentation/HWLib

Please use the below link to download the reference manual for specific components including alt_can.h.


https://rocketboards.org/foswiki/pub/Documentation/HWLib/hwlib_api.tar.gz


Thanks and Regards

Anil



AmitD
Novice
245 Views

Hello Anil,
Many thanx for your reply.
I have downloaded the material you have pointed out (hwlib_api - 500 MiB), and gone (yet another time) through the RocketBoard hardwarw library site. I heve managed to find a place where CAN bus example is promised, but no sign of the example itself. In addition I have found (again) a version of the source of the alt_can.h, alt_can.c and some related stuff. As I could not find a sign of any documentation I'm looking for, nor any actual example for CAN bus, c
ould you please point out the exact location of the CAN bus documentation / example either in the tar.gz you have mentioned or in any other site?
Thanx in advance,
Amit

 

 

AmitD
Novice
243 Views

Anil, Hi Again,
Maybe I can focus more sharply what I'm looking for:
I need to operate the CAN bus basing on a polling scheme, utilizing
a 1 millisec timer interrupt I already have in the system.
The high level protocol I need to implement is quite simple (though not so efficient):
Only two nodes are participating - the master, and the slave.
The master sends a request CAN message, then the slave sends a reply CAN message.
These pairs of request and reply continue throughout the communication. 
What I need is a short explanation of:
1. Which functions in alt_can perform the entire simplest, initialization sequence, and at what order should they be called (especially for setting the baudrate, the node(s) id, timing periods if needed, and similar)
2. Which functions to use for writing a CAN message to the device for transmission.
3. Which functions to use for polling, and then reading a pending message from the device into the application  memory.
if possible I will be much obliged for an example that contains those 3 issues.
Again, Thanx in advance,
Amit

AnilErinch_A_Intel
229 Views

Hi Amit,

We don't have a step by step example for CAN communication using HW LIB.

You can try to implement it using the available alt_can.h and description of fields mentioned there.

Please let us know if you face any roadblocks during the implementation and we can have a look in to the same.

Thanks and Regards

Anil


AmitD
Novice
220 Views

Hi Anil,
Thank you for your reply.
As I have written, I could not find documentation of the alt_can.h in the links you have pointed me towards, though I have tried (found only documentation of different functions that perform other tasks then CAN bus). Could you point me to the place where the alt_can functions they are described, inside the link you have sent?

Thanx in advace,
Amit

Reply