Then, first of all, you should check where you have modified.
----
You said: your program went into a loop during your CAN initialization code.
If CAN initialization code is on the correct execution path, you should check loop-exit condition.
If not, check SYS/USR/SVC/IRQ/FIQ stacks (especially IRQ stack).
Do you allocate enough size of stacks and initialize these stack pointers?
Regards,