<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.7">Jekyll</generator><link href="https://joshuafurlow.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://joshuafurlow.github.io/" rel="alternate" type="text/html" /><updated>2020-06-11T11:51:03+00:00</updated><id>https://joshuafurlow.github.io/feed.xml</id><title type="html">Machine Vision Software Engineering Blog</title><subtitle>A blog covering Machine Vision Software Engineering and topics around C#, WPF, Xaml, Cognex VisionPro, Flir, etc.</subtitle><entry><title type="html">GigE Vision Acquisition Failed Troubleshoot Guide</title><link href="https://joshuafurlow.github.io/GiGE-Vision-Acquisition-Issues/" rel="alternate" type="text/html" title="GigE Vision Acquisition Failed Troubleshoot Guide" /><published>2020-06-11T00:00:00+00:00</published><updated>2020-06-11T00:00:00+00:00</updated><id>https://joshuafurlow.github.io/GiGE-Vision-Acquisition-Issues</id><content type="html" xml:base="https://joshuafurlow.github.io/GiGE-Vision-Acquisition-Issues/">&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;I had been thinking about starting a developer blog for awhile, but didn’t know how I would start it off. I work for a Machine Vision company and write Machine Vision applications with Cognex VisionPro and C#/WPF. Cognex VisionPro is a niche piece of software which many developers will have never heard of unless they work in the field of Machine Vision and therefore there is actually very little on the internet. Since I’ve been working with this software for more than 4 years. I thought I would start writing this blog to help other engineers that come across the same problems.&lt;/p&gt;

