Hi,
Is there anyone having experience with the CAN bus, implemented with XMOS? Are there C routines available for download? Searching the internet I found that more developers are looking for sources :?.
Any help or links are welcome!
Martin
CAN bus implementation
-
- Active Member
- Posts: 32
- Joined: Thu Jun 03, 2010 12:16 pm
-
- XCore Addict
- Posts: 238
- Joined: Thu Dec 17, 2009 5:15 am
Sure seems that CAN is a good candidate for XC and its XMOS eventful core.
I haven't read alot yet on CAN on the XMOS SDS. I'll bet there is C source to
get the pieces then optimize in XC. Controller Area Networks are big money
in the auto world. Me myself I would Like to hang a CAN or 2 off the side of a
Flexray typo Xbus jamming with aggregated FastXlinks.
,but thats over the edge
.
.
.
I haven't read alot yet on CAN on the XMOS SDS. I'll bet there is C source to
get the pieces then optimize in XC. Controller Area Networks are big money
in the auto world. Me myself I would Like to hang a CAN or 2 off the side of a
Flexray typo Xbus jamming with aggregated FastXlinks.
,but thats over the edge
.
.
.
-
- Respected Member
- Posts: 377
- Joined: Thu Dec 10, 2009 6:07 pm
There is a CAN bus implementation that has been done on the XMOS devices using an external PHY.
Old thread briefly discussing it:
http://www.xmoslinkers.org/forum/viewto ... 97&start=0
The docs and code are here:
http://archive.xmoslinkers.org/node/296
You might need to click through a warning about Xlinkers no longer being active to get it.
Old thread briefly discussing it:
http://www.xmoslinkers.org/forum/viewto ... 97&start=0
The docs and code are here:
http://archive.xmoslinkers.org/node/296
You might need to click through a warning about Xlinkers no longer being active to get it.
Files replicated here as about 5 people have previously asked for CAN bus; I believe the old Xlinkers site is no longer being Google-indexed but there is still an awful lot of project material that has not been moved over.A software defined silicon implementation of a CAN controller. The following is an extract of the first page of the attached documentation:
******************************************************
1 Introduction
This document describes the XMOS implementation of the CAN protocol on an XS1-G4 chip using the XC1 development board.
Please note this is an early release of this API as the implementation is not complete yet. This document will be updated to reflect further progress.
2 API details
Details of the API are included in files:
• include/CanConfig.h
• include/CanFunctions.h
• include/CanIncludes.h
Include the include/CanIncludes.h file which brings in all the needed APIs to your project. This API implements the bottom two layers of the ISO/OSI reference model, namely the Physical Layer and the Data Link Layer. The implementation maps those two layers into two separate hardware threads:
• void CanPhyRx(chanend toData, buffered in port:32 canRX, port canTX)
• void CanDataRx(chanend toNetwork, chanend fromPhy)
• void CanPhyTx(chanend fromData, in port canRX, port canTX)
• void CanDataTx(chanend fromNetwork, chanend toPhy)
******************************************************
Please refere to the attached documentation for more information.
In the build directory, you'll find a can.xe already built using the desktop tools version 9.2.2. Using loop back configuration and a minimal debug output, with all the error checking activated, it will send and receive 1000 fixed CAN packets. The output is just a progress indication after every 10 packets (i.e. 1% progress).
You do not have the required permissions to view the files attached to this post.
-
- Active Member
- Posts: 32
- Joined: Thu Jun 03, 2010 12:16 pm
This helps a lot! What does this implementation need regarding threads and cores?
Should I reserve a core for CAN bus?
Should I reserve a core for CAN bus?
-
- Respected Member
- Posts: 377
- Joined: Thu Dec 10, 2009 6:07 pm
The source and documentation are linked above at the bottom of my post. This isn't a complete implementation (as the docs say). I haven't dug into it to check thread (or memory) usage, sorry.omega7 wrote:This helps a lot! What does this implementation need regarding threads and cores?
Should I reserve a core for CAN bus?
-
- Member++
- Posts: 17
- Joined: Fri Aug 12, 2011 2:36 pm
Just wondering if anyone has actually tried the CANbus code attached in one of the above posts. I am looking into CAN/CANopen and thought it might be a good start since I am pretty new to this communication layer.
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
I'm not familiar with the code itself, but there is a more up to date version on github:xcorific wrote:Just wondering if anyone has actually tried the CANbus code attached in one of the above posts. I am looking into CAN/CANopen and thought it might be a good start since I am pretty new to this communication layer.
https://github.com/xcore/sc_can
-
- Active Member
- Posts: 62
- Joined: Sat Sep 17, 2011 12:05 pm
@xcorific
Well, I devloped once a text and symbol based communication system for my company.
There are a couple of CAN- connected stations, with LCD-screens and piezo buttons, where
users can select and send messages to other users.
It is a simple system, based on a properitary protocol with near to zero overhead.
Now we are moving on to CANopen, because we want to go with standards. Also, we want
to replace many existing in-vehicle sensors with CANopen sensors.
It would be nice to have a CANopen stack for XMOS hardware, but I think that is not a simple
undertaking. The protocol is quite complicated, the complete spec with all the device profiles is also
not availbable for free. So, in this sense the 'open' in CANopen is a bit missleading.
matrix
Well, I devloped once a text and symbol based communication system for my company.
There are a couple of CAN- connected stations, with LCD-screens and piezo buttons, where
users can select and send messages to other users.
It is a simple system, based on a properitary protocol with near to zero overhead.
Now we are moving on to CANopen, because we want to go with standards. Also, we want
to replace many existing in-vehicle sensors with CANopen sensors.
It would be nice to have a CANopen stack for XMOS hardware, but I think that is not a simple
undertaking. The protocol is quite complicated, the complete spec with all the device profiles is also
not availbable for free. So, in this sense the 'open' in CANopen is a bit missleading.
matrix
-
- Active Member
- Posts: 62
- Joined: Sat Sep 17, 2011 12:05 pm
Hi all,
Has anyone thought of license fees, in case of implementing a CAN
controller in silicon ? I am sure about the scenario with XMOS. In the past, If one
wanted to do that on FPGA, and it was not just for academic purposes, a license
fee was due because CAN is a Bosch patented technology.
Has anyone thought of license fees, in case of implementing a CAN
controller in silicon ? I am sure about the scenario with XMOS. In the past, If one
wanted to do that on FPGA, and it was not just for academic purposes, a license
fee was due because CAN is a Bosch patented technology.
-
- Experienced Member
- Posts: 102
- Joined: Mon Feb 22, 2010 2:30 pm
Regarding canbus, the link richard posted above is good to go and has been pretty well tested.
For CANopen, it'd be great to see a project to work on this. There is an open source stack design for microcontrollers (there is an AVR port) called CANfestival.
http://www.canfestival.org/
Anyone wanting to port that to XMOS, or do their own from-scratch implementation please get in touch - we'd be interested to discuss how we could support this project.
Cheers,
Dan
For CANopen, it'd be great to see a project to work on this. There is an open source stack design for microcontrollers (there is an AVR port) called CANfestival.
http://www.canfestival.org/
Anyone wanting to port that to XMOS, or do their own from-scratch implementation please get in touch - we'd be interested to discuss how we could support this project.
Cheers,
Dan