CAN-BUS shield "can´t init"

Hi all
I am trying to initiate the Sparkfun Redboard Plus with the Sparkfun CAN-Bus shield. Both stacked liked described on the Sparkfun homepage.
Tried out all libaries.
Resistors are on both sides.
What do I have to change in the libary or in the code to get it initiated?
I did it 1:1 like described on the homepage.
BR Fabian

You shouldn’t need to change anything, can you supply pics of the bottom of your board and how you have things assembled?

Sure, I will do this afternoon. I have seen an article where someone was saying, there are two versions and this creates differences in the mappings of pins.

1 Like

Hi @YellowDog
enclosed the picture :slight_smile:

You have v13 which is the version used in our guide/current version :smiley: The 2 ‘versions’ are the jumper configurations for the board (see section 6c here) that allow users to switch from CAN to ODB-II mode if desired. If you want to a deeper dive the schematic makes it pretty clear

How far are you getting? It might be worth sharing a photo of what your IDE/output looks like

The soldering looks good, but I do see what is probably flux residue in quite a few areas that might help to clean up a bit, particularly the upper right corner of the photo (the shiny spot) and the white-ish residue surrounding most pins

It’s a long shot but i agree with Russell on the flux. That can sometimes cause the type of problem you’re having. Get that cleaned off and make sure the board is totally dry and give it another try.

Hi all,
so I cleaned up all. Looks good now.
Also I tried again several codes without any success.
Any ideas how to tackle this?
My next step would be to use an oscilloscope and read out directly.
I will provide some screenshots from the codes and the serial output.
Thanks Fabian

Hi All
tested quite a lot. Signals are coming (I have measured it with an Osciloscope).
But still no init on the CAN itself.

The code is the example from:

I have tested about 20 times…no clue about the CAN itself.
Enclosed a picture from the CAN:
Send the picture later…

So there is coming something out. But I do not know why the shield is not running.
Maybe you have an idea?

Thanks a lot,
BR Fabian

et voila, the picture

Tested this one quite often…not working. Does not matter if BAUDRATE, CAN 2a / b, 16 or 8 MHz (Board should be 16 MHz). Tried all…

This example is from mcp_can the Example CAN_receive

Digging into the library, it looks like the only way the initialization fails is if the CNF1 register of the MCP2515 doesn’t read back the proper baud rate prescaler value (the speed variable you pass to the init function). This seems like an SPI issue, so I’d recommend probing the CS (D10), MOSI (D11), MISO (D12), and SCK (D13) pins and make sure you’re seeing the right signals there.

You could also write a test sketch that uses SPI to read all the control registers from the MCP2515 to make sure they read back their reset values as specified in Table 11-2 of the datasheet. If you get all zeros that will be a red flag.

If you make it past any SPI issues, the next thing I’d recommend is putting the MCP2515 into loopback mode (see the datasheet). This will let you take the CAN bus out of the loop and make sure the controller is operating as expected when you send a message. This will also give you an opportunity to test out message filtering and ensure that’s not getting in the way.

These steps will help you isolate the issue and identify what part of your setup needs attention. Let me know if you have any questions about my recommendations above. Good luck!

1 Like

Let me know if you do find any issues when performing the above tests (as suggested by mdancer) - if those are wonky it’s likely a DoA unit

Hi all,
problem solved. The saprkfun redboard plus has a switch, 3.3V to 5V. I switched to 5V and changed the delay in the libary from 10 to 100 us.
MCP_CAN libary, the file:
mcp2515.c → here change
// wait a little bit until the MCP2515 has restarted
*** _delay_us(10);***

to new 100
Thats it.
Thanks a lot

1 Like

Ah, good catch!