Ethercat compatible Encoder board tentative STM32F4 + LAN9252

More
10 months 2 weeks ago #340236 by vibram
Hello
Thank you for pushing me :)

I took back your project and build with the SPI2, flash you r eeprom and it worked well, im in OP mode in free run.

As I'm a beginner, my goal is to have a working base (basically yours...) and edit in order to adapt my needs.
Now I have the SPI working well, I will try to integrate my encoder from thise base

Please Log in to join the conversation.

More
10 months 2 weeks ago #340237 by meister
A little tip for non-Windows users: you don't need TwinCat to read, write, edit or convert .bin/.xml esi files.

github.com/multigcs/esitool

Please Log in to join the conversation.

More
10 months 2 weeks ago #340238 by vibram
Hello,
I updated the GIT.
I managed to flash my eeprom correctly however with the current I-m stuck in with this compilation issue:
Code:
ecat_slv.c.text.RXPDO_update+0x1c): undefined reference to `rxpdo' I just cleaned the cb_get_inputs(void) and cb_set_outputs(void) compared to the working code and put my eeprom file in folder soes-esi In order to compile i can add this in main.cpp [code]// Definition of rxpdo needed when MAX_MAPPINGS_SM2 is 0 uint8_t rxpdo_buffer[512]; uint8_t *rxpdo = rxpdo_buffer; but if i do so, I-m stuck in ERR PREOP step
[/code]

Please Log in to join the conversation.

More
10 months 1 week ago #340241 by Hakan
I saw that one, that was a new one to me.
How about not solving it, and instead go around it?
Add a PDO say scale as rxpdo? I mean anything useful, you don't need to do anything with it, just a place holder.
Then you don't need that declaration in main.cpp.
I have always had rxpdos so had not encountered that before.
I can try to see what's going on in the code a bit later.

Meister, I think it is how you go from the comfort zone with Twincat to the deep waters in linux.
I read and write eeprom with "ethercat sii_read" and "ethercat sii_write", the EEPROM_generator
gives me directly the eeprom to download in bin format. The tool you refer to can be used
to take an arbitrary xml file and turn into eeprom format for downloading. It's very useful,
one of the tools to keep in the toolchest.

Please Log in to join the conversation.

More
10 months 1 week ago #340242 by vibram
well done its working !
I need the distributed clocks working if i want it to be compatible with LinuxCNC ?

Please Log in to join the conversation.

More
10 months 1 week ago #340247 by Hakan
You can choose between free-run and DC-sync (and SM-sync but noone uses that).
But you are not set up for any of that at the moment.
Let's start with free-run
Add this to eeprom-generator
 

Attachment not found


The 000 is the one I have in mind, but have both of them in there.
Save all, burn eeprom, compile and upload firmware in the usual way.
In ethercat-conf.xml leave out the <dcConf ... > statement for the slave. That makes it use free-run mode.
It should now work in free run mode. 
 

Please Log in to join the conversation.

More
10 months 1 week ago #340254 by vibram
It's already working in free run mode, I can see my encoder value in twincat such as in your 3rd video :)

ethercat-conf.xml

You mean the linuxcnc file? 

Please Log in to join the conversation.

More
10 months 1 week ago #340256 by Hakan
Yes, I thought you wanted to use it in linuxcnc. That's how.
I'll tell you about dc synchronization tomorrow. It's a bit more writing and more code.
 

Please Log in to join the conversation.

More
10 months 1 week ago #340268 by vibram
I will also need to build a specific file for linuxcnc to recognize the board right? Is there any documentation about this?

Please Log in to join the conversation.

More
10 months 1 week ago #340274 by Hakan
You can drown in documentation here github.com/linuxcnc-ethercat/linuxcnc-ethercat

But you should treat is any new EtherCAT board, no-one knows you made it.
Code:
lcec_configgen
usually gives a good starting point. And then you add pdos and sdos 
as you progress with the project. The naming/numbering scheme is pretty obvious when you see one.

Some general items you should have is 
Code:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000" syncToRefClock="True">
or if syncToRefClock isn't recognized
Code:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="-1000">
That "1000" is how frequent the clocks in the DC slaves are synchronized by the master. I use every 1000 cycle ( 1 sec)
In between the slaves calculate drift and offset themselves and run pretty darn accurate so it isn't necessary to do it more often than that. I Haven't seen a penalty for too seldom or too often so the important thing it's there.

And when you use DC sync for the slave, which you soon can do, you add this line to the slave.
Code:
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
300 is the important, means DC synchronization. 000 means free-run, as does removing the dcConf statetment, and 200 means SM2 synchronization. Those are the common modes, there are also 700, 100 and other modes, but the manual or the ESI file will tell you. 

 

Please Log in to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum