LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading etherCAT sensor readings in FPGA project

I'm working on a project and I try to complete the following task.

I have torque sensors which are connected to a etherCAT module. This etherCAT module is connected to one of the ethernet port on cRIO 9047.

How is it possible to get the data from the EtherCAT module and into the labview FPGA project. I don't know how to set up the communication inside labview.



 

0 Kudos
Message 1 of 12
(2,825 Views)

Hi mkstech,

 

the Ethernet port of the cRIO is handled by the RT part of the software stack.

So you need to read those sensor values in your RT host VI.

(The last time I used an EtherCAT chassis I used SharedVariables to do that.)

 

Then you implement some data communication between RT and FPGA: this is explained in all those example VIs and projects coming with LabVIEW (and the RT and FPGA module)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(2,818 Views)

Okay. 

I guess that RT stands for Real-Time module 🙂 

I need to sample with a frequency of 20 kHz. Is the RT-module capable of doing this and sending this to the FPGA target?? 

0 Kudos
Message 3 of 12
(2,814 Views)

Hi mkstech,

 

I need to sample with a frequency of 20 kHz. Is the RT-module capable of doing this and sending this to the FPGA target??

Is your EtherCAT chassis (and module) able to sample at 20kHz sample rate?

The RT surely cannot sample at 20kHz using a "single sample by sample" approach. Once you can read/transfer blocks of samples that might be possible in the RT.

Sending data from RT to FPGA at 20kHz is possible using FIFOs.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(2,806 Views)

Hi mkstech,

If you need a faster scan rate, I suggest that you could use the Raw data mode. The detailed please refer to the following link:https://niweb.natinst.com/confluence/display/TWikiIndustrialcomm/Faster+Scan+Rate.

0 Kudos
Message 5 of 12
(2,788 Views)

@zhengchen wrote:

Hi mkstech,

If you need a faster scan rate, I suggest that you could use the Raw data mode. The detailed please refer to the following link:https://niweb.natinst.com/confluence/display/TWikiIndustrialcomm/Faster+Scan+Rate.


Your link is not available to anyone outside of NI.

0 Kudos
Message 6 of 12
(2,781 Views)

Hi GerdW

Please see my attached picture which is my setup..
 IMG_20190409_083756[1].jpg

 

I have the cRIO 9047 and this is connected to the etherCAT sensor modules. Is this possible?
I don't have an EtherCAT chassis..

0 Kudos
Message 7 of 12
(2,752 Views)

Hi

 

In EtherCAT you typically need an EtherCAT Master e.g. TwinCAT from Beckhoff or some other EtherCAT master e.g. NI. In case of NI you would need the EtherCAT chassis for implementation.

There are many approaches possible.

One would be to turn your PC into an EtherCAT master (I only can talk  from the TwinCAT point of view) and read the data via TwinCAT ADS to your LabVIEW application. (20kHz will not be possible without a few buffering "tricks")

An other option is to write a minimal EtherCAT master on your own. This is very tricky because you need to implement the EtherCAT protocol into your LabVIEW application and will also not help to overcome the speed problem without many tricks. 

 

So from my point of view it is a hard task to achive the result you want to have.

 

 

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 8 of 12
(2,749 Views)

@nottilie wrote:

Hi

 

In EtherCAT you typically need an EtherCAT Master e.g. TwinCAT from Beckhoff or some other EtherCAT master e.g. NI. In case of NI you would need the EtherCAT chassis for implementation.

There are many approaches possible.

One would be to turn your PC into an EtherCAT master (I only can talk  from the TwinCAT point of view) and read the data via TwinCAT ADS to your LabVIEW application. (20kHz will not be possible without a few buffering "tricks")

An other option is to write a minimal EtherCAT master on your own. This is very tricky because you need to implement the EtherCAT protocol into your LabVIEW application and will also not help to overcome the speed problem without many tricks. 

 

So from my point of view it is a hard task to achive the result you want to have.

 

 


It is also a very difficult task from my point of view... I have a Beckhoff PLC which I could use for this EtherCAT master. But how do I read the data to twincat and from there to labview by using buffering tricks??

0 Kudos
Message 9 of 12
(2,740 Views)

That is the point.

The problem is the PLC cycle time. If you want to read 2khz data you need a cycle time of at least 500µs. At every cycle the PLC writes the EtherCAT terminals hardware value into a Buffer in the PLC e.g. for a simple proove of principal a Data Array with position information. 

If you create e.g. an array of 4000 entries you just need to be sure to poll the data via ADS at least every two seconds.

 

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 10 of 12
(2,738 Views)