Other Parts Discussed in Thread: TM4C1294NCPDT, , DRV8889-Q1
Hi.,
I am using TM4C1294NCPDT Microcontroller, and using DRV8711 for controlling stepper motor. We command the motor for moving one position to another position.In that 2nd position there is mechanical stopper for stop the motor. So i decided to create interrupt for STALL pin,whenever motor reaches the mechanical stopper,the STALL need tobe detected.But its not coming into the interrupt function.
Kindly check if i missing any initialization for STALL detection
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_7);
GPIOPadConfigSet(GPIO_PORTC_BASE, (GPIO_PIN_7), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIOIntRegister(GPIO_PORTC_BASE, Motor_GPIOIntHandler);
GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_7,GPIO_BOTH_EDGES);
GPIOIntEnable(GPIO_PORTC_BASE, GPIO_INT_PIN_7);
IntEnable(INT_GPIOC);
Interrupt Function:
void Motor_GPIOIntHandler (void)
{
GPIOIntClear(GPIO_PORTC_BASE,GPIO_PIN_7);
uint32_t ui32Stall;
ui32Stall = GPIOPinRead(GPIO_PORTC_BASE,GPIO_PIN_7);
// if(GPIOPinRead(GPIO_PORTC_BASE,GPIO_PIN_7))
if(((ui32Stall & GPIO_PIN_7)>>7))
{
Stall_Ctrl++;
if((Stall_Ctrl>0) && (STALL_Set_Flag==1))
{
Stall_Ctrl =0;
Motor.Stall = 0;
STALL_Set_Flag = false;
}
}
else
{
Motor.Stall = 1;
}
}
DRV Configuration:
Torque Register
Address = 0x01;
TORQUE = 0xB4;
SAMPLTH = 0x01;
STALL Register:
Address = 0x05;
SDTHR = 0xC8;
SDCNT = 0x02;
VDIV = 0x03;