CAN Bus Limitations

Step1:

Try ENC since we didn’t want to change any thing in your code first.

But we did change IP config and MAC which didn’t work for us.

Step2:
Change to Ethernet

Step3:
Change to WiFi

Step4:
Try to read message in event

Step5:
Add reading temperature.

Only thing we are not sure is the Application server where read data from the socket. We don’t have it and we wrote it by self. If you have then you can send to us.

Also, the CAN application that we are using to send 1000msg/ second can make different. How do you send the message from the host?

I am using the program PacketSender to open a UDP socket on my pc.

Also, the CAN application that we are using to send 1000msg/ second can make different. How do you send the message from the host?

I am using a Teensy 4.1 with a ISO1050DUBR CAN Transceiver from TI.

My offer to hop on a zoom call still stands. I think this will make reproducing the issue a lot easier.

The CAN peripheral does not fully lock up. I can still send messages when the read part stops working.

Also, how would you measure the temperature from within the code?

static void ReadTemperatureSensor()
        {

            var adc3 = AdcController.FromName(SC20100.Adc.Controller3.Id);

            var Adc18 = adc3.OpenChannel(SC20100.Adc.Controller3.InternalTemperatureSensor);

            var regTS_CAL1 = (IntPtr)0x1FF1E820;
            var regTS_CAL2 = (IntPtr)0x1FF1E840;

            const uint PERIPH_BASE = 0x40000000;
            const uint D3_AHB1PERIPH_BASE = (PERIPH_BASE + 0x18020000);
            const uint ADC3_COMMON_BASE = (D3_AHB1PERIPH_BASE + 0x6300);

            var reTempetureWakup = (IntPtr)(ADC3_COMMON_BASE + 8);

            var reTempetureWakupValue = Marshal.ReadInt32(reTempetureWakup);

            reTempetureWakupValue |= (1 << 23);

            Marshal.WriteInt32(reTempetureWakup, reTempetureWakupValue);

            while (true)
            {
                var v = Adc18.ReadValue();

                var ts1 = Marshal.ReadInt32(regTS_CAL1);
                var ts2 = Marshal.ReadInt32(regTS_CAL2);

                var t1 = (110 - 30) * 1.0;
                var t2 = (ts2 - ts1) * 1.0;
                var t3 = (v - ts1) * 1.0;

                temperatureSensor = t1 / t2 * t3 + 30;

                Thread.Sleep(1000);
            }


        }

That returns a temperature of between 700 and 760 degrees. I’m assuming that’s incorrect since the CPU has not melted away yet.

Make sure ADC must be opened before the enabled temperature wake up sensor.

Doesnt this part of the code open the ADC?

var adc3 = AdcController.FromName(SC20100.Adc.Controller3.Id);
var Adc18 = adc3.OpenChannel(SC20100.Adc.Controller3.InternalTemperatureSensor);

I just replaced the SoC for a new one, that didnt fix it either. Just wanted to rule that out…

What hardware are you testing this on? I’m starting to suspect my ENC28J60 circuit to be at fault.

Do you have a schematic or reference design of the board you’re using to test so I can compare with my ENC28J60 circuit?

I used this:

Are you using a custom board?

Yes, my board is custom.

The reason I’m suspecting the ENC28J60 or something else network related to be at fault is because it works for 100% when I turn off this line of code:

sock.SendTo(data, endPoint);

Quick question, this line is commented out in my example program. Do you have it commented out as well during your testing? I’m expecting you don’t because as you said, you are receiving the packets but I just want to make sure.

Yes, we enabled that line.

Would it help if I ordered a dev board and the mikroe board you’re using?

Or do you think it would be better if I were to use the onboard PHY of the SC20100S? If so, is there any documentation on how to connect it, the correct impedance and what mag jack to use?

How easy were you able to reproduce ?

If 1-2 time in few hours then we will try more. But it happened every 500 messages easily then we are not on same page. If so then yes, you may need a dev board to see how different between yours and ours design.

I can reproduce this in a matter of seconds. It usually happens after 10 seconds of running the code.

What option would be best? The dev board or a board using the builtin PHY?

Are there any advantages over using a ENC over the builtin PHY?

Builtin PHY because 100Mbs. I think ENC is only 10Mbs.

Meaning CAN chip also different ?

Yes. The can chip is a ISO1500DUB by TI. I have used it for many years and never had issues with it.

Do you have documentation on what mag jack and impedance to use for the PHY?

Hi, how hard to you to get our SC20100S Dev board for testing the issue?

Just ordered a SC20100S dev board from Digi and a Mikroe ENC28 click to test it out. Should arrive in a few days, I will report back my findings afterwards.

2 Likes