Hello @Leo017
Thanks for contacting us.
You can find the code in the SDK demo "mc_pmsm_enc".
Please download the SDK from https://mcuxpresso.nxp.com/select ,
select FRDM-MCXN947, and then proceed with the download. You will be able to find the demo this way.
On user guide UG10251:

After download SDK for MCUXpresso IDE:

BR
Alice