First of all I have to say that I'm also relatively new to electronics (e.g. today I used an oscilloscope for the first time ;) ) - so please don't bash me, if I'm asking stupid questions. :P

I have the following problem:

I'm trying to use an ATmega32U4 in combination with a MCP2515.
I have burned the Arduino Leonardo bootloader onto it and set the fuses to LFuse: 0xBF, HFuse: 0xD0 EFuse: 0xCB. So the clock should be outputted at pin PC7. I've connected PC7 to pin 'OSC1' (pin 8) at the MCP2515.
The SPI bus is also connected properly.
I have changed the SPI lines at the library to:

#define P_MOSI B,2

#define P_MISO B,3

#define P_SCK B,1

//#define MCP2515_CS D,3 // Rev A

#define MCP2515_CS B,0 // Rev B

#define MCP2515_INT E,6

#define LED2_HIGH B,5

#define LED2_LOW B,5

If I try to initialize the CAN Bus, I get an error "CAN Init error".

So I guessed that the Clock Output is faulty.

I have connected an oscilloscope to the OSC1 pin and got the following graph.

Is it normal, that the clock output looks like this?

To make comparisons I've also checked the 16MHz Crystal. This wave looks better for me.

So am I right, that there is a problem with the CKOUT and if so, what can I do? ;)

I thank you very much for your help and hope you can understand me because English isn't my native language.

Well, I had a quick and superficial look at 2515 datasheet : OSC1 -pin 8 - has a rather high noise immunity see table 13.1, p70.

What might make signal strange can be : weird PCB/ wires, with stray capacitances /inductance; way the oscilloscope is connected; oscilloscope used on the limits of its frequency range...

Thus, as kiObk asked, a picture (a "smart" "phone" can be very easy to use : import the picture(s) into your PC, then grab and drop) can be used to detect non standard/faulty wiring.

A schematics (can be drawn with a pen and sheet of paper; if you do not have an existing schematics, you can deduce it from your physical layout -a way of detecting horrors, if any-) can be very useful (one needs the schematics as they are, not as they should be).

I might add to kiObk question whether you have already written some software (if someting is very wrong, people protest...)

There is another thing which bothers me : from chpter 8.2, page 53 , there is a clockout pin (3) and should be 2 Mhz at init. Did your oscilloscope look at it?

All four probes had been calibrated before use and all show the same graph.
Why should there be only a measurement error at this specific trace? The graph of the crystal is a nice sine wave. Shouldn't it be also faulty if there would be a problem with the probes?

The setup is the following:

The components are situated on a printed PCB. The PCB has a connector and the wires of the connector are connected to a power supply (12V) via alligator clips. The alligator clip of the probe is connected to the power supply's alligator clip (GND).

If scope is not faulty, perhaps there are issues with PCB: you should show the hardware as it is.

If noise /harmonics immunity is enough, at reset (at least, if I understood application note), pin 3 should show a 2 Mhz (16/8) signal...

