CAN bus with NXP TJF1051/3 tranceiver?

Hi,

I am currently migrating from a G120 board to SC20260N board with the production release v2.0.0.8000. So far so good until now. The CAN communication does not work unfortunately. As soon as the code tries to send a CAN message, it immediately throws an exception error “CLR_E_TIMEOUT” as if nothing is on the other side.

I am hoping someone can point me in the right direction or has more in depth knoweldge of CAN bus communication with different CAN tranceivers.

In short, in an attempt to be able to switch between communication protocols through software, we tried to apply a RS485 tranceiver and a CAN bus tranceiver switched by driving pads of the SC20260 high or low. We choose a TJF1051/3 from NXP as the CAN tranceiver for its silent mode and VIO capability. The hardware designers are now double checking the circuit, but I just wanted to check with this forum if this idea is viable.

I have tried the exact same CAN example code on the development board and it works, however this uses the more conventional SN65HVD230D tranceiver. Does someone know if the NXP TJF1051/3 is not supported and this is a bad idea, or could it work with an another approach?

Any help would be greatly appreciated. Thanks in advance.

Remco

I have a screenprint of the circuit:

image

I have removed the resistors to be sure to isolate the RS485 chip.

Can you post your CAN code?

Are you pulling the S pin low when trying to send a CAN message?

1 Like

Hi Luca, to be sure I drive both outputs low:

using System;
using System.Collections;
using System.Text;
using System.Threading;
using System.Diagnostics;
using GHIElectronics.TinyCLR.Native;
using GHIElectronics.TinyCLR.Pins;
using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Devices.Can;
namespace Canbus_test_SCU
 {
 class Program
 {
    static void Main()
    {
        var gpioController = GpioController.GetDefault();

        //Disable modbus tranceiver
        var modbusTranceiver = gpioController.OpenPin(GHIElectronics.TinyCLR.Pins.SC20260.GpioPin.PH4);
        modbusTranceiver.SetDriveMode(GpioPinDriveMode.Output);
        modbusTranceiver.Write(GpioPinValue.Low);

        //Enable CAN bus tranceiver
        //A HIGH level on pin S selects Silent mode. In Silent mode the transmitter is disabled,
        //releasing the bus pins to recessive state.All other IC functions, including the receiver,
        //continue to operate as in Normal mode. Silent mode can be used to prevent a faulty CAN
        //controller from disrupting all network communications.

        var canTranceiverSilentMode = gpioController.OpenPin(GHIElectronics.TinyCLR.Pins.SC20260.GpioPin.PK1);
        canTranceiverSilentMode.SetDriveMode(GpioPinDriveMode.Output);
        canTranceiverSilentMode.Write(GpioPinValue.Low);

        //Testing green indicator
        var greenLED1 = gpioController.OpenPin(GHIElectronics.TinyCLR.Pins.SC20260.GpioPin.PJ4);
        greenLED1.SetDriveMode(GpioPinDriveMode.Output);

        var can = CanController.FromName(SC20260.CanBus.Can1);

        //CAN conventional begin
        var propagationPhase1 = 13;
        var phase2 = 2;
        var baudratePrescaler = 6;
        var synchronizationJumpWidth = 1;
        var useMultiBitSampling = false;

        can.SetNominalBitTiming(new CanBitTiming(propagationPhase1, phase2, baudratePrescaler,
            synchronizationJumpWidth, useMultiBitSampling));

        var message = new CanMessage()
        {
            Data = new byte[] { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2E, 0x20, 0x20 },
            ArbitrationId = 0x11,
            Length = 6,
            RemoteTransmissionRequest = false,
            ExtendedId = false,
            FdCan = false,
            BitRateSwitch = false
        };

        // CAN conventional end


       

        can.MessageReceived += Can_MessageReceived;
        can.ErrorReceived += Can_ErrorReceived;

        can.Enable();
        while (true)
        {
            Thread.Sleep(500);
            greenLED1.Write(GpioPinValue.High);

            can.WriteMessage(message);

            Thread.Sleep(500);
            greenLED1.Write(GpioPinValue.Low);
        }

    }
    private static void Can_MessageReceived(CanController sender,
        MessageReceivedEventArgs e)
    {

        sender.ReadMessage(out var message);

        Debug.WriteLine("Arbitration ID: 0x" + message.ArbitrationId.ToString("X8"));
        //displayController.DrawString("\n");
        //displayController.DrawString("\n");
        //displayController.DrawString("Arbitration ID: 0x" + message.ArbitrationId.ToString("X8"));            
        Debug.WriteLine("Is extended ID: " + message.ExtendedId.ToString());
        //displayController.DrawString("\n");
        //displayController.DrawString("Is extended ID: " + message.ExtendedId.ToString());
        Debug.WriteLine("Is remote transmission request: " + message.RemoteTransmissionRequest.ToString());
        //displayController.DrawString("\n");
        //displayController.DrawString("Is remote transmission request: " + message.RemoteTransmissionRequest.ToString());
        Debug.WriteLine("Time stamp: " + message.Timestamp.ToString());
        //displayController.DrawString("\n");
        //displayController.DrawString("Time stamp: " + message.Timestamp.ToString());

        var data = "";
        for (var i = 0; i < message.Length; i++) data += Convert.ToChar(message.Data[i]);

        Debug.WriteLine("Data: " + data);
        //displayController.DrawString("\n");
        //displayController.DrawString("Data: " + data.ToString());

    }

    private static void Can_ErrorReceived(CanController sender, ErrorReceivedEventArgs e)
        => Debug.WriteLine("Error " + e.ToString());
}

}

