EmbDev.net

Forum: ARM programming with GCC/GNU tools CAN in AT91SAM7X w/FreeRTOS


von Andy K. (andykunz)


Rate this post
useful
not useful
Just wondering if anybody is using the CAN module in an AT91SAM7X, under
FreeRTOS or other.  I'm just looking for a head start at this point -
the only thing I've found was a posting on the Sparkfun site looking for
questions answered as well.

Thanks.

Andy

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Andy Kunz wrote:
> Just wondering if anybody is using the CAN module in an AT91SAM7X, under
> FreeRTOS or other.  I'm just looking for a head start at this point -
> the only thing I've found was a posting on the Sparkfun site looking for
> questions answered as well.

So far I have not worked with CAN on an SAM7X (no hardware here) so just
some ideas: There is an example-code from Atmel in a package called
AT91SAM7X256-BasicCAN-IAR430A-1_2.zip (google should find it) and a
Powerpoint-file Training for CAN with SAM7X/SAM7A3 on at91.com
(devices->7x->CAN). Together with the datasheet/manual this should get
you started with the CAN-driver. Once you have the driver working you
can use most of this code in a RTOS project. Make sure the CAN-hardware
is only accessed from on task to avoid conflicts and send/receive
to/from this task using two FreeRTOS's queues. One for messages to be
transmitted and one for received packages.

Hope this helps a little bit
Martin Thomas

von Andy K. (andykunz)


Attached files:

Rate this post
useful
not useful
Thanks Martin.  I already have both of those.  If you look at the IAR
code it's very unhelpful (typical IAR code).

I have the basic driver written now, just working directly off the data
sheet.  I put together a spreadsheet for setting the CAN_BR register
properly.  It's rather involved to get a good selection; attached is a
first pass of the spreadsheet.

The driver runs from interrupts and uses queues to communicate with the
application.  Once I am happy with it I intend to post it here (feel
free to remind me in a week if I forget).

Andy

von Brett W. (fishnchips2)


Rate this post
useful
not useful
Andy Kunz wrote:
Once I am happy with it I intend to post it here (feel
> free to remind me in a week if I forget).
>
> Andy

Hey Andy,

I have also just started to 'try' and implement CAN with FreeRTOS on the
AT91SAM7x, and seem to have followed the same path with the IAR code
etc.

Was just wondering how you were going with yours?

Thanks
Brett

von Andy K. (andykunz)


Attached files:

Rate this post
useful
not useful
Attached are the CAN drivers I am using under FreeRTOS on a AT91SAM7X.
I've had it running between two boards for several days now without
reset.  My task has stack set to 300.

Thanks to Brett Wood for finding "the last bug" in it.

Andy

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.