I am new in developing with Kinetis microcontrollers and MCUXpresso and would greatly appreciate if you could help me.
I am developing a motor controller to drive a PMSM. Due to the project tight schedule, I already designed a PCB based on FRDM-KV31F and FRDM-MC-LVPMSM boards and the first prototype batch is being produced by now. I am using the very same pins for the motor driver, hall sensor and current sensors, so I expect to use the driver example with just a few modifications to fit my needs.
Along with the motor driver and sensors as they are on freedom boards, I also included on my project 2 ADC single ended channels (for acceleration and brake analog signals) on port B1 and B2 and one differential ADC channel for a thermistor sensing on pins 16+17 (ADC1_D*1/ADC0_D*2). So here are my questions:
You may have realized there is an application note AN12374 that has most of what you need to get started.
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).