TI中文支持网
TI专业的中文技术问题搜集分享网站

F28027F串口SCI中断服务函数只调用了6次,之后就不再调用

中断服务函数:

interrupt void sciReceive(void)
{

controlRaw[indexRxRaw++] = SCI_read(halHandle->sciAHandle);
if(controlRaw[0] != SCI_START_BIT)
{
indexRxRaw = 0;
}
else if(indexRxRaw == 8)
{
int i = 0;
for(i=0;i<=7;i++)
{
controlPackage[i] = controlRaw[i];
}
indexRxRaw = 0;
flag_SciRxFinish = 1;
}
if(indexRxRaw >=8)
{
indexRxRaw=0;
}
SCI_clearRxFifoOvf(halHandle->sciAHandle);
SCI_clearRxFifoInt(halHandle->sciAHandle);
PIE_clearInt(halHandle->pieHandle, PIE_GroupNumber_9);
}

配置SCI函数:

void HAL_setupSciA(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;

GPIO_setPullUp(obj->gpioHandle, GPIO_Number_19, GPIO_PullUp_Enable);
GPIO_setPullUp(obj->gpioHandle, GPIO_Number_18, GPIO_PullUp_Disable);
GPIO_setQualification(obj->gpioHandle, GPIO_Number_19, GPIO_Qual_ASync);
GPIO_setMode(obj->gpioHandle, GPIO_Number_18, GPIO_18_Mode_SCITXDA);
GPIO_setMode(obj->gpioHandle, GPIO_Number_19, GPIO_19_Mode_SCIRXDA);

PIE_registerPieIntHandler(obj->pieHandle, PIE_GroupNumber_9, PIE_SubGroupNumber_1, (PIE_IntVec_t)&sciReceive);
PIE_enableInt(obj->pieHandle, PIE_GroupNumber_9, PIE_InterruptSource_SCIARX);
// PIE_enableInt(obj->pieHandle, PIE_GroupNumber_9, PIE_InterruptSource_SCIATX);

CPU_enableInt(obj->cpuHandle, CPU_IntNumber_9);

CLK_enableSciaClock(obj->clkHandle);

SCI_reset(obj->sciAHandle);
SCI_setMode(obj->sciAHandle,SCI_Mode_IdleLine);
SCI_setBaudRate(obj->sciAHandle, SCI_BaudRate_9_6_kBaud);
SCI_setCharLength(obj->sciAHandle,SCI_CharLength_8_Bits);
SCI_setNumStopBits(obj->sciAHandle,SCI_NumStopBits_One);
SCI_disableParity(obj->sciAHandle);

SCI_enableTx(obj->sciAHandle);
SCI_enableRx(obj->sciAHandle);
// SCI_enableTxInt(obj->sciAHandle);
SCI_enableRxInt(obj->sciAHandle);
SCI_disableLoopBack(obj->sciAHandle);
SCI_enable(obj->sciAHandle);

SCI_enableTxFifoEnh(obj->sciAHandle);
SCI_resetTxFifo(obj->sciAHandle);
SCI_clearTxFifoInt(obj->sciAHandle);
SCI_resetChannels(obj->sciAHandle);
// SCI_setTxFifoIntLevel(obj->sciAHandle, SCI_FifoLevel_Empty);

SCI_resetRxFifo(obj->sciAHandle);
SCI_clearRxFifoInt(obj->sciAHandle);
SCI_setRxFifoIntLevel(obj->sciAHandle, SCI_FifoLevel_1_Word);
SCI_enableRxFifoInt(obj->sciAHandle);
} // end of HAL_setupSciA() function

mangui zhang:

没看出有什么问题    如果测试发现规律   只能调用6次   

建议你查查哪里是否有对中断屏蔽的相关设置  

或者你下发的数据是否出现问题    

赞(0)
未经允许不得转载:TI中文支持网 » F28027F串口SCI中断服务函数只调用了6次,之后就不再调用
分享到: 更多 (0)