safeRTOS is running on the board and there is an ENET driver available.
RTOS only serves Timers in the milli seconds range. Could I configure the stack to use these, just for a "hello world"? I don't mind if it would be running as CN or MN.
I am still at the beginning of porting. Do you have any suggestions on how to start?
So far I have identified some places to work on:
the shared buffers
The DLL to connect to my ethernet driver (didn't look much into that)
the Process image copy job
The HR Timers.
...
Any help would be appreciated :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To get started, begin with Ethernet and timer drivers. These are the critical parts of your port.
For Ethernet driver, you can look into the EdrvOpenMAC or Edrv9003.c (This will be close to your board architecture if its ARM) in the openPOWERLINK release. Particularly, the buffer allocation, interaction with PHY, handling interrupts, handling the call backs for Tx and Rx.
For timer, you need to have a minimum of 2 timers, one to be configured as one shot and other to be a continuous timer. Have a look into TimerHighReskAT91.c, also into EdrvCyclic.c
Once you are done with these parts, you can begin porting the stack onto your OS (handling OS specific areas, shared buffers etc.. like what you have identified)
Hope this helps you. If you have any further specific questions, please don't hesitate to ask us.
Regards,
Abhiram.B
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, then you can use the Ethernet driver as such.
That is a tough question to answer :)
Your performance depends on a number of factors, namely the timer resolution, type of RAM (bus speed), kernel configuration, interrupt latency etc..
Theoretically it looks possible, but it again depends on the above mentioned factors. May be you can measure execution time of routines to get an idea on how things will fall in place.
Regards,
Abhiram.B
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If there is a port of libpcap for safeRTOS existing, you could try out modifying the libpcap Edrv of the stack. For this, as well as for the timers, you might also check out the Windows variant, since Windows also only provides ms timers out of the box. But consider that you won't get best performance with such a version. So the preferred way is the one Abhiram has outlined (create your own Ethernet driver and your own timer driver).
Before starting a port to a new platform, I'd suggest you set up a test system with a Linux MN and any CN (could be an FPGA-based CN demo from the stack or a standard POWERLINK product from the market. Also a second PC with Linux is possible). Then, go on porting the MN to safeRTOS while keeping CN and network configuration the same.
Keep us updated on your progress!
Best regards,
Wolfgang
Last edit: Wolfgang Seiss 2012-10-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have described a similar problem in my bachelor's thesis (see link at end of post), maybe it is of some help to you.
My goal was to replace a PCAP-based Edrv with another Edrv on WinCE.
I suppose your task goes beyond what I had to do, as I could base my work on an already existing openPOWERLINK port, while you will have to port the whole stack.
You can convert the cdc file to a .h file and compile the application with it. vi editor can do this job for you.
Try this:
vi Mnobd_cdc.h (new file)
:r !xxd -i mnobd.cdc (read the binary file)
:wq (save the .h)
You will not be able to use EplApiSetCdcFileName instead use EplApiSetCdcBuffer and point the array in the .h file. Hope this helps you.Let me know if you face any difficulty.
From my understanding, you cannot disable shared buffer as all the event posting is done through this.
Thanks and regards,
Abhiram.B
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you. I didn't know about xxd.
Btw, it is easier to just call
xxd -i mnobd.cdc > Mnobd_cdc.h
without using vi on a linux system.
I wanted to disable shared buffers just for now, so I don't have to port them. the Softwaremanual says on page 93:
EPL_USE_SHAREDBUFF
this macro defines if the SharedBuff implementation exists and should be used for event queues etc. If you want to test the EPL stack on a target system without operating system or on a target where now SharedBuff implementation exists, you can define this macro to FALSE. Instead of event queues there will be direct calls between EPL user part and kernel part.
But I will have to port them eventually...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, you can disable shared buffer through that, but as I could sense that you are using cdc, then process image module needs shared buffer. As you said, you have to port it eventually :)
Regards,
Abhiram.B
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, you can disable CFM and configure the network by editing the object dictionary accordingly for all nodes. As this is cumbersome, the CDC simplifies it for you. But I guess you want to do it the hardest way :(
I am not pretty sure if that would eliminate the possibility of using shared buffer, please confirm it from your side.
Regards,
Abhiram.B
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So if I ditched the CDC, then I could omit the shared buffers as well?
Shared buffers are used at various other places in the stack as well (most notably in the Communication Abstraction Layer), so having a good Shared Buffer implementation for your platform would benefit your port anyway.
How could I configure my Network without cdc?
The CDC file contains the configuration for all nodes in the network, the MN reads it and writes the object dictionaries of all nodes accordingly. You may do the same just using the openPOWERLINK API functions.
regards, Wolfgang
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay, I learned to love the CDC. Thank you for your Input.
My OS (safeRTOS) only supports 1ms timers for threads. So I think i will stick to the windows port of shared buffers. Please correct me, in case this is a bad idea.
regards, stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think my shared buffers might work. I ported the ones from the VxWorks port.
But now EplApiProcessImageSetup() returns 0x31, which means
kEplObdIndexNotExists.
My starting point was the demo_main.c from the generic demo.
I'm calling:
EplApiInitialize()
EplApiSetCdcBuffer() // using the header created from mnobd.cdc
EplApiProcessImageAlloc()
and finally
EplApiProcessImageSetup().
I noticed, that EplObdCdcLoadBuffer() is never called.
I think this is another very basic user problem. But I do hope you can help me out here once more :)
Please tell me if you need more information.
regards, Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again
Currently I'm trying to configure my port as CN. So far I have (apart from porting) only changed the NodeID to 1.
It already responds to IdentRequests. But as my code is based on demo_process_image_console nothing else happens.
Is there some linux example code for this demo to behave as CN that i could adopt?
But I don't have CiA401_3r1tpdo_CN (openPOWERLINK-V1.08.1)
Currently I just compile and link against ObjDicts/CiA302-4_MN/objdict.c
Changing this to ObjDicts/CiA401_CN/objdict.c fails, as there is no
EplApiProcessImageSetup.c available.
Any help would be greatly appreciated :)
I've also asked about setting the cycle time in the "Getting started" section.
regards, stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
in openPOWERLINK V1.8.2 we added a CN demo for X86. The demo uses CiA profile 401 and simulates an 8 bit digital input/output node. You find the demo under Examples/X86/Generic/demo_cn_console.
Best regards,
Josef
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the hint about the new Stack Release. The CN Demo works great on linux, but my safeRTOS/arm port seems to have a timing issue. The second StatusResponse is sent before it is updated.
My ethernet driver byteswapped the package the first time it was sent. So the second time it is basically garbage.
Is the Ethernet driver allowed to byteswap the package in place, because it should be guaranteed that update happens before every send?
I've logged update(EplDllkUpdateFrameStatusRes) and sending (before handing over to DMA)
maybe you can derive something from this...
The two adjacent rows of "##sending 0x4021F244" show the problem.
Hello everybody!
safeRTOS is running on the board and there is an ENET driver available.
RTOS only serves Timers in the milli seconds range. Could I configure the stack to use these, just for a "hello world"? I don't mind if it would be running as CN or MN.
I am still at the beginning of porting. Do you have any suggestions on how to start?
So far I have identified some places to work on:
Any help would be appreciated :)
Hello Stefan,
Good to hear that!
To get started, begin with Ethernet and timer drivers. These are the critical parts of your port.
For Ethernet driver, you can look into the EdrvOpenMAC or Edrv9003.c (This will be close to your board architecture if its ARM) in the openPOWERLINK release. Particularly, the buffer allocation, interaction with PHY, handling interrupts, handling the call backs for Tx and Rx.
For timer, you need to have a minimum of 2 timers, one to be configured as one shot and other to be a continuous timer. Have a look into TimerHighReskAT91.c, also into EdrvCyclic.c
Once you are done with these parts, you can begin porting the stack onto your OS (handling OS specific areas, shared buffers etc.. like what you have identified)
Hope this helps you. If you have any further specific questions, please don't hesitate to ask us.
Regards,
Abhiram.B
hello Abhiram,
thank you for your suggestions.
The ethernet chip is an FEC, so I suppose I'd better stick to the code in EdrvFec.c and the driver for safeRTOS.
My goal is to achieve better performance on this ~500MHz board than linux-rt with 8 nodes and 1ms cycle time. Do you think this is possible?
But I will have to reconsider if all of this is possible in my student-project.
Hello Stefan,
Well, then you can use the Ethernet driver as such.
That is a tough question to answer :)
Your performance depends on a number of factors, namely the timer resolution, type of RAM (bus speed), kernel configuration, interrupt latency etc..
Theoretically it looks possible, but it again depends on the above mentioned factors. May be you can measure execution time of routines to get an idea on how things will fall in place.
Regards,
Abhiram.B
Hi,
If there is a port of libpcap for safeRTOS existing, you could try out modifying the libpcap Edrv of the stack. For this, as well as for the timers, you might also check out the Windows variant, since Windows also only provides ms timers out of the box. But consider that you won't get best performance with such a version. So the preferred way is the one Abhiram has outlined (create your own Ethernet driver and your own timer driver).
Before starting a port to a new platform, I'd suggest you set up a test system with a Linux MN and any CN (could be an FPGA-based CN demo from the stack or a standard POWERLINK product from the market. Also a second PC with Linux is possible). Then, go on porting the MN to safeRTOS while keeping CN and network configuration the same.
Keep us updated on your progress!
Best regards,
Wolfgang
Last edit: Wolfgang Seiss 2012-10-04
hello,
there is no libpcap in (my version of) safeRTOS. But as I need 1ms cycletime with 8 nodes, I will have to implement the enet driver.
Currently, my MN is a windows-pc running the generic demo from the stack and a standard CN from the market.
Hello Stefan,
I have described a similar problem in my bachelor's thesis (see link at end of post), maybe it is of some help to you.
My goal was to replace a PCAP-based Edrv with another Edrv on WinCE.
I suppose your task goes beyond what I had to do, as I could base my work on an already existing openPOWERLINK port, while you will have to port the whole stack.
regards,
Wolfgang
http://www.vmars.tuwien.ac.at/php/pserver/extern/docdetail.php?DID=3018&viewmode=thesis
Last edit: Wolfgang Wallner 2012-10-04
Thank you, wolfgang
... I'll look into that.
Liebe Grüße aus Graz :)
Hello again.
My HR timers are finally up and running. :)
My previous post regarding the following seems to be lost. So I'll try again:
This is a basic questions, but I would really appreciate your help :)
My OS does not support filesystems. So i can't read the .cdc file.
What is configured using the cdc file, and how can I configure it without it? :)
And another question: Is there an example with disabled shared buffers?
regards,
Stefan
Hello Stefan,
You can convert the cdc file to a .h file and compile the application with it. vi editor can do this job for you.
Try this:
vi Mnobd_cdc.h (new file)
:r !xxd -i mnobd.cdc (read the binary file)
:wq (save the .h)
You will not be able to use EplApiSetCdcFileName instead use EplApiSetCdcBuffer and point the array in the .h file. Hope this helps you.Let me know if you face any difficulty.
From my understanding, you cannot disable shared buffer as all the event posting is done through this.
Thanks and regards,
Abhiram.B
hallo Abhiram,
Thank you. I didn't know about xxd.
Btw, it is easier to just call
xxd -i mnobd.cdc > Mnobd_cdc.h
without using vi on a linux system.
I wanted to disable shared buffers just for now, so I don't have to port them. the Softwaremanual says on page 93:
EPL_USE_SHAREDBUFF
this macro defines if the SharedBuff implementation exists and should be used for event queues etc. If you want to test the EPL stack on a target system without operating system or on a target where now SharedBuff implementation exists, you can define this macro to FALSE. Instead of event queues there will be direct calls between EPL user part and kernel part.
But I will have to port them eventually...
Hello Stefan,
Oh ya! You are right :)
Yes, you can disable shared buffer through that, but as I could sense that you are using cdc, then process image module needs shared buffer. As you said, you have to port it eventually :)
Regards,
Abhiram.B
Hello Abhiram,
So if I ditched the CDC, then I could omit the shared buffers as well?
How could I configure my Network without cdc?
once more: thank you for your help :)
Redards,
Stefan
Hello Stefan,
Yes, you can disable CFM and configure the network by editing the object dictionary accordingly for all nodes. As this is cumbersome, the CDC simplifies it for you. But I guess you want to do it the hardest way :(
I am not pretty sure if that would eliminate the possibility of using shared buffer, please confirm it from your side.
Regards,
Abhiram.B
Hello Stefan,
Shared buffers are used at various other places in the stack as well (most notably in the Communication Abstraction Layer), so having a good Shared Buffer implementation for your platform would benefit your port anyway.
The CDC file contains the configuration for all nodes in the network, the MN reads it and writes the object dictionaries of all nodes accordingly. You may do the same just using the openPOWERLINK API functions.
regards, Wolfgang
Hello
Okay, I learned to love the CDC. Thank you for your Input.
My OS (safeRTOS) only supports 1ms timers for threads. So I think i will stick to the windows port of shared buffers. Please correct me, in case this is a bad idea.
regards, stefan
Hello
I think my shared buffers might work. I ported the ones from the VxWorks port.
But now EplApiProcessImageSetup() returns 0x31, which means
kEplObdIndexNotExists.
My starting point was the demo_main.c from the generic demo.
I'm calling:
EplApiInitialize()
EplApiSetCdcBuffer() // using the header created from mnobd.cdc
EplApiProcessImageAlloc()
and finally
EplApiProcessImageSetup().
I noticed, that EplObdCdcLoadBuffer() is never called.
I think this is another very basic user problem. But I do hope you can help me out here once more :)
Please tell me if you need more information.
regards, Stefan
solved.
I set the wrong includepath (-I) for objdict.h.
it should be CiA302-4_MN,but it pointed to the CiA401_CN.
it works now
Hello again
Currently I'm trying to configure my port as CN. So far I have (apart from porting) only changed the NodeID to 1.
It already responds to IdentRequests. But as my code is based on demo_process_image_console nothing else happens.
Is there some linux example code for this demo to behave as CN that i could adopt?
I Found some Thread regarding this here in the Getting-Started section:
https://sourceforge.net/p/openpowerlink/discussion/newbie/thread/528104a8/#c603
But I don't have CiA401_3r1tpdo_CN (openPOWERLINK-V1.08.1)
Currently I just compile and link against ObjDicts/CiA302-4_MN/objdict.c
Changing this to ObjDicts/CiA401_CN/objdict.c fails, as there is no
EplApiProcessImageSetup.c available.
Any help would be greatly appreciated :)
I've also asked about setting the cycle time in the "Getting started" section.
regards, stefan
Hello Stefan,
in openPOWERLINK V1.8.2 we added a CN demo for X86. The demo uses CiA profile 401 and simulates an 8 bit digital input/output node. You find the demo under Examples/X86/Generic/demo_cn_console.
Best regards,
Josef
Hello everybody.
Thanks for the hint about the new Stack Release. The CN Demo works great on linux, but my safeRTOS/arm port seems to have a timing issue. The second StatusResponse is sent before it is updated.
My ethernet driver byteswapped the package the first time it was sent. So the second time it is basically garbage.
Is the Ethernet driver allowed to byteswap the package in place, because it should be guaranteed that update happens before every send?
I've logged update(EplDllkUpdateFrameStatusRes) and sending (before handing over to DMA)
maybe you can derive something from this...
The two adjacent rows of "##sending 0x4021F244" show the problem.
Thanks in advance, once again.