What is a crystal oscillator basically https://en.wikipedia.org/wiki/Crystal_oscillator? It is a piezoelectric crystal, which is electrically caused to swing. When they get mechanically stressed, they can break or may have a loose connection!
I think the oscillator on your Waveshare board just starts to swing sometimes. So it could be caused by one of the reasons I described above. Good luck.
By the way, why do you want to do the “main.c” change?
My story is simple, I brought a 2 boards on local market for make usb adxl345 on my own, for my TT Sapphire SP-5 because wires is too long. This is be in an end on 2024. But none board can boot compiled code. It`s just boots from time to time(hard to boot). But with example of neopixel code what is firmwared by default in it its works good, without a problems.
I read tons of info about problem, all says problems in a pico-sdk sources in a klipper src folder. Some says u need to change to generic_03h but nothing helps. 2 years and some of my rp2040 works, some didnt, it doesn’t matter what I did with them, troubles only went when i use klipper on it. From time to time, whose who works, 1 fail from 30-40 starts. As i understand, i dont have any Original RP2040 boards, all whey clones from other manufacturers.
But tomorrow i found a fix on 3dmellow in its official docs. And just repost it here. The remaining issues were fixed over these 2 years. After what change boards boot every time.
I don’t really understand those 4 sentences.
Did you fix your booting problem? If yes, how did you fix it on which RP2040 clone boards? Can you explain more detailed? It might help others trying to get CAN running on RP2040 clone boards!