Receiving multiple data on Can bus


first of all sorry for my bad english. (I’m italian)
I have a device that is sending data to a Photon on can bus. 5 data are sent at a frequency of 5Hz and another one at 50Hz,and each of them have a different id. There are no mask or filters.
The problem is that I receive always only one data with a certain id. The Canbus buffer is always full with only data with the same id.
The problem is not on the other device, because i tried it with a can bus shiled and arduino, and I’m able to receive all the different data.
I have to add cloud feature to my project, so I want to Buy an Electron, but before I have to know if this is a limitation of particle devices.

Have you got your code for us to look at?

here is it. has always the same value

CANChannel can(CAN_D1_D2);

void setup() 

void loop() 
    CANMessage message;
    if(can.available() > 0) 

Try changing this to


Unfortunatly the device is in car prototype at my university, so I have to wait for monday to try it.
how this code could solve my problem? It’s basically the same, and, at the speed I’m sending data, the can-bus buffer is always full, so I will never go out of the while loop.
I’ll try it anyway.

In that case you’d need to put a line with Particle.process() inside the loop, to make sure the cloud connection doesn’t drop out.
And maybe adding some timeout to forcefully drop out of the loop might be no bad idea either.
Or do this

    for (int msgCount = can.available(); msgCount > 0; msgCount--)

Another thing to test would be SYSTEM_MODE(MANUAL) to cut down the time between iterations of loop().
Also try explicitly clearing the message filters via can.clearFilters().

I tried all your suggestions but still have the same issue.
As I already said, data are properly sent form the sender device, because I’m able to read them with a CanBus shield and arduino.
I tried with particle electron, but had the same problem on both CanBus ports.
My circuit is made of two wires between the two devices, and a 120hom resistor across the two lines.


did you solve it? I have the same problem

No, unfortunately I didn’t solve.
Let me know if you’re luckier than me.

@Momy93 & @kam,

Are you trying to hook CAN_HI and CAN_LO signals directly to your Particle device? That will definitely not work. With something like that, be careful that the voltages do not exceed what the Particle GPIO pins are capable of handling; you do not want to damage a pin on your Particle device.

What is needed it to attach your particle CANbus pins to a CAN Transceiver chip something like this
D0 -> CAN_EN
D1 -> CAN_TX
D2 -> CAN_RX

The CAN Transceiver chip will then do the signal translations to get the CAN_HI and CAN_LO signals on the CANbus. One example of a CAN Transceiver chip that has been successfully used with Particle devices is the TJA1049 from NXP (check out for working examples; both the hardware and the firmware design are available on Github).

Thank you for your answer.

I think I solved problem. I used CAN transceiver mcp2551. I didn’t make common gorund between Particle and CAN transceiver, but I used external power from difrent microcontroller. MCP2551 is powered by 5V and particle has only 3v3. Now it is working as expected.

@kam, Good to know that transceiver also works.

If you power your Particle device by USB, which is 5V, then you can get 5V from the VIN pin.
Actually, if you use a good quality 5V power supply, you can power a Particle Photon at the VIN pin and power your MCP2551 and any other 5V sensors. That way you can use your other microcontroller for other projects.