Hello shudhamatinarhare,
I will strongly suggest using the drivers for each MCU to evade any type of compatibility issue but also it could be a problem in the software if you check the Cortex M4 manual it mentions:
The processor enters a lockup state if a fault occurs when executing the NMI or HardFault handlers.
So it also could be a conflict in the software but I will suggest trying changing the drivers first.
Best Regards,
Alexis Andalon