Figure 8-20 shows the single shunt configuration signal chain.
Follow the steps below to modify phase current channels according to the hardware circuit.
- Add the corresponding macro definition __CURRENT_SINGLE_SHUNT into main.h file.
- Modify the ADC channels in gateDriver.h file according to your hardware design. Single shunt requires one ADC channel and two ADC MEM Index as it samples twice in one PWM period.
- Select ADC MEM0 Index of the other ADC instance as the interrupt trigger source. For example, if users use ADC1 for bus current sampling, then use ADC0 instance for interrupt trigger.
- If ADC1 interrupt is used, add macro FOC_ISR_ADC1 into gateDriver.h file.
- Initialize ADC Memory accordingly and set the ADC interrupt source in SysConfig. The ADC channel setting is optional as FOC application calls HAL_GD_ ConfigureCurrentChannels() to re-configure it.
- If ADC1 interrupt is used, switch Event Trigger for ADC0 and ADC1 in TIMA1.
Figure 8-21 shows an example of modifying ADC current channel mapping in Single Shunt Configuration.
Note: Migration for single shunt is not restricted to one certain pattern. Users should take care of the interrupt setting, including setting proper event trigger in Timer, and setting proper trigger mode and interrupt trigger in ADC to meet the requirements defined in Figure 8-20.