Feather M4 CAN stops sending messages

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JanZ1961
 
Posts: 11
Joined: Thu Apr 20, 2023 11:10 am

Feather M4 CAN stops sending messages

Post by JanZ1961 »

Hello all,

I have no high hopes vfor a solution and even less so that I will have a fix before Friday (when I had planned to first actually do a life test), but I'll ask this anyway in case it is a known (to the rest of the world, but not to me) issue.

I have a motorbike were I do data logging. For several reasons, I decided to use CAN bus as the backbone. I 'have created two boxes that collect data from various resources and create CAN messages to be logged or displayed on my CAN datalogger/display. In the development&test phase I have destroyed a few Feathers, but in at least one case I couldn't explain what happened.

It worked on my desk and then after putting everything neatly in an enclosure, everything still seemed to work (according to the logging), only no CAN messages were sent.

I thought maybe I made another mistake, so I started over and until yesterday everything was perfect. The data appeared on my display and changed as expected.

But today, when I switched the electronics on suddenly no CAN messages were sent by my two Feather based nodes. Apart from my two Feather based nodes, there is a third one that supplies GPS data. That one still works.

I log all CAN messages to Serial before they are sent and this still happens. But no packages appear. I even checked with my scope (I have a PicoScope that can do CAN decoding) and I only see the messages from the GPS node. Nothing has changed since the time that it worked.

So, the question is: does this sound familiar. I mean, I'm happy with any help but this is not a case of "Help! It doesn't work, what am I doing wrong". It worked two days ago and nothing has changed in the meantime.

But I'm desperate, so I may try even the weirdest suggestions :-)

User avatar
mkiehl
 
Posts: 23
Joined: Mon Oct 08, 2012 1:03 pm

Re: Feather M4 CAN stops sending messages

Post by mkiehl »

A wiring schematic and code would help us to help you.

Make sure you turn on both the transceiver and booster, and set the correct pins. The tutorial has an incorrect reference to pin 4 rather than 41. Make sure the CAN bus wires are properly terminated with 120 ohm resistors. The Feather M4 CAN has them built-in and enabled by default.

If you have serial enabled with:

Serial.begin(115200);

Then the unit will wait until the serial monitor is run. I create a constant called 'DEBUG' and set it to true/false, and then wrap all serial output with checks to see if it is true. Example:

#define DEBUG true
void setup() {
#if DEBUG
Serial.begin(115200);
#endif

// turn on both the transceiver and booster:
pinMode(PIN_CAN_STANDBY, OUTPUT); // pin #40
digitalWrite(PIN_CAN_STANDBY, false); // turn off STANDBY
pinMode(PIN_CAN_BOOSTEN, OUTPUT); // #41
digitalWrite(PIN_CAN_BOOSTEN, true); // turn on booster

#if DEBUG
Serial.println("Setup complete");
#endif
}

User avatar
JanZ1961
 
Posts: 11
Joined: Thu Apr 20, 2023 11:10 am

Re: Feather M4 CAN stops sending messages

Post by JanZ1961 »

I will check my code against your suggestions, but I don't hold high hopes because ... it worked. And overnight it stopped working. No changes in between. So it is unlikely an error in the code. But you never know.

But thanks anyway. I like any help I get.

User avatar
JanZ1961
 
Posts: 11
Joined: Thu Apr 20, 2023 11:10 am

Re: Feather M4 CAN stops sending messages

Post by JanZ1961 »

I'd be happy to send schematics, but that won't help much. It is pretty straightforward. There are a few inputs (analog and i2c). And these work. And still work because the logging still works. So, I can see that the values from the sensors are put in a CAN message and that this message is sent. Only it isn't. Not anymore. This happened three times now. The first time could have been my mistake. The second case, this was a bit unlikely, but not impossible, Everything was working, until I put everything neatly in an enclosure.

The third time there can have been no mistake. I had been testing everything in situ and it worked. The next day when I wanted to show someone how nice it finally worked, it didn't. Nothing happened in between. According to the log everything was normal, but no CAN bus messages were sent.

I'm pretty sure If I bought two new ones, it will work again. Only to stop again after a few tests. Including two that I really destroyed myself, the current count of dead Featers is six. The last four not really dead, only not sending CAN Messages.

Since the CAN connections are separated from the others, the only thing that could theoretically happen is that the 12V that is running through the same cable as de CAN signals, would connect to one of the CAN lines. I have triple checked this and also: why would the other devices on the bus have no problems whatsoever. I think the 12V on a CAN line wouldn't even be a problem because they have a high impedance.

On a side note, and I hop Adafruit is reading this: for a CAN device you can expect it to be used in an automotive environment. Knowing this, there are a few design decisions I don't understand. Why no built-in power circuit so you can connect it safely to a car battery. Also the 3.3V logic is a pain. In cars and bikes , if it is not 12V, it will be 5V. As it is, I need to convert every sensor input. So if ever Adafruit decides to create a successor, I would look into this.

User avatar
JanZ1961
 
Posts: 11
Joined: Thu Apr 20, 2023 11:10 am

Re: Feather M4 CAN stops sending messages

Post by JanZ1961 »

I forgot about the code. I could send it, but after my program stopped sending CAN messages, I have used the 'Hello world' sample from the AdaFruit website to test the board. So it can't be the program.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”