6.3.1 Hall ISR
Each Hall sensor is connected to a digital pin of the MCU in which
Interrupt-on-Change (IOC) is enabled. If a Hall transition, either a falling or rising
edge is detected, Hall ISR is called. The Hall state is represented by a 3-bit Logic
state which provides the current sector location. During start-up, the trapezoidal
function is set as Hall ISR in which the six-step commutation is executed. When a
mechanical revolution is completed, the Hall ISR is replaced with the sinusoidal
function.
(uint8_t) ((PORTC >> 4) & 0x07)
is used since all
Hall pins are located in the PORTC register. The DMA source address that will be set is
based on the currentSector0
. Using the SetDMA()
subroutine, the source addresses of each DMA channel is pointed to a different set of
sinusoidal data, depending on the detected location. Each PWM module is configured with
an individual transfer, utilizing three DMA channels. The DMASELECT register should be
set before configuring an individual channel. Figure 6-4 shows the
CheckSector()
subroutine that is used in Hall ISR to configure the
DMA channels.Hall B is also used to identify the reference speed for the motor angular position. Each time a Hall B positive edge transition is detected, the value of the TMR3 period is copied to the CCP compare value and reloads all timers used in motor angular position.