CAN communications

I am working on implementing CAN communication on the 20260 and dev board. I have connected CAN 1 to an instrument communicating by CAN. This is a scope trace between ground and H. I am running the sample program in the CAN tutorial. I changed the program to continuously send a CAN message. The trace shows no activity, just noise:

Compare that with the same program on my existing UC5550 system that communicates correctly.to the same instrument

What do I need to do to make it work?

Do you have termination resistor somewhere? The dev board as 120 ohm but it is not connected by default. There is a jumper next to it called TERM.

Our board has a jumper too. I dont think it is connected. I’ll play with that

Did you notice that the pin are not labeled correctly?
I had to check the transceiver pins to figure it out.
There was a note in another post.

Oh yes one of the boards have the pins labeled incorrectly. Forgot which one.

I did swap H and L with no change in outcome. What should the labeling be ?

I think the whole connector is mirrored. You can measure ground to be 100% sure.

high and gnd are swapped.

I made the connection changes. H and Gnd. The scope shows good signals. However, once I call can.WriteMessage(message); it looks like it continues to transmit the message continuously. If I disconnect the destination receiver (still have 120 ohm resistor) I still see the the message continuously transmitted.
I assume that the CAN driver for 2.00 is essentially the same as the 1.00 version. I have CAN communications working fine on the UC5550. Suggestions ?

That to good. These are error frames and bus off

You have the wrong bit timing

I adjusted the bit timing to the values in the CAN tutorial timing table. It does work. The question is that I used the bit timing parameters from the CAN method used on my UC5550:

        var propagation = 0;
        var phase1 = 7;
        var phase2 = 8;
        var baudratePrescaler = 27;
        var synchronizationJumpWidth = 1;
        var useMultiBitSampling = false;

(propagationPhase1 = propagation + Phase1)

Why is there a difference between uc5550 (TinyCLR 1.0) and sc20260 (TinyCLR 2.0) ?

5550 is wrong maybe?

The SourceClock different, I beleive.

Also, TinyCLR 2.0, there is no longer ‘propagation’. It is “propagationPhase1” which is (propagation + phase1)

Aha, yes the source clock!

I am able to communicate with the instrument. The instrument that I am talking to acts as a server. It does not send any un-solicited messages. Some of the commands I send result in a string longer than 8 bytes and therefore I received multiple CAN messages with ascending arbIDs. On responses that result in more than 2 messages (>16 bytes of data) I do not get an event for the last message. Anything I can do to remedy this ??

What your device does outside CAN is just confusing here so lets put this info aside please.

Are you saying your device sends 2 messages but you only receive one on SITCore? Which board? What bit-rate? Did you subscribe to error events?

I am using SC20260D with Dev board. 125K baud, prescaler = 24, propagationphase1 = 13, phase2 = 2. Subscribed to MessageReceived and ErrorReceived. When the device sends 1 or 2 messages, every one gets MessageReceived event. When I am expecting 3 or more, I get a MessageReceived event for all but the last one. ErrorReceived event never happens. (works OK on 5550)

Ok now I understand. @Dat_Tran can you try 3 messages?

Hello, how do I reproduce the issue?
Your timing 125K is good. But I couldn’t reproduce the issue. As below I got all 3 messages with different id, raw data just fine.

msg 4,5,6,7th… still good.