Re: Need code for CAN driver for PK20DX256VLL7
Rufus Smith <[email protected]>
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <[email protected]> |
Kudo's to John for his excellent response.
He's concisely laid out what could be easily months worth of work and
discovery into a simple, practical sequence of "bring up" for a CAN system.
(I know it's good because it is similar to my own work of bringing
up new
chips or new technology.)
His narrative has an even lower-budget tools requirement than I used:
I've found having an inexpensive oscilloscope and my trusty LOGIC
usb logic analyzer
have been helpful (the scope to tell me if there is any signal at all,
and voltage
levels being seen, and the logic analyzer to decode serial streams at
any baud,
CAN being one of the protocols available)
On 7/14/2014 11:56 AM, John Dammeyer wrote:
>
> The very first thing to do is to buy a CAN dongle like a CANUSB
> (Lawicel), CAN4USB (Zanthic), CAN Leaf (KVASER), CANVIEW USB (RM
> Michaelides) or some other version.Since every CAN system needs at
> least two nodes it will give you one correctly working node to use for
> sending and receiving messages.
>
> If you are using Linux make sure you pick one of these dongles that is
> supported under Linux.
>
> If you don’t have a development module with coded CAN drivers you will
> need to get that sorted out.
>
> For example, a while back I needed a board with 5 CAN ports.Searching
> the web I found this one.
>
> http://hk.element14.com/freescale-semiconductor/evb9s12xdp512e/demo-board-mc9s12xdp512/dp/2134910
>
> I’m in Canada and I bought two from a supplier in Italy, one for
> development and one for the end product.It came with some simple test
> code.It used the CodeWarrier development system that let me set
> breakpoints single step programs line by line.Very important when
> developing code for hardware.The 9S12 is a bit out of date now so I’m
> not suggesting you buy this board.
>
> After I had a a simple “Hello World” program working on the serial
> port I wrote some code to send a single CAN message.That meant
> initializing the registers, setting the ID and something like 1, 2, 3,
> 4 … into the data part of the message.Once that was correctly received
> by the CANUSB dongle on a Hyperterm window I knew I had the bit rate
> and messaging correct.
>
> I then expanded on the transmit code to let me enter in the ID and
> data on the command line.Once that was working I started on the
> receive code.
>
> No interrupts.Just polling the CAN message Receive Data available bit.
> Dump the received ID and data as hex bytes out the serial port to the
> second HyperTerm window. The project I used the board for never did
> use or enable Rx Interrupts. It was the system master and determined
> when a node would reply.Eventually I used all 5 CAN bus channels
> communicating through TKE Bridges (Finland) to 50 nodes per channel
> for a total of 750 nodes.To work with the TKE Bridges I had to add a
> CAN4USB and write some CANOpen messages to talk to the control port on
> the Bridge for receiving status information.The end project is
> here.http://www.autoartisans.com/rings/YVR_Rings.jpg
>
> Sometimes it’s easier to also buy a small module that has a magazine
> article or workshop based around it.Even if it’s not for the processor
> of choice.Both ELEKTOR and CIRCUIT CELLAR magazines have had project
> articles with CAN.None of that is money or time wasted since the
> education you get will help you withyour end project.For example:
> http://www.elektor.com/controller-area-network-projectsI haven’t read
> this book but it may be the perfect thing to get you started.
>
> I believe there is also an Arduino Shield that has CAN bus.If you want
> to learn about CAN bus don’t get too focused on a specific
> processor.Once you have the knowledge to get something working the
> target processor will be easy.
>
> John Dammeyer
>
> *From:*[email protected]
> [mailto:[email protected]] *On Behalf Of
> *Sreevenkitesh Sree
> *Sent:* July-14-14 4:02 AM
> *To:* [email protected]
> *Subject:* [CANLIST] Need code for CAN driver for PK20DX256VLL7
>
> i am using freescale tower k20d72m , for that i need to interface
> CAN . can you please help me to get a sample code (to understand).
>