You may have realized there is an application note AN12374 that has most of what you need to get started.
AN12374 - PMSM Field-Oriented Control on FRDM-KV31F with Hall and Encoder Sensors
I've attached the sw for the application note.
Below I shared with you a project for the high voltage kit with hall start, SW v3. I shared this with the intention of showing you how to add measuring of two auxiliary channels intended for temperature sensors or whatever.
Auxiliary channels are set in mcdrv_hvpkv31f120m.h header file: (ADC1_SE17)
/* Aux channel 1 is assigned to ADC1 only */
#define M1_ADC0_AUX1 (MCDRV_CHAN_OFF)
#define M1_ADC1_AUX1 (7)
/* Aux channel 2 is assigned to ADC1 only */
#define M1_ADC0_AUX2 (MCDRV_CHAN_OFF)
#define M1_ADC1_AUX2 (17)
Switching of measured AUX ADC channels is in function MCDRV_AuxChanAssign(…) in mcdrv_adc_adc16.h. Switching is executed on the base of toggling variable bAuxSampleActive after every reading of ADC result register R1 (RB).
