Part Number: TMS320F28379S
Hello,
I had already post some question about Endat library on the propagation delay.
But I was facing a strange problem. If I send the Command 2.2: ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA it is Ok, but If I send the command 2.1 : ENCODER_SEND_POSITION_VALUES the receive position is ok, but the computed CRC is not the same than received!..
Bellow is the init phase and run phase I apply, which is extract from the example:
Init phase
Phase with Reset etc...
(void)PM_endat22_setupCommand (SELECTION_OF_MEMORY_AREA, 0xA1, 0x5555, 0); /* data1=MRS; data2=any */
PM_endat22_startOperation();
wait endat22Data.dataReady == 1
(void)PM_endat22_receiveData(SELECTION_OF_MEMORY_AREA, 0);
CRC5_Result = PM_endat22_getCrcNorm(endat22Data.address, endat22Data.data, DV_EnDat_CRCTable);
-> CRC is Ok
(void)PM_endat22_setupCommand (ENCODER_SEND_PARAMETER, 0xD, 0xAAAA, 0); /* data1=address; data2=any */
PM_endat22_startOperation();
wait endat22Data.dataReady == 1
(void)PM_endat22_receiveData(ENCODER_SEND_PARAMETER, 0);
CRC5_Result = PM_endat22_getCrcNorm(endat22Data.address, endat22Data.data, DV_EnDat_CRCTable);
-> Crc is Ok
-> endat22Data.position_clocks = endat22Data.data & 0x0FF;
(void)PM_endat22_setupCommand (ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA, 0, 0, 0);
PM_endat22_startOperation();
wait endat22Data.dataReady == 1
(void)PM_endat22_receiveData(ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA, 0);
CRC5_Result = PM_endat22_getCrcPos(endat22Data.position_clocks, ENDAT22, endat22Data.position_lo,
endat22Data.position_hi, endat22Data.error1, endat22Data.error2, DV_EnDat_CRCTable);
-> Crc is Ok
Delay1 = PM_endat22_getDelayCompVal
(void)PM_endat22_setupCommand (ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA, 0, 0, 0);
PM_endat22_startOperation();
wait endat22Data.dataReady == 1
(void)PM_endat22_receiveData(ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA, 0);
CRC5_Result = PM_endat22_getCrcPos(endat22Data.position_clocks, ENDAT22, endat22Data.position_lo,
endat22Data.position_hi, endat22Data.error1,endat22Data.error2, DV_EnDat_CRCTable);
-> Crc is Ok
Delay2 = PM_endat22_getDelayCompVal
DV_EnDat_Data.delay_comp = (Delay1 + Delay2) >> 1;
Then this init phase is Ok for me..
After that, two solution. THe first which working:
(void)PM_endat22_setupCommand (ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA, 0, 0, 0);
PM_endat22_startOperation();
wait endat22Data.dataReady == 1
(void)PM_endat22_receiveData(ENCODER_SEND_POSITION_VALUES_WITH_ADDITIONAL_DATA, 0);
CRC5_Result = PM_endat22_getCrcPos(endat22Data.position_clocks, ENDAT22, endat22Data.position_lo,
endat22Data.position_hi, endat22Data.error1, endat22Data.error2, DV_EnDat_CRCTable);
-> Crc is Ok
Then I get the position ok.
The second which lead to a bad CRC comparision:
(void)PM_endat22_setupCommand (ENCODER_SEND_POSITION_VALUES, 0, 0, 0);
PM_endat22_startOperation();
wait endat22Data.dataReady == 1
void)PM_endat22_receiveData(ENCODER_SEND_POSITION_VALUES, 0);
CRC5_Result = PM_endat22_getCrcPos(endat22Data.position_clocks, ENDAT21*, endat22Data.position_lo,
endat22Data.position_hi, endat22Data.error1, endat22Data.error2, DV_EnDat_CRCTable);
-> Crc is not Ok, but the read position is ok and move with the motor move...
*tryed with ENDAT22 with same result..
Is i me something bad into init phase or on the sequence to read the position with endat 2.1 command?
The aim of this command is to use less the SPi bus because less byte is transmitted then this is faster. !!
Thank