Go Down

Topic: Building a CAN API for Arduino DUE (Read 138 times) previous topic - next topic

downtown_sausage

I would have to agree with AdderD. Why can't preliminary code be posted up for people to start digesting/optimizing/learning/testing/developing? Also, this API that's being 'developed'. There hasn't even been any discussion on how this API will utilize the CAN peripheral and other necessary peripheral features on board the micro.

Let me elaborate: From my experience with micros and peripherals, there are many ways to configure the drivers. Sometimes you can use DMA, sometimes there is dedicated RAM on board for the specifc peripheral, or you might not use either. There's all kinds of Low Power Mode Options just for CAN. What events will be generating CAN interrupts to the uC?
What exactly is this API establishing? A bare bones CAN driver or are there more layers of software queuing on top?

So why are driver configuration options not up for discussion? The driver is the foundation upon which everything else will be running. It seems as though there should be discussion on this, unless Palliser wants only his CAN driver ideas implemented..

peplin

Another "let us code" post here - I don't particularly care how the CAN shield turns out, and it's not going to have any effect on what the CAN API looks like. It's getting to the point that someone is going to fork off and make their own CAN library, but if the efforts happening behind the scenes of this thread are the "officially blessed" efforts, it would be a shame to have conflict in the future.

A GitHub repo with a "This code does not work." line in the README should suffice.

Palliser

I think, at this moment, an overview of this project would help to clarify and provide some answers for the latest posts:

My original goal was to find a tinker way to communicate the two little "CANRX" and "CANTX" of the new Arduino Due. I did read in the Arduino site that there was no API available for that. I ran through this forum and found nothing in progress. I asked Massimo about it and he invited me to contribute doing so. I started to look for prior arts regarding the integration of SAM family cores and the CAN protocol and found SAM3X-EK development board and Atmel ASF CAN library. This forced me to re-align my original goal with Atmel's goal which is: to show how to configure the two CAN controllers and how to manage CAN message transfers. Then I started to port the Atmel sample to Arduino IDE. I worked alone for a month, posting my progress here in the forum. During this exercise, I didn't imagine that this way was the hardest road. Finally, I made Due to read/write CAN messages, but at a cost: ~40 files (50% Atmel, 50% Arduino). Even though I followed Massimo recommendations trying to minimize the library, I couldn't reduced them too much. So, I asked him and Cristian for help. They did put me in contact with the Atmel engineer that developed the CAN sample. I gave him the files and he started to redo pretty much everything. As I mentioned before, he already built the shield and is doing now tests. He is a leader, an expert with CORTEX-SAM and a hard worker.

Like you guys, I am waiting for the final CAN API. In the meantime, my role these days has been to motivate the making of the shield, which is a must.

All I can say is that Arduino want to release a solid CAN API, providing to this community a good start in working with the CAN protocol. It is a fact that not everyone knows CAN, like some of us. In this way, it will be easier to digest/optimize/learn/test/develop the protocol. And that's when you will be very valuable with new ideas/applications and supporting others that want to learn. Thanks.

downtown_sausage

Palliser, I did  not mean to be critical. People are ready to go on this, and I think it's time we start working towards a goal. It sounds like the Atmel engineer may have higher priorities or slowed down on progress, maybe we should start working on our own CAN API. What would we need outside of the datasheet to do this?

Collin80

Yes, I don't mean to sound like a jerk but that point it really looks like whatever is happening behind the scenes is not working. I really seriously am considering starting up an effort to make a new library from the ground up with just Arduino sanctioned code and libraries. It seems like this Atmel person isn't working very quickly. It is true that it appears as if the canbus stuff in the cortex chip isn't the easiest to work with but the Arduino 1.5.2 IDE seems to already have plenty of libsam and CMSIS stuff in it so access to the relevant hardware features to enable canbus should be possible. At first a fresh effort like this would just basically be the ability to send/receive canbus frames without a lot of hand holding but eventually it could be built up. We'll see. I should get my Due soon and transceivers some day and once I get my hardware I'm going to be itching to make things. If this Atmel guy hasn't produced anything by then I might take matters into my own hands. It's OK if my effort doesn't get sanctioned or if I end up abandoning it once/if the sanctioned one sees the light of day. I'll still have learned a lot about the architecture and that's important too.

Go Up