0
\$\begingroup\$

I am looking for a chip which will convert CAN messages to an SPI message.

Is there any chip available as such?

Until now I have found MCP2515. But this chip does not serve the purpose, because SPI transactions need to be triggered in this chip. The master has to request for data from MCP2515. This is not my purpose.

I want a converter such that it will immediately convert CAN to SPI, without any help of the trigger.

Is there a chip which can work like this?

Alternative ideas to serve this requirement will be appreciated as well.

\$\endgroup\$
  • \$\begingroup\$ The NXP LPC11C22 series should be able to perform what you want. \$\endgroup\$ – Jeroen3 Jul 8 '17 at 13:39
6
\$\begingroup\$

Such chips don't exist because that wouldn't make any sense. To understand why, you need to know how SPI and CAN work.

In SPI, transmission is always started by an initiative from the master. In CAN, any node can start a transmission at any time, unless the bus is busy, in which case they will queue the message and send it the next time it wins a bus arbitration. SPI does not have the concept of bus arbitration.

In SPI, there is always a slave select signal, which can be used in multiple ways to determine which node(s) that listen. In CAN, every node always listens to every message and the decision if they should act on it or not is done by firmware, or by filters set through firmware.

SPI only allows 1:n communication with a master present. Slaves cannot speak directly to each other without the master initiating the communication, although they can transfer data between each other through a daisy-chain design. CAN works without the presence of a dedicated master, any node can speak to any other node.

SPI supports completely variable baudrates and much higher ones than CAN.

CAN has standardized data link layer frames with identifiers, CRC and end-of-frame fields etc. CAN controllers handle a lot of things automatically, that you would have to implement manually in SPI.

Etcetera etcetera.


So the chip you are looking for is a project-specific microcontroller, adapted to the particular needs of a certain product, for which you have to write custom firmware. Preferably, the MCU should have a CAN controller on-board. Pretty much every MCU on the market has SPI on-board.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Indeed, MCP2515 is not what you want. The purpose of this specific chip is to add a CAN interface to a microcontroller that doesn't have it. It is a slave SPI device, and it needs a master MCU to work with.

In fact, what you want doesn't exist as such. You could, however, implement it very easily with the tinyest microcontroller that has a CAN interface available. All manufacturers offer some. I could suggest PIC18F25K80 from microchip, STM8AF5268 from ST, ... But you'll have to develop the firmware. It would be a very simple firmware, but if you never worked with microcontrollers yet, you'll have a few things to learn.

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Writing a CAN driver is never "very easy". A lot of things to consider, most notably how to configure the sample point and bit timing, for every supported baudrate. If the MCU manufacturer provides a pre-made driver, then great. But I'd double-check that the person who wrote it had a clue. That is, does it conform to the recommended sample point requirements of CANopen DS301 or does it use some home-brewn sample point obtained through black magic. \$\endgroup\$ – Lundin Dec 1 '16 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.