Saturday, July 27, 2013

Microchip based CAN Interface - Part I

So after tinkering a lot with the ELM329 I started to actually get somewhat irritated with the limitations. While it works great for some basic scanning and sending basic commands BY HAND, when you start dealing with more intricate messages such as large multi-line messages etc or wanting to use it programmatically, it becomes a problem. Also the text base of everything seemed rather inefficient especially when dealing with it in code: i.e. you'd have Hex on the bus, converted to string by the elm, then convert that back to hex in your program, do something, convert whatever you want to send from hex to string, send to elm, that converts is back to hex before putting it on the can bus. Talk about a lot of extra steps for no reason.

I had already been playing with a LPC-based ARM Cortext dev board, and I figured I could make something like that but in a neat tiny box etc. However I wanted to give the microchip platform a try instead of the ARM, I wanted something with at least Dual CAN Capability. Oh and let's not forget the lowest pin-count possible, because I really don't want to mess with a 144 pin device.  Then of course add some kind of USB Interface -I could go with a CP2102 like I've used on the ELM329 simply connected to the UART pins, but for the price difference I noticed I might as well go for a model that has USB built in. That way I can actually use it as HID device instead of being forced into an archaic Serial Port type setup, and I have to worry about less parts on the board.
This led me to the dsPIC33E Series of chip.

Having learned from my Elm329 baking adventures that 2 sides pcbs are a bit of a pain in the ass(not that much, but still so much easier to do it one sided), I figured i'd make a single sided pcb that would fit in a Hammond 1551 box...

Took me forever to make a layout I was happy with and get the routing just right (I like to torture myself and hand-route everything , though since this chip supports dynamic pin reassignments it makes it a bit neater) but it looks pretty sharp! I took some extra time to make a nice logo on the back and besides just using the silkscreen layer I'm actually using the (lack of) Soldermask layer to add some cool touches to the design. Now i'm just hoping it works the way I think it does..

Initial Design
Component Side

Bottom Side with awesome logo!

And all populated - by hand this time since I didn't make a stencil yet