CANhack.de CAN-Interface RKS+CAN
Diesel technology, engine technology, vehicle diagnostics, repair & maintenance.

Reading CAN Bus data with an AVR Butterfly?

 
Go to page: 1, 2  Next
New Topic Reply 🔗 🖨 CANhack.de - Index » CAN Bus General
Author Message
Natron
Guest




 


Free account, no CAN development support

Post07-01-2007, 20:56    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Okay, I'm new to this forum, and I hope you can help me with my project.

I want to use a microcontroller (AVR Butterfly) to read data from the CAN bus, specifically the vehicle's speed. I basically want to build a digital tachograph.
Could you perhaps help me figure out how to read the speed from the bus, and whether I need any additional hardware for the mController?

Thank you very much.
Back to top
axmax
Guest




 


Free account, no CAN development support

Post07-01-2007, 23:22    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Hello,

Well, the problem is that there's no CAN transceiver on it. Or am I mistaken? You could try connecting some kind of CAN interface to the Butterfly's serial port, but that sounds like overkill.

If you like AVRs, then find a board that also has a SJA1000 or similar components on it. You'll be much happier that way. Furthermore, there are numerous sources available online about this topic.

You can also check out olimex.com. They sell relatively inexpensive development boards. They are definitely good for experimenting or getting started. I have the sam7-ex256 (ARM). It's not necessarily recommended for beginners, as it's quite new, and you still have to create or adapt header files, etc., especially for the CAN connection.

Regards,
Axel.
Back to top
cor1990
Guest




 


Free account, no CAN development support

Post07-01-2007, 23:54    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Without external hardware, you cannot use the CAN protocol with the ATMega169. Can you already program the controller? For
Which vehicle would you like to use the tachograph on?

Best regards.
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post08-01-2007, 12:10    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

There are already AVR microcontrollers with an integrated CAN controller, such as the AT90CAN.
Otherwise, the MCP2515 can also be easily connected to an AVR microcontroller via ISP.
Source code for controlling it is available online.
I will implement my CAN control using an ATMega8 + MCP2515.

LG
Maxx.


Last edited on 09-01-2007, 11:42, edited 1 time in total.
Back to top
Natron
Guest




 


Free account, no CAN development support

Post08-01-2007, 13:42    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Hey, I really appreciate that you're helping me right away.

This part is for my VW Polo 9N (manufactured in 2003). Yes, I can program the Butterfly with BASCOM.


@Maxx1278

That means I still need the MCP2515, and then I can connect it to the CAN bus?
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post08-01-2007, 16:26    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

You need to be a little more careful there...

The MCP2515 is a CAN controller with an ISP (In-System Programming) interface!
The interface must be executed on the Butterfly.

As an alternative, you can use an SJA1000, as axmax mentioned.
It can be controlled normally using the address lines.

Okay, please check if SPI is implemented on the Butterfly.

You'll need a CAN transceiver between the microcontroller and the CAN bus.
You can use the MCP2551 for that.

LG
Maxx.


Last edited on 09-01-2007, 11:39, edited 1 time in total.
Back to top
e320cdi
Guest




 


Free account, no CAN development support

Post08-01-2007, 17:35    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

I would definitely also recommend an SJA1000/1054, depending on the bus type.

The MCP is quite prone to errors and is actually only suitable when you don't have enough free port connections on the MC.

Regards,

Mike.
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post08-01-2007, 18:00    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

The MCP is quite prone to errors and is actually only suitable if you don't have enough free port lines on the MC.

Ah, good to know.
I've started building my project using the MCP.
Should I perhaps switch to SJA icon_confused.gif?

LG
Maxx.
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post09-01-2007, 0:26    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

I will stick with the MCP for the time being, as a trial.
Let's see how he performs.
I'm actually planning to build the project using an ATmega8 microcontroller.
It doesn't look particularly promising when it comes to the ports either.

LG
Maxx.
Back to top
Natron
Guest




 


Free account, no CAN development support

Post10-01-2007, 14:03    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

So, basically, is that the part I need?

SJA 1000 - PellCAN 2.0B 1 Mbit/s 24 MHz DIP-28.


The Butterfly has an ISP interface.
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post10-01-2007, 16:24    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

You can use the SJA1000 if you have free port pins available on the AVR 13.
It's best to connect the address lines in a single 'block' to a processor port.

If you want to do it through the ISP interface, you should use the MCP2515.
It requires the ISP pins (SI, SO, SCK), as well as a CS (chip select) pin, and possibly an interrupt pin.
So, in total, 5 pieces.

LG
Maxx.
Back to top
Natron
Guest




 


Free account, no CAN development support

Post11-01-2007, 15:54    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Yes, I have already ordered the SN65HVD231D and the MCP2515.
Should everything be alright so far?
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post11-01-2007, 17:18    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

You won't enjoy using the SN65HVD231D: Operates With a 3.3-V Supply
You'll want one with a 5V operating voltage, right? icon_wink.gif

Use the MCP2551.

LG
Maxx.
Back to top
Natron
Guest




 


Free account, no CAN development support

Post12-01-2007, 15:02    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

'Is the MCP2515 my CAN controller, and the SN65HVD231D my transceiver?'

Did I misunderstand something? I thought I needed those two things?


Last edited on 13-01-2007, 18:33, edited 1 time in total.
Back to top
Maxx
Guest




 


Free account, no CAN development support

Post12-01-2007, 23:41    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Yes, you need both components.
Only the CAN driver SN65HVD231D is not suitable, as it must be operated with 3.3V.
The MCP2551 operates with 5V.

Perhaps you also read too carelessly and didn't notice that there are two different components that I wrote for you. icon_wink.gif

MCP2515 = CAN controller.
MCP2551 = CAN driver.

LG
Maxx.
Back to top
Natron
Guest




 


Free account, no CAN development support

Post13-01-2007, 18:31    Subject: Reading CAN Bus data with an AVR Butterfly? Quote

Oh yes, I hadn't noticed that icon_rolleyes.gif... Then I will correct my order. Thank you!

[edit]

No, does that fit?
The CAN transceiver SN65HVD231D operates with 3.3V, while the CAN controller MCP2515 operates within a voltage range of 2.7 - 5.5V. Therefore, can the MCP2515 be controlled with 3.3V?
Back to top
New Topic Reply 🔗 🖨 CANhack.de - Index » CAN Bus General
Go to page: 1, 2  Next
Similar articles and topics
Topic Forum
No new posts Audi A8 D3 - Geschwindigkeit via Can auslesen Engine CAN
No new posts Porsche Überdreher auslesen General
No new posts Km-Stand verschiedener Fz-Typen auslesen General
No new posts Mit Canshield und Arduino Can-Daten auslesen CAN Software Tools and Software
Jump to:  
You cannot post new topics in this forum.