尊敬的各位TI专家,我最近在采用28379D开发板采集BISS-C绝对式编码器数据,DEBUG模式下程序运行正常,能正常采集数据,同时我设定了3周期函数也在运行,如下图所示:
烧写到FLASH后,3个周期函数在运行,但是采集编码器的程序运行不正常。biss_data_struct.dataReady一直为1,如下图所示。我通过示波器测量了ePWM4产生的时钟信号也不对,一直是高电平。
图中的q是我设的一个变量,在主循环里。通过主循环一直采数,程序如下:
while(1)
{
{
bissc_data_read();
q=q+1;
DeviceControl.position = bissc_data_struct.position*RES_32BIT;
q=q+1;
DeviceControl.position = bissc_data_struct.position*RES_32BIT;
}
void bissc_data_read(void)
{
#if BISS_ENCODER_HAS_CD_INTERFACE
//every so often, do a CD transaction
if(bissCDCounter < 0)
{
//for Lika HS58S18/I7, addr 0x7E (ManuID MSB) should contain 0x4C (CRC on packet should be 0xF)
bissc_data_struct.cd_register_xfer_address = 0x7E;
bissc_data_struct.cd_register_xfer_is_write = 0;
bissc_data_struct.cd_status = 0; //arm new
bissCDCounter = 1000;
}
else
{
bissCDCounter--;
}
#endif
{
#if BISS_ENCODER_HAS_CD_INTERFACE
//every so often, do a CD transaction
if(bissCDCounter < 0)
{
//for Lika HS58S18/I7, addr 0x7E (ManuID MSB) should contain 0x4C (CRC on packet should be 0xF)
bissc_data_struct.cd_register_xfer_address = 0x7E;
bissc_data_struct.cd_register_xfer_is_write = 0;
bissc_data_struct.cd_status = 0; //arm new
bissCDCounter = 1000;
}
else
{
bissCDCounter--;
}
#endif
// BISS_DATA_CLOCKS
// for Lika HS58S18/I7-P9-RM2 it is 34 ==> 32 (pos+E+W+posCRC) + CDS + Start
// for Kuebler 8.F5863.1426.C423 it is 36 ==> 34 (pos+E+W+posCRC) + CDS + Start
PM_bissc_setupNewSCDTransfer(BISS_DATA_CLOCKS, SPI_FIFO_WIDTH);
#if BISS_ENCODER_HAS_CD_INTERFACE
if(bissc_doCDTasks() == 0)
{
ESTOP0; //most likely the BiSS CD CRC did not match
}
#endif
if(bissc_doCDTasks() == 0)
{
ESTOP0; //most likely the BiSS CD CRC did not match
}
#endif
PM_bissc_startOperation();
while (bissc_data_struct.dataReady != 1) {}
// fill and receive SCD data (including position) and putting it into the BiSS data structure
if(bissc_receivePosition(BISS_POSITION_BITS, BISS_POSITION_CRC_BITS) == 0)
{
ESTOP0; //BiSS SCD CRC did not match
}
if(bissc_receivePosition(BISS_POSITION_BITS, BISS_POSITION_CRC_BITS) == 0)
{
ESTOP0; //BiSS SCD CRC did not match
}
DELAY_US(50L); //Delay 10ms
}
请问一下这个可能的原因是什么,谢谢!应该如何解决这个问题?