EFM02 error while outputting data continuously

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • EFM02 error while outputting data continuously

      Hi

      When I modified the example code to continually log data out of one of the peripherals by putting the read block and fwrite commands inside an infinite loop, I get the following error after a few iterations of the loop. What is this error ?

      "ERR: Failed to write data to device (using bulk transfer).: LIBUSB_ERROR_TIMEOUT"
    • I am running the example.cpp code using Visual Studio 2015 in a Windows machine. I actually observe the same error when I run the example cpp code in a Linux machine running Ubuntu 14.04 as well. Initially I had this scheme working. But recently it stopped exiting the loop after a few iterations typically 8.
    • Hello arve9066,

      I have tried example.cpp on a Windows 7 Ultimate 64 Bit version, installed the UDK3 driver
      named udk3usb-drivers-windows-1.2.exe, and compiled the example.cpp with the current
      update 3 of Visual Studio 2015, and my output is:

      .\c-c++\bin\debug>.\example++
      UDK3 version : 1.4
      Device found:
      Name : EFM02/B
      Bus : 2
      Vid : 10f8
      Pid : c582
      UserId :
      SerialNumber : B141xxxxx
      FirmwareVersion : 1.3
      MaxTransferSize : 16777216 bytes
      DerivateInfo : XC6SLX150-3FGG484I
      DerivateId : 0x00000001
      EFM02 specific test
      ---------------------------------------------
      LED: #-#-#-#-#-#-#-#-#-#-
      Write/read RAM
      Address: 0x03f00000
      Read and save flash

      So this program runs as expected on my machine. Which loop do you mean? The LED blinking
      loop in function efm02Test(), on line example.cpp:174 ? Please include the output of program
      example++.exe on your machine. The problem you describe seems to be a loss of USB connection.
      If such a problem occurs, sometimes it helps using EFM-02 without a USB hub in between, trying
      a different USB port on a PC, using a different PC with a different chipset, or using a different
      USB cable. If all of these measures don't get your EFM-02 to work properly with this example
      program, then maybe your EFM-02 is defective.

      Best regards,

      Manfred R.
      Software Development
      Cesys GmbH
    • This is the output from the debug log of Visual Studio 2015


      'example++.exe' (Win32): Loaded 'C:\Users\aravind\Desktop\CU\FPGA\UDK Windows Files\udk3-api-and-examples-windows-1.4\c-c++\bin\debug\example++.exe'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Users\aravind\Desktop\CU\FPGA\UDK Windows Files\udk3-api-and-examples-windows-1.4\c-c++\bin\debug\udk3-1.4-x86.dll'. Module was built without symbols.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-timezone-l1-1-0.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l2-1-0.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-localization-l1-2-0.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-processthreads-l1-1-1.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l1-2-0.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Users\aravind\Desktop\CU\FPGA\UDK Windows Files\udk3-api-and-examples-windows-1.4\c-c++\bin\debug\udk3mod-1.4-winusb-x86.dll'. Module was built without symbols.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winusb.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Symbols loaded.
      'example++.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Symbols loaded.
      Exception thrown at 0x7681C54F in example++.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0036F214.
      Exception thrown at 0x7681C54F in example++.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0036F384.
      The program '[5132] example++.exe' has exited with code 0 (0x0).


      I had edited the code part of transferring 64MB from RAM as follows

      void efm02Test(Device &d)

      {
      cout << "EFM02 specific test " << endl;
      cout << "---------------------------------------------" << endl;
      d.getDeviceInfo().getDerivateId();

      const uint32_t AdcBase = 0x10000000;
      cout << "Write/read ADC values" << endl;
      const uint32_t blockSize = 1 * 1024 * 1024;
      std::vector<uint8_t> inb(blockSize, 0);
      const uint32_t absAddress = AdcBase;
      cout << "\r Address: 0x" << setw(8) << hex << absAddress << flush;

      for (uint32_t i = 0; i < 64; ++i)
      {
      d.readBlock(absAddress, inb);
      cout << endl;
      cout << "save adc values to file" << endl;
      fstream("./efm02_adc.bin", ios::out | ios::binary | ios::app)
      .write((char*)&inb[0], inb.size());
      }
      }

      I want to read data continuously from an ADC whose values are read to the P2H FIFO. I have no other slave devices. Initially this scheme worked with the loop going through successfully all the time through to 64 and saving the required amount of data (64 or whatever number I put there). I even had an infinite loop there which used to run continuously till I exited the loop forcefully by quitting the program. But off late the program exits after running 8 times ( always) which is not clear.
    • Dear arve9066,

      now I understand your situation. You have both created a FPGA bitstream "efm02_adc.bin" for your
      specific application and you have adapted example.cpp for testing with this bitstream. Please
      understand that CESYS cannot debug your FPGA designs and/or host programs for your FPGA
      design for free. If you need assistance in this field, you can ask CESYS via sales@cesys.com for
      a support package for FPGA-based development. I regret I can't help you for the time being.

      Best regards,

      Manfred R.
      Software Development
      Cesys GmbH
    • Ok. I figured out the problem myself. It was an just issue of the code not getting to the state S_DECODE for the second time.

      I had another question for you to better understand the design and the board. What is the major impact of the payload size being limited to 16MB in the board. As in, in the example code example.cpp for transferring 64MB data from flash storage one block size is defined as 1MByte , "const uint32_t blockSize = 1 * 1024 * 1024;"

      What would happen if this is increased to say 20MB which is more than 16MB?
    • Hello arve9066,

      the block sizes in example.cpp apply to Device.readBlock() and Device.writeBlock() methods.
      For EFM-02, these methods initiate USB data transfers. The block sizes you can specify there
      are arbitrary, but are translated to low-level 8 KByte USB transfers. You cannot change the
      low-level 8 KByte USB transfer size. For more information about this, please see

      cesys.com/fileadmin/user_uploa…dk3-transfer-protocol.pdf

      When you optimize your application by changing block sizes, I do not have any general rules
      or caveats for you. Usually this sort of thing requires a lot of experimenting and testing.

      Best regards,

      Manfred R.
      Software Development
      Cesys GmbH
    • Thanks!

      I am just trying to figure out what the 16MB max transfer limit mentioned on the board spec means for my design. For example, if I specify the block size as 80K, it is equivalent to ten 8K low level USB transfers. This is will be the case till the block size remains less than 16MB. If the required data is say 20MB, is it equivalent to two function calls, say one 16MB and 0ne 4MB with each being further split down to low level 8K transfers?
    • Hello arve9066,

      > is there a specification on the time elapsed between those two calls then? As in if I am sampling
      > real time data and ask for 20MB of data, after the 16MB of data is sampled, how much real time
      > data will I lose while waiting for the next call of 4MB(or any size for that matter)?

      you are asking for real time constraints on a given system with a certain hardware and a certain
      operating system. Such real time constraints are available for a given system only if you are using
      a real time operating system (RTOS). CESYS does not offer drivers for the EFM-02 on an RTOS,
      so no, there are no guarateed latency times we can give you.

      Now if you are attempting to meet real time constraints on a non-real-time operating system such
      as Windows or Ubuntu Linux, then you can measure your latency times, and if your latencies do
      not meet your needs, you can try to improve them by altering operating system settings, changing
      your FPGA designs, firmware and/or host software, and maybe optimizing your hardware for it.
      There is no easy and completely safe way to do this.

      This is a common problem we face in our custom engineering contract work, too. Please
      understand that we do not solve such problems free of charge.

      Best regards,

      Manfred R.
      Software Development
      Cesys GmbH