[etherlab-users] Using EtherCAT EoE and Build Errors

Thomas Bitsky, Jr. tbj at automateddesign.com
Wed Aug 15 00:15:35 CEST 2012


Ok, so I made some progress, I think. I was able to build as a kernel
module and install the module. So long as the virtual interface (eoe0s7) is
not up, the program brings the network into Operation and scans at 100Hz.

Then, I issue # ifconfig eoe0s7 up

About 20 seconds later, the entire system hangs and I need to reboot.

In the kernel log, I am seeing this: BUG: scheduling while atomic:
swapper/0/0x10000100

My understanding is that occurred when using semaphores when spinlocks
should have been used in the master callbacks. I changed over the program
to spin locks, but the same thing occurred.

I'm not sure what I could try other than falling back to 1.4.0 and seeing
if I'm just running into a stable-1.5 bug. I'm following the tty examples
in the directory very closely. Beyond changing the hardware declarations to
match the network, it's the same program.

Does anyone have an EoE example they could share?

Thanks!
T


On Tue, Aug 14, 2012 at 7:29 AM, Matthieu Bec <mbec at gmto.org> wrote:

>
> Hello Thomas,
>
> it might be a simple network config problem: the IP address of your
> virtual interface shouldn't be the same as your field device. Try assigning
> it something different on the same subnet, e.g. 192.168.127.1/8 and check
> your routing table is correct
>
> Regards
>
> On 08/13/12 22:21, Thomas Bitsky, Jr. wrote:
>
>> Hello! I'm new to using EtherLAB. I've got the master installed as a
>> service, and it's communicating to the network fine. However, I'm having
>> trouble getting the EoE feature up and running.
>>
>> I have an Ethernet device in the field with the IP Address
>> 192.168.127.254 that I need to communicate with through a web browser. I
>> have an EL6601 that the master is able to see fine. When I put the
>> network into Operation, the RUN light goes steady.
>>
>> I'm running on Ubuntu 10.04. I have not installed any real-time
>> extensions; I'm just working with EtherLAB right now.
>>
>> If I execute:
>> # ethercat eoe
>>
>> I get a listing for eoe0s7 as a virtual interface, and that it is down.
>>
>>
>> So, I created in /etc/network the file ifcg-eoe0s7 with the following
>> contents:
>>
>> IPADDRESS=192.168.127.254/8 <http://192.168.127.254/8>
>> STARTMODE=auto
>>
>> I restarted the computer.
>>
>> To raise the interface, I enter:
>>
>> # ifconfig eoe0s7 up
>>
>> The virtual interface goes up, and the LINK light on the EL6601 goes
>> solid green.
>>
>> However, I'm unable to ping 192.168.127.254, or get the pages it serves
>> to pop up. So, I did more reading, and I think I need to do some
>> function calls in the program. So, I added to my test program:
>>
>>
>> void send_callback(void *cb_data)
>> {
>>      ec_master_t *m = (ec_master_t *) cb_data;
>>      sem_wait(&mutex);
>>      ecrt_master_send_ext(m);
>>      sem_post(&mutex);
>> }
>>
>> /***************************************************************
>> ******************/
>>
>> void receive_callback(void *cb_data)
>> {
>>      ec_master_t *m = (ec_master_t *) cb_data;
>>      sem_wait(&mutex);
>>      ecrt_master_receive(m);
>>      sem_post(&mutex);
>> }
>>
>> int
>> main(int argc, char **argv)
>> {
>>
>> ...
>>
>>   // setup callbacks for EoE
>>   ecrt_master_callbacks(master, send_callback, receive_callback, master);
>>
>> ...
>>
>> }
>>
>>
>>
>> However, it won't build:
>>
>> durability.o: In function `send_callback':
>> /home/tbj/srcroot/durability/**src/durability.c:279: undefined reference
>> to `ecrt_master_send_ext'
>> durability.o: In function `main':
>> /home/tbj/srcroot/durability/**src/durability.c:321: undefined reference
>> to `ecrt_master_callbacks'
>>
>>
>> This is my makefile:
>>
>> CC = gcc
>> ETHERCAT_TOPDIR = /home/tbj/srcroot/ethercat
>> CFLAGS = -I$(ETHERCAT_TOPDIR)/include -g -O2
>> LDFLAGS = -L$(ETHERCAT_TOPDIR)/lib/.libs -lethercat -lrt
>>
>> OBJECTS = durability.o
>>
>> durability.exe : $(OBJECTS)
>> $(CC) $(CFLAGS) $(OBJECTS) $(LDFLAGS) -o durability.exe
>>
>> %.o : %.c
>> $(CC) $(CFLAGS) -c $<
>>
>>
>> Can anyone tell me what I'm missing? I feel like I'm one step away from
>> having this working, but I can't find anything else in any documentation
>> that would lead me to the answer.
>>
>> Thanks in advance for any help.
>>
>> T
>>
>>
>> ______________________________**_________________
>> etherlab-users mailing list
>> etherlab-users at etherlab.org
>> http://lists.etherlab.org/**mailman/listinfo/etherlab-**users<http://lists.etherlab.org/mailman/listinfo/etherlab-users>
>>
>>
>
> --
> Matthieu Bec                GMTO Corp.
> cell:  +1 626 354 9367      P.O. Box 90933
> phone: +1 626 204 0527      Pasadena, CA 91109-0933
>
>


-- 
Thomas C. Bitsky Jr.
Lead Developer and Application Engineer
ADC | automateddesign.com
P: 630-783-1150 F: 630-783-1159 M: 630-632-6679
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20120814/ad7ea8c0/attachment-0004.htm>


More information about the Etherlab-users mailing list