SDO payload only 7 byte. Now status array from pmu905 seems correct.
This commit is contained in:
@@ -142,7 +142,7 @@ r 0x583 [8] 0x41 0x40 0x26 0x00 0x38 0x00 0x00 0x00
|
||||
0x38 = 56 byte bytes to transfer
|
||||
|
||||
|
||||
# All 56 bytes:
|
||||
# All 56 bytes: (toggle 0x61,0x71)
|
||||
w 0x603 [8] 0x40 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
w 0x603 [8] 0x61 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
w 0x603 [8] 0x71 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
@@ -152,7 +152,7 @@ w 0x603 [8] 0x61 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
w 0x603 [8] 0x71 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
w 0x603 [8] 0x61 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
|
||||
|
||||
# Note only 7 bytes payload, byte0 is toggle.. 0x00, 0x10 ...
|
||||
r 0x583 [8] 0x41 0x40 0x26 0x00 0x38 0x00 0x00 0x00
|
||||
r 0x583 [8] 0x00 0x18 0x00 0x24 0x00 0x0E 0x00 0x0A
|
||||
r 0x583 [8] 0x10 0x00 0x00 0x00 0xBF 0x00 0x00 0x00
|
||||
@@ -168,4 +168,34 @@ w 0x603 [8] 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00
|
||||
r 0x583 [8] 0x80 0x00 0x00 0x00 0x00 0x00 0x02 0x06
|
||||
|
||||
|
||||
# Seems to work
|
||||
Need to write new frameEqual func
|
||||
|
||||
data[0]: 24
|
||||
data[1]: 36
|
||||
data[2]: 14
|
||||
data[3]: 10
|
||||
data[4]: 0
|
||||
data[5]: 194
|
||||
data[6]: 0
|
||||
data[7]: 450
|
||||
data[8]: 0
|
||||
data[9]: 0
|
||||
data[10]: 7221
|
||||
data[11]: 644
|
||||
data[12]: 6726
|
||||
data[13]: 18748
|
||||
data[14]: 450
|
||||
data[15]: 0
|
||||
data[16]: 0
|
||||
data[17]: 0
|
||||
data[18]: 18632
|
||||
data[19]: 12113
|
||||
data[20]: 0
|
||||
data[21]: 11612
|
||||
data[22]: 5247
|
||||
data[23]: 3431
|
||||
data[24]: 170
|
||||
data[25]: 192
|
||||
data[26]: 0
|
||||
data[27]: 5000
|
||||
|
||||
@@ -98,7 +98,7 @@ ecmcCANOpenSDO::ecmcCANOpenSDO(ecmcSocketCANWriteBuffer* writeBuffer,
|
||||
recConfRead_.data[4] = ODLengthBytes_.byte0;
|
||||
recConfRead_.data[5] = ODLengthBytes_.byte1;
|
||||
recConfRead_.data[6] = ODLengthBytes_.byte2;
|
||||
recConfRead_.data[7] = ODLengthBytes_.byte3 ;
|
||||
recConfRead_.data[7] = ODLengthBytes_.byte3;
|
||||
}
|
||||
|
||||
ecmcCANOpenSDO::~ecmcCANOpenSDO() {
|
||||
@@ -155,9 +155,9 @@ void ecmcCANOpenSDO::newRxFrame(can_frame *frame) {
|
||||
return; // not correct frame
|
||||
}
|
||||
//Add data to buffer
|
||||
if(frame->can_dlc + recivedBytes_ <= ODSize_) {
|
||||
memcpy(dataBuffer_ + recivedBytes_, &(frame->data[0]),frame->can_dlc);
|
||||
recivedBytes_ += frame->can_dlc;
|
||||
if(frame->can_dlc-1 + recivedBytes_ <= ODSize_) {
|
||||
memcpy(dataBuffer_ + recivedBytes_, &(frame->data[1]),frame->can_dlc-1);
|
||||
recivedBytes_ += frame->can_dlc-1;
|
||||
}
|
||||
if(recivedBytes_ < ODSize_) { // Ask for more data but must toggle so alternat the prepared frames
|
||||
if(useTg1Frame_) {
|
||||
@@ -174,7 +174,8 @@ void ecmcCANOpenSDO::newRxFrame(can_frame *frame) {
|
||||
if (recivedBytes_ == ODSize_) {
|
||||
readStates_ =IDLE;
|
||||
busy_ = 0;
|
||||
printf("All data transfered");
|
||||
printf("All data transfered\n");
|
||||
printBuffer();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -186,7 +187,33 @@ void ecmcCANOpenSDO::newRxFrame(can_frame *frame) {
|
||||
}
|
||||
|
||||
int ecmcCANOpenSDO::frameEqual(can_frame *frame1,can_frame *frame2) {
|
||||
return memcmp(frame1,frame2, sizeof(can_frame)) == 0;
|
||||
if(frame1->can_id == frame2->can_id &&
|
||||
frame1->can_dlc == frame2->can_dlc &&
|
||||
frame1->data[0] == frame2->data[0] &&
|
||||
frame1->data[1] == frame2->data[1] &&
|
||||
frame1->data[2] == frame2->data[2] &&
|
||||
frame1->data[3] == frame2->data[3] &&
|
||||
frame1->data[4] == frame2->data[4] &&
|
||||
frame1->data[5] == frame2->data[5] &&
|
||||
frame1->data[6] == frame2->data[6] &&
|
||||
frame1->data[7] == frame2->data[7]) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
//return memcmp(frame1,frame2, sizeof(can_frame)) == 0;
|
||||
}
|
||||
|
||||
void ecmcCANOpenSDO::printBuffer() {
|
||||
if(!dataBuffer_) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < ODSize_; i = i + 2) {
|
||||
uint16_t test;
|
||||
memcpy(&test,&dataBuffer_[i],2);
|
||||
printf("data[%d]: %u\n",i/2,test);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
//# w 0x603 [8] 0x40 0x40 0x26 0x00 0x00 0x00 0x00 0x00
|
||||
|
||||
@@ -64,7 +64,7 @@ class ecmcCANOpenSDO {
|
||||
uint32_t recivedBytes_;
|
||||
int useTg1Frame_;
|
||||
ecmc_read_states readStates_;
|
||||
|
||||
void printBuffer();
|
||||
};
|
||||
|
||||
#endif /* ECMC_CANOPEN_SDO_H_ */
|
||||
|
||||
Reference in New Issue
Block a user