This is the PCB. https://1drv.ms/u/s!Aji7fRe9Qkh2...
I had to cut two traces (CS and MISO) and swap them, because I had mixed them up. Of course I noticed the mistake only when the PCB was produced - I'm a genius I know. :D :P
The second cable is at the top side of the PCB. (There aren't any components).

You can't use just any GND connection when looking at signals in the MHz range, and expect to see good signals.

Which GND connection do I have to use? I thought the GND clip of the power supply would be ok because the complete PCB has only one ground plane.

It's universally usable. I used CAN Shields and the ATmega328p before (for house automation, cars and so on). I wanted to exchange the 328p to get everything smaller (with built-in USB) - and here we are. :D

Scrape a bit of the solder mask off and solder a short 1cm wire 'tail' (ie resistor leg offcut) onto the ground plane. Use that for your scope probe ground connection.

See #2 in my signature.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

Scrape a bit of the solder mask off and solder a short 1cm wire 'tail' (ie resistor leg offcut) onto the ground plane. Use that for your scope probe ground connection.

See #2 in my signature.

I think I have good news. I did it as you described. (I could use an SMD pad instead of scraping of soldermask)

The graphs aren't perfect but it looks more like a square wave - so I think @dbrion0606 is right and the CKOUT isn't the problem.

I will upload schematics and so on tomorrow. The Siglent also has a decoder function, so maybe I can decode the SPI bus - even if I don't know until now how to securely connect four probes at the same time. :D

You still have not said what you have attached. If a fly wi9re -- of course you are going to get ringing; echo from the far end.

What do you get when you drive a high-impedance load? It probably looks pretty clean. Now, you have calibrated probes, you said, but you could try playing with the screw--I'll bet the result will change some.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

The second trace in #13 is about what I would expect with a low(er) cost scope and a low performance "probe" (though the sample rate is plenty fast). Bet you those spikes are not really (overshoot) spikes but related to the propagation time of the probe. A typical probe of this kind consists of a piece of coax with a BNC connector on one end and two alligator clips on the other. You can also get this behavior with a 10X probe that uses ordinary coax. A 10X probe with a long ground lead from the back end of the probe makes this even worse. Good HiZ probes use coax with a special resistive center conductor to spoil this behavior.

As a general statement, good analog scope measurements with signals faster than, say,10-15ns (rise/fall times), is plenty challenging, even with excellent equipment. I can remember when 100MHz bandwidth (3.3ns rise/fall time) was a huge technical hurdle. And, probes that would handle those speeds were virtually non-existent.

I did it as @Brian Fairchild said: 'solder a short 1cm wire 'tail' (ie resistor leg offcut)'. There I connected the GND clip of the probe.

The probes are Siglent PP510. Today I removed the GND clip and replaced it with a 'Ground spring' which was included in the package. The description says: 'Provides shorter grounding path for better signal integrity'. So I pushed this spring onto the GND-pin of the MCP2515. The results look better for me. So I would say, the CKOUT isn't the problem. I think the SPI is the problem.

The *.h file has anything necessary for the caller program to compile. There is a *.cpp (google led me to) or a *.c file, with the same name, which countains c(++) and in which I intend to put debugging instructions.

In your case, it is a *.c -> cannot use Serial.print to debug (could find the 1rst place, in line 175 where an error could be detected and a message would be interested). According to Murphys law, seems worse than I feared : needs some program manipulations, which add typos and horrors.

Remains SPI : can you display as hexa what is on MOSI line / MISO line (that would be the best solution, if your scope is smart enough to function as a logic analyser: it would be wise to verify it can do it).

Else, if it cannot be used as a logic analyser : are there pulses on the CK line? MOSI line?

Can you manage with the trigger mode (natural trigger would be !CS; lines to check would be CK, then MOSI).

Edited : Google told me Siglent Siglent SDS1104X-E is a (very nice) *mixed signal* oscilloscope. I bet it can decode SPI ... and , once you know how to use it, you will think it is very useful.

"I had to cut two traces (CS and MISO) and swap them, because I had mixed them up. Of course I noticed the mistake only when the PCB was produced - " Just want to know wheteher you detected before power up?

Maybe I've found the problem! I've tested all connections again and I've found a problem with the soldered wires. One has a short circuit to GND. :/
I will rework them now and tell you the result.

Edit: What should I say... I uploaded my CAN sketch again and now the serial monitor shows "ok". :D

I don't know whether I should laugh or cry about it. :D

Nevertheless, I also uploaded your sketch, but I don't see any wave. :/

Maybe my soldered GND 'pin' isn't good enough and/or I still have to learn a lot. ;)

Does anyone have suggestions how to design future PCBs, so that the SPI can easily be tested? Holding four probes and do measurements at the same time sounds very tricky. ;)
Even connecting four GND clips doesn't sound so easy for me - all four won't fit onto a 1cm pin. There need to be a better solution. :)

draw the schematics from the existing PCB (the very tedious part) then look at the theoretical schematics. Are things as they should be?

I do not know whether OP PCB, once debugged, needs any check connection... (is SPI/ckout testing useful? are they the only pins to be exposed?). If it needs every pin to be exposed, it might become ... a new Arduino clone.