The display stuff is when I use it with the developement board, after a few cycles it times out and the controller stops.

When I use it with the development board, my can bus interface is receiving messages:

image

and can also send messages to the SC20260. When I try to send messages to the PCB with NCP tranceiver, I get a shedload of acknowledgement errors.

Is it 500Kbs?

1 Like

Do you have some of those SN65HVD230D on hand?

I looked at both of the datasheets and they seem to be pin and footprint compatible enough so you can replace the NXP one with the TI and see if that fixes the problem. It would atleast narrow down the problem

1 Like

Hi,

yes, it is 500kbps, the usb can interface is also autodetect.

I have the SN65HVD230D on hand and this is my next step, but this takes is a liitle more skill and time. But from the specs, the NXP should be possible to work with the SC20260N right?

I do not see why not. Check What voltages your transceiver expects on source and the logic levels.

1 Like

I scanned the datasheet for the CPU but could find no reference for 5V tolerance on the CAN RX line. The TX should work fine at 3.3V but wondering if the 5V from the RX is an issue if the CAN RX is not 5V tolerant.

1 Like

The NXP has a Vio input that is connected to 3V3. If I understood it’s datasheet correctly it is using that 3V3 as a voltage to communicate with the CPU.

1 Like

I must read the schematic better next time. Didn’t spot that.

2 Likes

Ok, thanks for your replies. From your replies I conclude the choosen tranceiver chip should work theoretically and there is nothing crazy about the design as far as the concept goes.

I will try to connect a SN65HVD230D in between to test the board itself, but I am sure this will work since on the development board the communication works.

Any tips how I could check a faulty circuit in current design?

Thanks,

Remco

You could also try to test your transceiver with this info. Maybe this specific transceiver IC that is placed is broken.

Have you tried replacing the current NXP with a NXP of the same kind?

1 Like

Thank you Luca, this was very helpful info! Now I am a little emberrased that I did not check the CAN hi/low voltages…I am still a beginner on the hardware/electronics side.

No voltage whatsoever, so this is probably an electrical/PCB problem. This will give me some support in proving that the software is at least working, likely a faulty tranceiver or design error.

Thanks again all for helping me with this!

Remco

Absolutely no problem. Most of us are here to learn and you have to start somewhere!

By looking at your schematics, I don’t think it’s a design error but I don’t have experience with this specific transceiver IC so I can’t say for certain.

Do you measure anything on the 5v input of the ic? Also, you should check if your transceiver is soldered properly.

You can do this hy taking a small metal pin and push against the each pin one by one. If they wiggle, they aren’t soldered properly and need to be touched up.

@Remco Can you confirm you have fixed the problem?

It would be great if you could post your final solution, so others that find this thread will be able to fix their problems as well :slight_smile:

2 Likes

Hi Luca, no not yet. A hardware engineer is looking into it as I write this.

Could it be that the NXP TJ uses slightly different CAN timing settings which I need to configure? If I test them on the development board I can set the baudrates to 50, 100, 125 resp. no problem:

Anyway, someone is investigating with scope attached etc. so hopefully we can pinpoint the problem. As soon as it is fixed, I will post the solution here.

Thanks Remco

1 Like

This is what was measured on the CAN_TX1 with a scope:

After a few cycles, the controller gives up and reports the following error:

Exception Error

What is the frequency bandwidth of the scope?

The capture doesn’t look right for a CAN bus message. It may just be the polarity of the connection is wrong.

Some useful scope captures to compare with.

Are you using 29 bit or 11 bit?

Can you try to put jumper on “TERM” which is next to CAN chip?

I am not sure what you mean with “TERM”, are you referring to my schematic? If so, I have hunch you are referring to the J6 jumper in series with 120 ohm termination resistor. We have already put this jumper to make sure there is 60 ohm in total over the CAN bus.