&lt;h1 id=&quot;the-acquisition-failed-abnormally-buffer-retrieve-failed-too_many_consecutive_resends&quot;&gt;The acquisition failed abnormally. (Buffer retrieve failed (TOO_MANY_CONSECUTIVE_RESENDS)&lt;/h1&gt;

&lt;p&gt;I spotted a question on reddit asking about an issue with acquiring images from a GiGE camera in &lt;a href=&quot;https://www.cognex.com/en-gb/products/machine-vision/vision-software/visionpro-software&quot;&gt;Cognex VisionPro&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The acquisition failed abnormally. (Buffer retrieve failed (TOO_MANY_CONSECUTIVE_RESENDS)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is a really annoying issue where you try to acquire an image and VisionPro just doesn’t retrieve the image. There is some information on the topic scattered on the internet see the links in &lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;. Cognex don’t include anything in their CHM documentation and best help I could find from Cognex was this &lt;a href=&quot;https://support.cognex.com/docs/vpro_950sr2/EN/GigEGuide.pdf&quot;&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;These are my notes I’ve made over the last year or so on how to resolve the issue, some of the information has been copied and pasted and slightly rewritten from other sources.&lt;/p&gt;

&lt;h1 id=&quot;theory&quot;&gt;Theory&lt;/h1&gt;

&lt;h2 id=&quot;why-gige-vision-fails-easily&quot;&gt;Why GigE vision fails easily&lt;/h2&gt;

&lt;p&gt;GigE vision sends data over the network via UDP packets. UDP packets are sent from the sender to the receiver with no confirmation that the packet has been received by the receiver. As opposed to TCP where the receiver can request packets dropped by the network. With GigE vision a packet resend request can be issued, but the protocol only allows for a few packets to be resent. Due to the high data rate at which cameras will send data, switches and network interface cards are not always able to keep up with the rate at which data is sent and so they drop the packets which results in the acquisition failing.&lt;/p&gt;

&lt;p&gt;Most commonly you will have issues with laptop and USB Ethernet adapters. This can be because the laptop doesn’t support Jumbo frames or only supports upto 4KB jumbo frames and not 9KB. Or your using a USB adapter that supports Jumbo frames, but cannot process the quantity of data arriving and drops frames.&lt;/p&gt;

&lt;h2 id=&quot;why-does-gige-vision-use-udp-and-not-tcp&quot;&gt;Why does GigE Vision use UDP and not TCP&lt;/h2&gt;

&lt;p&gt;GigE vision uses UDP to increase the bandwidth available for data transfer because UDP doesn’t require receive confirmation packets to be sent back to the sender. This allows for shorter transfers times and higher frame rates. The downside is that the protocol is more susceptible to lost of corrupted packets as they cannot be resent continuously until they are received as they can with TCP&lt;/p&gt;

&lt;h1 id=&quot;solution&quot;&gt;Solution&lt;/h1&gt;

&lt;h2 id=&quot;hardware-setup&quot;&gt;Hardware setup&lt;/h2&gt;

&lt;p&gt;An ideal setup would consist of the following&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Built in or PCIE Intel Ethernet card (&lt;strong&gt;Intel&lt;/strong&gt; cards are specified as the best, avoid &lt;strong&gt;Killer Networks&lt;/strong&gt; and &lt;strong&gt;Realtek&lt;/strong&gt; cards if you can)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Set 9KB Jumbo Frames&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Hard wired connection, no Wi-Fi as packets will be easily dropped&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Only use the NIC for camera acquisition, don’t use it for general purpose LAN access for internet or RDP. This data can cause issues with the time sensitive transmission of GigE vision data. (If using multiple cameras with a switch you’ll need to setup interpacket delay and frame start delay).&lt;/p&gt;

    &lt;blockquote&gt;
      &lt;p&gt;Lots of laptops and USB ethernet adapters use Realtek cards and many don’t have 9KB jumbo frames and only support 4KB frames. Even if they do support 9KB frames they can’t always deal with the large quantity of data and should be avoided if possible.&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;software-setup&quot;&gt;Software setup&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Set &lt;strong&gt;Jumbo Frames&lt;/strong&gt; to 9KB&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Set &lt;strong&gt;Receive Buffers&lt;/strong&gt; to highest possible (not always an option)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Set &lt;strong&gt;Interrupt moderation&lt;/strong&gt; to Extreme (not always an option)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Disable all the drivers/services on the network interface other than &lt;strong&gt;IPv4&lt;/strong&gt; and the &lt;strong&gt;eBus Universal Pro Driver&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Disable any firewalls on that interface&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Ensure every device supports 9KB jumbo frames. Frame grabbers, switches, POE injectors must all support jumbo frames. Use the command &lt;strong&gt;&lt;em&gt;ping -l 9000 192.168.x.y&lt;/em&gt;&lt;/strong&gt; to test if you can ping your device with a 9KB jumbo frame, this ensures all the devices will work with 9KB jumbo frames&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;If using a managed switch disable any storm control prevention or DDoS attack prevention. These can get confused at shut off the connections as they think its a DDoS or storm.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;my-ethernet-adapter-doesnt-support-9kb-jumbo&quot;&gt;My Ethernet adapter doesn’t support 9KB Jumbo&lt;/h2&gt;

&lt;p&gt;The good news is you can get your camera to acquire images. However you wont be able to acquire at the maximum frame rate of the camera because more packets will be sent from the camera to the PC causing more interrupts and higher CPU usage. Your CPU probably won’t be able to keep up and will drop the packets. You can prevent packet dropping by delaying the rate at which the camera sends packets by adjusting the &lt;strong&gt;Interframe packet delay&lt;/strong&gt; or &lt;strong&gt;Steam Channel Packet Delay&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Follow all the settings in &lt;a href=&quot;#hardware-setup&quot;&gt;Hardware setup&lt;/a&gt; and &lt;a href=&quot;#software-setup&quot;&gt;Software Setup&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Go to the &lt;strong&gt;Custom Properties&lt;/strong&gt; in the camera settings&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Add the property &lt;strong&gt;GevSCPD&lt;/strong&gt; located at TransportLayerControl -&amp;gt; GigE Vision -&amp;gt; GevSCPD&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Increase the value until acquisition becomes stable it might take a very high value compared to the default. This value is in ticks and according to &lt;a href=&quot;https://docs.baslerweb.com/network-related-parameters-%28gige-cameras%29.html&quot;&gt;basler&lt;/a&gt; a tick is worth 8ns. So you might have to increase the value quite high. Just test and see what works.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; This increases the time delay between each packet and gives switches and NICs more time to process the data. This is more necessary when using small packets as the smaller size packets create 6 times more CPU interrupts (9000/1500) and the CPU cannot keep up with that many packets arriving and will drop the packets. The downside is that this slows down the frame rate of acquisition so might not be suitable for high speed application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;references&quot;&gt;References&lt;/h1&gt;
&lt;p&gt;https://support.swingcatalyst.com/hc/en-us/articles/205460708-Gigabit-Ethernet-GigE-Vision-camera-network-recommendations&lt;/p&gt;

&lt;p&gt;https://www.flir.com/support-center/iis/machine-vision/application-note/troubleshooting-image-consistency-errors&lt;/p&gt;

&lt;p&gt;https://www.flir.co.uk/support-center/iis/machine-vision/application-note/understanding-buffer-handling/&lt;/p&gt;

&lt;p&gt;https://www.flir.co.uk/support-center/iis/machine-vision/application-note/troubleshooting-image-consistency-errors/&lt;/p&gt;

&lt;p&gt;https://support.cognex.com/docs/vpro_950sr2/EN/GigEGuide.pdf&lt;/p&gt;</content><author><name></name></author><summary type="html">Introduction</summary></entry></feed>