Open alessio31183 opened 5 years ago
I forget.... I've already modified the canFestival.h file in order to be able to change the node ID
void CO::CO_setNodeId(uint8_t nodeId) {
setState(Stopped); // Stop the node, to change the node ID
setNodeId(nodeId); // Now the CAN address is changed
setState(Pre_operational); // Set to Pre_operational, master must boot it again
}
updating.... If I try to change the nodeID use this SDO: 680+nodeID - 2Fh - 00h - 30h - 00h - 05h - 00h - 00h - 00h
where 0x3000 is the location of the nodeID parameter as per DS406 profile
I get the right reply from the node and if I ask the new node ID with : 680+nodeID - 40h - 00h - 30h - 00h - 00h - 00h - 00h - 00h
I'm able to get the new nodeID as reply
The issue is that the real nodeID is still the same as before the changing. I also tried to use the save command: 680+nodeID - 23h - 10h - 10h - 01h - 73h - 61h - 76h - 65h
But I didn't implement it in the object dictionary.
Suppose that I implement the 1010h communication parameter correctly.
How can I really change the nodeID?
I suppose that I have to call the CO_setNodeId(uint8_t nodeId) somewhere. But where?
Its really some time ago that I worked on CANFestivino. As far as I can remember, I explicitly removed the functionality to set the node ID in order to save Flash and RAM. I think it was all in the original CANFestival code. It shouldn't be too hard to diff CANFestivino against CANFestival and spot the differences related to setNodeID. CANFestivino is not too different from the original.
I just looked at my example. There should be call-back functions for every OD entry. But I think, I removed this possibility for the standard SDO variables like NodeID for the sake of mentioned optimization. But you could probably put it back in from the original code.
Should should never use the canDispatch function. All interaction with user code is via the call-backs.
Thank you very much for your clarification.
Another question: I'm actually implementing the DS406 profile for the encoder but I cannot understand why if I link the PDO to the standardized variable Position_Value (0x6004) the PDO doesn't work. If I create a manufacturer specific variable Position at 0x2100 for example, the PDO works correctly.
Do you have any experience in this strange behaviour?
The issue seems relative to the getODentry function in the objacces.cpp file. In fact in this part of code there is a wIndex scansion from 0x2000 to 0x6000
if (wIndex >= 0x2000 && wIndex < 0x6000 && Callback && Callback[bSubindex]) {
errorCode = (Callback[bSubindex])(si, wIndex, bSubindex, 0);
if (errorCode != OD_SUCCESSFUL)
return errorCode;
}
If I replace the 0x6000 with 0x600A to include the 0x6004 Position_Value parameter I get the PDO working... But I cannot figure out why there is this filter
maybe this filter is there because the (original) implementation is already dealing with the standard profiles. I remember there being an example of a standard profile in the original CanFestival. You should take a look at that.
Back when I ported this, I stripped away everything I didn't need immediately. Maybe I did too much there.
Hi guys, I've implemented the CANFestivino on the ATmega64M1 successfully. Actually I'm just sending a PDO with the information cyclically at 100ms through the bus.
The next step to cover the user request is to be able to change the nodeID, the baudrate and to implement some other feature.
For example I'm focusing on just change the nodeID answering to a SDO external request.
I see that in the CO_Cycle() function there is the canDispatch(&m) function that processes the can message received. I cannot understand how to use it in order to get the information from the master SDO request.
Could you suggest to me how to figure out the procedure?
Thanks