Hello Sudarshan,
A good starting points would be the SDK for the i.MXRT board you are using and it’s documentation. There are some examples that can be run to test the SPI module. You may download the SDK for your board on the link below or directly from within MCUXpresso IDE.
https://mcuxpresso.nxp.com/en/select
I hope that this information helps!
Regards,
Gustavo