This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我在IDDKV2.2.1评估板上可以读到电机的编码器的位置信息,但是发现经常发生校验错误,这个有什么好的处理办法,谢谢?
I can read the position information of the motor encoder on the IDDKV2.2.1 evaluation board, but I find that check errors often occur. Is there any good way to deal with this ?
Thanks!
这个在判断位置在readTformatEncPosition程序内:
inline void readTformatEncPosition(void)
{
if(tFormat_dataId == PM_TFORMAT_DATAID3)
{
retVal1 = PM_tformat_receiveData(PM_TFORMAT_DATAID3);
crcResult = PM_tformat_getCRC(0, 80, 8,
(uint16_t *)(&tformatData.rxPkts), tformatCRCtable, 10);
crcResult = crcResult ^ (0xFF);
if(!tformat_checkCRC(crcResult, tformatData.crc))
{
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!正常时不会进入这段代码
tFormat_crcError = 1;
runMotor = MOTOR_STOP;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!这个代表收到的数据包(不含CRC字节)CRC校验后和数据包尾的CRC校验码不一致
//不知道你们遇到这种概率有多大 ?这个一定是保持很低概率才行!
}
//
//Invert the received bit sequence for position and
//turns for actual data
//
position =
((__flip32((uint32_t) tformatData.dataField0) >> 24 ) & 0xFF) |
((__flip32((uint32_t) tformatData.dataField1) >> 16 ) & 0xFF00) |
((__flip32((uint32_t) tformatData.dataField2) >> 8 ) & 0xFF0000);
turns =
((__flip32((uint32_t) tformatData.dataField4) >> 24 ) & 0xFF) |
((__flip32((uint32_t) tformatData.dataField5) >> 16 ) & 0xFF00) |
((__flip32((uint32_t) tformatData.dataField6) >> 8 ) & 0xFF0000);
tFormat_encCmdStatus = ENC_CLOSE;
tFormat_dataId = 0; // reset the ID log