kubabuda / EEPROM_generator

SOES EEPROM Generator and Slave Stack Code generation tool for EtherCAT devices using SOES library
https://kubabuda.github.io/EEPROM_generator/
Other
27 stars 12 forks source link

Length of string/VISIBLE_STRING #2

Open y012g opened 8 months ago

y012g commented 8 months ago

Hi, thanks for open-sourcing this great tool!

I have a question about defining strings in PDOs. How to define the length of a VISIBLE_STRING variable in PDOs? What is its default size?

Thanks!

kubabuda commented 8 months ago

Hello, glad you like it.

String length is calculated from initial value passed into form, when you create/edit SDO or PDO object. Implicit assumption is that you will not try to assign longer string than initial value. For what I saw so far, string use was limited to device description in SDO like manufacturer, model and version, you would normally make it readonly. Process data in PDOs, these usually are number or bitfields sent as numbers.

But I see I had not implemented it correctly: I am passing string constant object instead, and reading its name length. I will fix it.

BTW what is your use case that you need strings in PDOs?

y012g commented 8 months ago

Thanks for your response and for offering to fix this bug. Actually, when I tried to create a string in PDO, the generated xml had issues since when I used slaveinfo tool from SOEM, it showed 0 bits for both input and output although I had other variables with different data types.

Also, I think array implementation is also problematic. I tested it yesterday and created an array of 16 unsigned int8 (byte) but I noticed when using slaveinfo tool or TwinCAT than only 8 are mapped correctly and the rest are missing and problematic. The way I created the array is choosing array and keep adding subitems manually. (Would be better if I can just input array length).

Finally, I also think choosing a value during defining PDOs may have a bug. If I set a value for a variable it will be populated for all other variables.

The use case is sending a string to TwinCAT, but unfortunately, when I replaced it with an array of bytes I also faced issues as indicated above.

Thanks so much for your help!

y012g commented 8 months ago

@kubabuda Hi,

If this is going to take time to fix, are you aware of other tools that I can use meanwhile similar to yours EEPROM_generator?

thanks!

kubabuda commented 8 months ago

As per documentation, there is EtherCAT SDK from rt-labs (non-free)

kubabuda commented 6 months ago

Hello, Apparently string in PDOs are not supported in SOES by design. Supported PDO types are listed in COE_getValue function cases - for remaining types assertion fails So this will not get implemented. I repaired generating SDOs with VISIBLE_STRING type, added size input for array and repaired variable value bug.

I will now check longer arrays