Teensy 4.1: How to check CAN is defective

Status
Not open for further replies.

jimmie

Well-known member
I have about 6 Teens 4.1, each installed in its custom board. I am using the FlexCanT4 library along with a CAN interface board.

I noticed that on 4 Teensy boards, the software is not reporting a connection on the CAN interface. I thought the CAN interface board may be defective, but swapping that board did not help.

Some of the Teensy 4.1 modules were bought from Amazon as I needed them quickly. Could it be that these boards are knockoffs? How can one check?

Is there a way to debug where the problem might be (on the Teensy or on CAN board) given that the software is definitely working?
 
what does the "interface board" look like? There must be 2 active nodes on the bus for it to work properly. Is everything wired properly?
 
Thank you @tonton. I attached the wiring diagram.

I believe that everything is wired correctly because two of the boards work. BTW, I have tried with, and without the 60 Ohm resistor but it still did not work.

How does one check if the CAN circuitry on the Teensy is working? I also suspect the CAN transceiver module could be bad so I tried another one but it did not fix the problem. Is there a way to check the correct functioning of the CAN side of the Teensy and also the Transceiver module?

It could still be that transceiver so I bought another one which is on its way.

Thanks again in advance for your time.
 

Attachments

  • CAN Circuit.jpg
    CAN Circuit.jpg
    46.3 KB · Views: 54
You may want to replace the termination resistor by a 120Ω resistor, according to the CAN-bus spec.

EDIT: better yet, completely remove the 60Ω resistor as that CAN module already has a 120Ω onboard [R2].

Paul
 
Thank you @PaulS but I have already tried that but it did not work.

Also, two of the boards are working and that is why I am wondering if this problem that only affects some boards is related to a defect on the Teensy or the transceiver.
 
I am using 500

When I first tried this a few months ago, it worked up to 250 but did not work at faster speeds. I wrote to the forum and you helped me fix it at the time by telling me to add the resistor which did fix the problem. I made a second board and everything worked until recently when I made five more boards. That is when the problem occurred.

This is why I am thinking it may be related to a bad batch (Transceiver) or potentially receiving knockoff Teensys from Amazon. Hence the reason I was asking with my limited knowledge in electronics if there is a why to test each?

I wanted to add that I also tried 250 but still, no response from the Teensy.
 
For the sensor to work in my application, it requires a minimum bitrate of 500.

Here are the set up statements and the full code is also attached.

Code:
  can1.begin();
  can1.setClock(CLK_60MHz);
  can1.setBaudRate(500000);
  msg2.flags.extended = 0;

What is puzzling to me is why it has been working on some boards and not on others? I am using the same versions of Teensyduino and FlexCAN.
 

Attachments

  • getSN.ino
    2.8 KB · Views: 52
two of the boards are working
If I understand correctly, there are 3 boards [a Teensy 4.1, a custom board & a CAN interface board] and a CAN-based sensor.
Did you try swapping all 3 boards, board by board, to see which combinations work and which do not?
Can you share a photo of your setup?

Paul
 
Yes, the Teensy is placed on a custom carrier board which also has the CAN transceiver pictured above. The CAN sensor connects to that carrier board.

I have already tried swapping Teensys and the Transceiver board but no luck. That is why I was asking if there are tests (using a voltmeter or common device) to check the correct functioning of the CAN-related pins?
 
Things to check:
- visual inspection of all the solder joints/connectors/pins/wiring,
- check for power supply voltages present on all the parts,
- check signal waveforms with an oscilloscope,
- etc.

What does the serial monitor show with a non-working board combination? You could sprinkle some additional Serial.print()s in your code to see where the code actaully fails.

BTW: you are discussing this problem also on Github?

Paul
 
Thanks @PaulS. I checked all.

The only thing I did not check is the waveforms because even though I have a scope, knowledge of electronics is limited so I would not know what to look for!

The Gitbub list you sent was a thread that I started myself on May 7th :).
 
Good to hear that you found the culprit.
Well, guess I was lucky then since I've used 5+ of those cheapo boards without a problem...
And yes, I have 2 Waveshare boards too and they perform indeed reliably.

Paul
 
Well, guess I was lucky then since I've used 5+ of those cheapo boards without a problem...
And yes, I have 2 Waveshare boards too and they perform indeed reliably.

Paul

What threw me off was that two of those boards have been working well for months!

On closer inspection, those boards are very simple, containing a single IC and a few resistors. I am almost sure that the high variability in quality is due to using knockoff ICs.

I should have known that when a single board sometimes sells for over $6 in one place, and < $2 in another (both from China) that it is the IC quality that explains the difference. From now on, I will stick with Waveshare.

Thanks again for your help.
 
Your remark about knockoff ICs triggered me to have a closer look at both boards and especially the chip on it.
I did notice the font used for the chip marking on the Waveshare board is slightly different from the font on the cheapo boards...counterfeits maybe?

IMG_20211115_164417.jpg

Seems not uncommon: [url]https://www.youtube.com/watch?v=PR9pgjWre-Q[/URL]

Paul
 
These days the chance of getting genuine semiconductors if not going to a reputable electronics stockist are extremely low.
Counterfeits almost definitely.
 
Hello @PualS:

Because the Waveshare module does not fit my board, I bought 3 more of the other CAN module. All 3 boards did not work!

I would appreciate your help in explaining this observation:

1) With Waveshare module, voltage on both CRX1 and CTX1 is 3.2

2) When other module, voltage on RX is 3.2, voltage on TX is 0. When that module is not present, voltage on TX is 3.2, voltage on RX is 0.

What may be going on?

Thanks in advance.
 
Hello Jimmie,
Did you notice that the silkscreen text on the backside of the module is wrong? [at least, on the 5 cheapo modules I have here].

CANmodule.jpg

Could it be that you hooked them up according to the pin names as indicated on the non-component side of the board?

Paul
 
Hello Jimmie,
Did some further testing on an actual Teensy 4.1 with a Waveshare and a cheapo CAN module. Using your exact code from message #9.

CAN waveshare.jpgCAN cheapo.jpg

Both seem to work OK when connected to the CAN analyzer.
I had the analyzer auto-answering a frame with ID 740 by returning a frame with ID 751.

CANanalyzer.png

Seems to be received OK by the Teensy 4.1 [except for the blocks returned by the char() function].

Arduino serial monitor.png


The voltages that you measured are apparently taken when no CAN device was attached. I'm not sure what to conclude from those voltage readings.

You may want to get rid of your custom board temporarily and make a basic setup using a breadboard like I did.

Paul
 
Yep, that's the analyzer I'm using. It has saved me a lot of time in different projects.

Paul
 
Status
Not open for further replies.
Back
Top