Skip to content

Improve the network_simulator and EsiParser#386

Closed
phamnhatha090805 wants to merge 3 commits into
leducp:masterfrom
phamnhatha090805:esi-development
Closed

Improve the network_simulator and EsiParser#386
phamnhatha090805 wants to merge 3 commits into
leducp:masterfrom
phamnhatha090805:esi-development

Conversation

@phamnhatha090805
Copy link
Copy Markdown
Contributor

This modification is making the KickCAT more compliance with the official Beckhoff EtherCAT module. So the XML file from Beckhoff can contain several EtherCAT devices (e.g. EL1xxx.xml) but the EEPROM BIN only contains 1 device. With these changes, the program will get the vendor_id, product_code, and revision_number from the EEPROM BIN. From that, the program go look into the xml file until it find the matching vendor_id, product_code, and revision_number instead of finding the first elements.
Also I agree with the ENI vs ESI seperation because for example the EL1xxx modules need a EtherCAT bus coupler infront of it. It's more convenient to have a .json file that contains whole network instead of -s <EtherCAT coupler (EK1xxx)>.json <EL1xxx>.json

…mpliance with official Beckhoff EtherCAT modules
@leducp
Copy link
Copy Markdown
Owner

leducp commented Apr 24, 2026

I though ESI should only handle one slave but ENI multiple as it describes a network? If yes we need a deidcated parser (ENIParser)

Answering to myself: yes an ESI can have multiple slaves

// In many Beckhoff BIN files, the Identity section starts at Word 8 (Byte 16)

// Vendor ID (Word 8 & 9)
vendor_id_ = (static_cast<uint32_t>(eeprom_[9]) << 16) | eeprom_[8];
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it is better to use the SII Parser to extract the data needed here (it can also verify the eeprom coherency).


nanoseconds t1 = since_epoch();
CoE::Dictionary coe_dict = parser.loadFile(esi_file);
CoE::Dictionary coe_dict = parser.loadFirstDictionaryFromFile(esi_file);
Copy link
Copy Markdown
Owner

@leducp leducp Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it to handle legacy call? If yes I think it is better to just have one API that retrieve the vector of dic and let each example get themself the first one (they are examples after all :) )

Comment thread tools/od_generator.cc
@@ -147,7 +147,7 @@ namespace kickcat
CoE::Dictionary loadOD(std::string esiFileName)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to you PR but could you convert this call to loadOD(std::string const& esiFileName)` ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

}

#endif
#endif No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants