<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Custom class USB allows you to use the features of USB that separate commands from data and make the size of the transfers more definitive.</div></blockquote><br></div>I really would prefer driver-less, if at all possible. A simple serial control VCP. With a powerful-enough processor (and the difference between an 8bit PIC and a 32bit PIC is US$2), we have a lot of opportunity to offload work to the USB-CAN adaptor itself (for example high-level filters), and I don't think we will be baud-rate limited. Perhaps if there is an advantage with custom class USB, we can offer both interfaces?<div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You'll probably need a USB VID and PID (Vendor ID and Product ID). If you don't already have one then Microchip might make a PID available once you fill out their request paperwork.</div></blockquote></div><div><br></div><div>Sending it in now - it is worth a try.</div><div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Any reason to avoid the 12V vehicle power? I suppose that simplifies the hardware.</div></blockquote><div><br></div><div>Yeah, just to keep it simple (and cheap). We would still need 5V->3.3V. Unattended logging would be cool, but only 128KB RAM in the device, and adding an SD-CARD would complicate things.</div><div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You may not need a switch for program versus run mode - at least I've gotten away without one, but it does make it easier for field firmware upgrades, I suppose, if there is a switch.</div></blockquote><div><br></div><div>Being able to re-flash the device from USB is definitely a requirement. We don't want people to have to go the PICKIT / ICSP route.</div><div><br></div><div>I'll try to rough up a schematic, to see how many components this can be brought down to. For China manufacturers, saving even 1 component brings the cost of both materials and assembly down. I remember working with the factory to remove 1 single chip costing US$1.10 down to a bunch of passive components costing US$0.10 - resulting price difference was US$3 (I think they really didn't want to use that chip, not just for the cost but also for the hassle of obtaining it).</div><div><br></div><div>I really want to get this to DB9 - MCP2551 - PIC32 - USB, with minimal external components.</div><div><br></div>Regards, Mark</div><div><br></div><div><div><div><div>On 3 Sep, 2013, at 6:48 AM, HONDA S-2000 <<a href="mailto:s2000@sounds.wa.com">s2000@sounds.wa.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>This all sounds good.</div><div><br></div><div>I agree with eliminating the FT232RL. The PIC32MX795 can maintain the serial USB feature or use a custom class USB for easier control protocol. Serial can be more cumbersome and error prone because all bytes are equivalent, and you have to rely upon parsing to identify individual commands and data. Custom class USB allows you to use the features of USB that separate commands from data and make the size of the transfers more definitive.</div><div><br></div><div>OSX allows standard applications to access custom USB devices without a custom driver.</div><div><br></div><div>Linux hopefully allows the same by using libusb, although I have no experience there.</div><div><br></div><div>Windows seems to require a driver for everything, but I don't know the actual limitations.</div><div><br></div><div><br></div><div>You'll probably need a USB VID and PID (Vendor ID and Product ID). If you don't already have one then Microchip might make a PID available once you fill out their request paperwork.</div><div><br></div><div><br></div><div>Any reason to avoid the 12V vehicle power? I suppose that simplifies the hardware. This USB-CAN device is not useful for much except logging unless it is plugged in to a USB host. On that note, perhaps it's worth designing the PCB for a 12V power option, but perhaps not populate the parts, so that someone who wants to do unattended logging could power the board without a laptop sitting in the car.</div><div><br></div><div>You may not need a switch for program versus run mode - at least I've gotten away without one, but it does make it easier for field firmware upgrades, I suppose, if there is a switch. With the right circuit, it might be possible to leave the switch off the PCB for the commercial product, assuming that saves money and firmware upgrades are not frequent.</div><div><br></div><div>I'll study the CAN232 manual and Sparkfun UBW32 schematic...</div><div><br></div><div>Brian Willoughby</div><div>Sound Consulting</div><div><br></div><br><div><div>On Sep 1, 2013, at 18:56, Mark Webb-Johnson wrote:</div><blockquote type="cite"><br class="Apple-interchange-newline">Brian,<div><br></div><div>OK, let's concentrate on hardware first.<br><div><br></div><div>So far, as far as I've got is prototyping something using:</div><div><br></div><div><ol class="MailOutline"><li>UBW32 (<a href="https://www.sparkfun.com/products/9713">https://www.sparkfun.com/products/9713</a>) PIC32MX795 development board.<br><br></li><li>MCP2551 CAN controller (<a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010405">http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010405</a>).<br><br></li><li>FT232RL based converter (<a href="https://www.sparkfun.com/products/718">https://www.sparkfun.com/products/718</a>).</li></ol></div><div><br></div><div>The FT232RL was just wired to the first async port of the PIC32, and the MCP2551 connected straight to the PIC32 as well using the normal CAN controller ports.</div><div><br></div><div>That was the prototype. For production, I don't think we need the FT232RL at all. We should be able to use the PIC32 USB and have it present as a serial port to the host (windows, linux, osx, Android?). I have played around some with the PIC USB library (I built a little HID keyboard media player for my car - <a href="https://github.com/markwj/hidmedia">https://github.com/markwj/hidmedia</a>). But, I haven't spent much time with the PIC32 USB framework as a serial port and have no idea how the driver support works.</div><div><br></div><div>Components wise, I reckon we need:</div><div><br></div><div><ul class="MailOutline"><li>USB connector, and support components</li><li>5V-3.3V power regulator</li><li>PIC32MX795 and support components</li><li>MCP2551, and support components</li><li>DB9 connector, either "standard" CAN-on-DB9 or OVMS-on-DB9 pinout</li><li>Switch for program/run mode</li><li>ICSP pins</li><li>Case</li></ul></div><div><br></div><div>I suggest to power from the USB port, not from the vehicle side 12V. The MCP2551 (and CAN bus) is 5V, but I think can be powered directly from the USB port. The PIC32MX795 is 3.3v. But, both are tolerant and seem to be able to be inter-connected without any issues (the MCP2551 trigger level is <3.3V, and the PIC32MX795 is 5V tolerant on the CAN RX pin).</div><div><br></div><div>I've used these products:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><a href="http://www.can232.com/">http://www.can232.com</a></blockquote></div><div><br></div><div>and they have a simple serial API that I am already using with my CAN-RE-TOOL:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><a href="http://www.can232.com/docs/canusb_manual.pdf">http://www.can232.com/docs/canusb_manual.pdf</a></blockquote></div><div><div><br></div><div>I've discussed with the factory in China, and it seems fairly simple. They have done similar projects before, using the case shown below. Plenty of room and we can either use a USB type B socket, or type A plug on the end of a soldered-in cable. The PIC32 is definitely overkill, but given the price of the chip, I don't think it is much of an issue - it will give us plenty of room to do whatever we need.</div><div><br></div><div>Regards, Mark.</div></div></div></blockquote><div><br></div></div></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></blockquote></div><br></div></div></div></body></html>