linuxcnc-ethercat icon indicating copy to clipboard operation
linuxcnc-ethercat copied to clipboard

Failed to allocate Memory

Open satiowadahc opened this issue 3 years ago • 7 comments

Looking for assistance on this one.

halrun
halcmd: loadusr -W lcec_conf ~/conf.xml
Note: Using POSIX realtime                                                                               
Failed to map process data: Cannot allocate memory                                                                
LCEC: failed to activate master 0                                                                             
lcec: rtapi_app_main: Invalid argument (-22)                                                                             
<stdin>:3: waitpid failed /usr/bin/rtapi_app lcec                                                                    
<stdin>:3: /usr/bin/rtapi_app exited without becoming ready                                                          
<stdin>:3: insmod for lcec failed, returned -1
uname                                                             
5.10.30-rt39 #1 SMP PREEMPT_RT Wed May 19 14:38:10 CST 2021 x86_64 x86_64 x86_64 GNU/Linux

I see the error is actually originating from the IGH code, however the driver seems to working on their end.

I can see the master and slaves and communicate with Ethercat commands. But I can't seem to run it in LCNC

satiowadahc avatar May 27 '21 17:05 satiowadahc

Looks like overflow, master->process_data_size is -120624156508160. but why...

satiowadahc avatar May 27 '21 21:05 satiowadahc

Could you please post the contents of your conf.xml ...

sirop avatar May 28 '21 04:05 sirop

<masters>
  <master idx="0" appTimePeriod="1000000" refClockSyncCycles="-1">
    <slave idx="0" type="EK1101"/>
<!-- <slave idx="0" type="EK1100"/> -->
    <slave idx="1" type="EL1008"/>
  </master>
</masters>

I hard coded the master->process_data_size in ethercat lib/master to sizeof(int) and it seems to work now. (until I get more slaves on the network.

satiowadahc avatar May 28 '21 14:05 satiowadahc

EK1100 works on our older computers running kernel 4.10 for the EK1101, but on my newer laptop I need kernel 5.10 for processor support and tried both the 1101 and 1100. (From pr #102)

satiowadahc avatar May 28 '21 14:05 satiowadahc

Do you use the source code from the official repo https://gitlab.com/etherlab.org/ethercat or the unofficial one https://github.com/ribalda/ethercat ?

Do you use generic drivers with kernel 5.10?

Did you try ethercat debug 1 for more debug info?

Hard coded slave description works until you get more slaves on the network?

Do you get a core dump of lcec crash?

sirop avatar May 28 '21 14:05 sirop

  1. Official code.

  2. Yes Generic drivers.

  3. Debug is how I found the domain size.

If I set master->process_data_size = 2, I can have 2 slaves or less, I get unmatched datagram errors with more If I set master->process_data_size = 3, I can have 3 slaves or less, I get unmatched datagram errors with more. etc.

  1. Do you have a reference or code for getting a core dump?

satiowadahc avatar May 28 '21 16:05 satiowadahc

You use refClockSyncCycles="-1" , which means that you want to sync your master thread to hardware time of a DC capable slave. On the other hand side you use generic drivers with high latency. This is a bit contradictory. Correct me if am wrong.

https://github.com/ribalda/ethercat has some commits for 5.x, although I could find any adopted drivers for kernels newer than 4.19 .

sirop avatar May 31 '21 07:05 sirop