This is probably a multi-topic question (firmware, hardware, libraries).
I want to ask about the background for implementing the CAN protocol (on D1, D2 of the Photon).
The reason for asking is that I would like to implement K-Line (ISO 9141 and/or KWP 2000), which are older automotive protocols than CAN. Any insight into the design decisions for CAN would certainly be valuable for K-Line.
Is there a specific reason for CAN being implemented only on D1/D2 of the Photon? This would help in answering if K-Line would have to be implemented on the same pins, or could be done on other pins.
Were there any particular challenges for the CAN portion of the firmware? I would assume the same challenges would be faced in implementing K-Line.
Is there a reason other automotive protocols were not built in?
I am taking my inspiration from the Carloop product (www.carloop.io which implements CAN), and would like to do something similar on the K-Line protocol. I already have some ideas of what the hardware could be, but want to make sure I take the best approach.
A part of the answer to why CAN is that the used µC (STM32F205RG) has the CAN support built-in.
The two HW ports of that controller are exposable on GPIO pins (CAN1: PA11/12 or PB8/9, CAN2: PB5/6 or PB12/13)
And since Particle wanted to expose as may different interfaces as possible, there was only room for one set on the Photon.
The Electron does expose both CANs.
That is a good start for me. I will look more into the STM32F205RG to see how much of that same HW for CAN can be leveraged for K-Line. I will assume for the moment that K-Line will have to rely more on the firmware & software side to make the protocol work.
Kudos to the Particle team for exposing all these interfaces; even if they cannot do it all, they still provide inspiration to see what is possible.
@Bspranger: Unfortunately that is not the case. See Wikipedia for an overview of the signal protocols.
KWP2000 is based on the ISO 14230 which shares the same physical layer as ISO 9141.
So far, I have a hardware design and am starting to order parts for prototyping.
My software concept involves re-designing a slow-speed software implementation of a Serial interface that @ScruffR developed in order to work for K-Line. Due to the very low baud rates of ISO 9141 and KWP2000, it should be possible to implement successfully. Once the K-Line is in place, I plan on building 9141 and KWP messaging layers on top. I have some ideas for application layers at the top, starting with the usual OBDiagnostics.
@Bspranger, Can you share your project? I am about to order a K-Line transceiver chip for prototyping a re-design… my CANbus solution is not working on my project car (ISO 9141) but works on my daily driver (CANbus). An easier solution would certainly be appreciated!