Simple CAN Bus Prototyping Board

puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Simple CAN Bus Prototyping Board

Post by puff »

this file:
https://rusefi.com//docs/html/obd2_8cpp_source.html (pay attention to lines 54, 64, 81, 91)
@russian, pull-requests are still welcome? :D
User avatar
AndreyB
Site Admin
Posts: 14325
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Simple CAN Bus Prototyping Board

Post by AndreyB »

puff wrote: @russian, pull-requests are still welcome? :D
We've got a bit off-topic here had we? :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

It's not too far off topic :)

Either way, I'm still waiting on boards and I'll update when that happens and I get them assembled. The discussion so far has given me some insight into what is wanted from a CAN bus and what to implement as far as protocols, but I'm not much of a programmer so we'll have to see when that time comes.
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

It's certainly been a while since I promised to update. I got the boards a few weeks after I last posted. I assembled them, they didn't work, and then they got put into a bin and shelved while I try and sort through the rest of my unfinished projects (it didn't work).

So here I am at work, thinking about this project again and where I went wrong and I think I might have it, just looking for confirmation while I don't have hardware in front of me.
CanbusSnip.PNG
CanbusSnip.PNG (5.29 KiB) Viewed 8906 times
I forgot the capacitors for the crystal :roll:
I might have been thinking since I grounded the case that there must be caps inside? I looked up the datasheet some more and there definitely aren't, so I'm going to try and bodge some capacitors on tonight (I should stop making promises I might not keep) and see if I can get SPI communicating.

Gauges are still a low priority because the car is a bare shell at the moment, and will take at least a few months to build back up. Plus it's getting carbs, so I'll either need to make a compatible gauge sender board or to wait until I convert back to EFI.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Simple CAN Bus Prototyping Board

Post by kb1gtt »

See page 5 of frankenso schematic. We had some troubles with the XTAL caps on the knock chip. There are some handy references there for determining your caps. With out them you probably will not start, and your XTAL freq could be off by a bit. For the knock chip, when it does not start, you simply touch it and your ESD is enough to get it to oscillate.
Welcome to the friendlier side of internet crazy :)
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

I don't know how much calculating I can do when I'm going to be dead-bugging the caps onto the crystal, but 22uf seems a common choice with this chip so I'll start there and see where it gets me. I'll have to recalculate when I move to a new layout. That tip with touching the chip to start it is helpful. Should make troubleshooting a bit easier.
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

I removed the crystals, laid down a pair of 22pf caps and set the crystal back on top of them. I'm actually pretty proud of how well it fit together, but still no luck with communication. I think I found a problem in the example code I was using, but I still don't have any results, so I think I'll need to take a more methodological approach to troubleshooting now.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Simple CAN Bus Prototyping Board

Post by kb1gtt »

Do you have a scope? Can you verify it oscillates?
Welcome to the friendlier side of internet crazy :)
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

Haven't put a scope on it yet, that's next on the list. After that I think I need to finally give in and get a bus pirate or other logic analyzer so I can actually see what's going on.

edit: I did some more reading of the datasheet (almost like I should have done that better when I started) and I have the reset wired up backwards. I should be pulling it high and I'm pulling it low :(
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Simple CAN Bus Prototyping Board

Post by kb1gtt »

The DS1054 can do analog and digital decoding work for about $350.

https://www.amazon.com/Rigol-DS1054Z-Digital-Oscilloscopes-Bandwidth/dp/B012938E76?SubscriptionId=AKIAILSHYYTFIVPWUY6Q&tag=duckduckgo-d-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B012938E76

They make variants of this which can decode more channels. This one can only decode 40 channels, however other model numbers have many more digital inputs for more sophisticated digital stream decoding.
Welcome to the friendlier side of internet crazy :)
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

Having a modern scope would probably save me a lot of headache in the future, but I think that's going to be a purchase for another day.
ZHoob2004
contributor
contributor
Posts: 153
Joined: Sun Apr 03, 2016 7:11 pm
Location: Tucson, AZ

Re: Simple CAN Bus Prototyping Board

Post by ZHoob2004 »

SUCCESS! After correcting the reset pullup, it still didn't work. Did some more digging and noticed the MCP2561 (I used because the MCP2562 was on backorder) isn't exactly pin compatible with the MCP2562 (the VREF pin is switched for the SPLIT pin) and applying voltage to the SPLIT pin causes the MCP2561 to be unable to transmit (something about fault tolerance). After swapping the MCP2561 for the correct MCP2562 (I already had them, just hadn't swapped them in), I have send and receive functionality!

Next step is to get around to remote controlling a stepper through the bus.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Simple CAN Bus Prototyping Board

Post by kb1gtt »

That's some good news. Glad to hear your making progress. Keep it up.
Welcome to the friendlier side of internet crazy :)
Post Reply