Menu

FC Block download: insert refused

Mark Konst
2014-04-06
2014-04-10
  • Mark Konst

    Mark Konst - 2014-04-06

    Hello,

    When I try to download an FC into my S7-300 (IM-151-8), I'm getting a client error 0h01B, which says the block insert was refused. All other functions seem to work well.

    What I did is a full upload of an FC1. I copied the byte array to a new byte array with the right size, and then tried to download it to a new block number 2. Both in my own C#.NET application and in the SNAP7 Client Demo I got the same error.

    I've tried both the switch positions STOP and RUN-P. I've turned of any protections. So no passwords are applicable.

    I hope someone can help me with this. I've waited a long time for a function like this. It would be great if it would work!

    Great library by the way!

    Thanks,
    Mark

     
  • Mark Konst

    Mark Konst - 2014-04-06

    Hello,

    Maybe I found something (check attachment). It looks like header and footer are a bit different from the original Siemens communication. I'm not sure if the header deviation is a problem, but in the footer the checksum seems to be missing. That would probably cause the rejection.

    If anyone has anymore questions, I am always willing to answer them.

    Thanks,
    Mark

     
  • Davide Nardella

    Davide Nardella - 2014-04-08

    Hi Mark,
    It's not a checksum issue, there was a bug during the "insert" command at the end of the download sequence.
    I used "BlockNum" variable that was modified by the start sequence block.
    Now I store BlockNum into StoreBlockNum before the start sequence and then I restore it.

    You will find the fix into next 1.2.1 release.
    Or I can send you the library source, or send me an address that can receive binary attachments so I can send you also the binary libraries (I suppose that you are under windows).

    Please use either mp xor discussion forum, not both.

    Regards
    Dave

     
    • Mark Konst

      Mark Konst - 2014-04-08

      Hello Dave,

      Thanks for your answer. I can't wait to try it. Can you send me the source and .dll files in a .zip to my email?

      I had some problems with the Snap7.dll because .NET didn't accept it as a valid COM object. If I build the C++ VS.NET2010 project and try to reference the output .dll to a C# project, it won't work.

      So I took both Snap7.dll and Snap7.net.dll from the examples. The Snap7.net.dll was easy to reference. So could you also send me the Snap7.net.dll? Or is there an easy way to generate this?

      Indeed I use Windows.

      Thanks,
      Mark

       

      Last edit: Mark Konst 2014-04-08
  • Davide Nardella

    Davide Nardella - 2014-04-09

    Hello,
    Snap7.net.dll is not a com object, it's just a class library.

    The Snap7.net.dll deployed is functional to the examples deployed, it was compiled with VS2012 and .NET Framework 4.5, it doesn't work with VS2010 and below.

    It's just a "compiled wrapper", to make it compatible with all versions I would have to deploy the .net 3.5, .net 4.0, .net 3.5 and the 32 bit release, 64 bit release and so on...

    You have two ways:
    1) Import directly snap7.net.cs into your project (it's valid only if you program with c#)
    2) Open the prompt that you find in "Visual Studio Tools" (subfolder of Microsoft Visual studio XXXX in "all programs" of your PC) and run dotnet.bat, it will recompile the .net dll and all the examples with your compiler and your default ,net framework.
    Into examples\dot.net\winbin you will find the new snap7.net.dll.

    You can also modify dotnet.bat (currently it uses /platform:anycpu) to change the platform and/or the framework.
    I didn't explained it in depth because I supposed it to be a base task for a .net programmer.

    In the same way (more simply) you can rebuild the library itself:
    Open the solution VS2010.sln from \build\windows\VS2010 and simply rebuild the solution (for both platforms 32/64 bit). Into build/bin/Win32 and Win64 you will find the new binary libraries snap7.dll.

    I will send you asap the source folder (overwrite the current one) and the two snap7.dll (32/64).
    You should generate Snap7.net.dll yourself with your current compiler/Framework/OS/Platform as I explained.

    Let me know ...

    Regards
    Dave

     
  • Mark Konst

    Mark Konst - 2014-04-10

    Hi Dave,

    Perfect! Everything works fine now. Thanks very much. So the checksum is not important for the PLC. Probably it's just used as a check in Step 7, for code comparison etc. I can now download FC's and i've generated a few myself.

    Now trying to unravel the exact build up of MC7 code.

    Regards,
    Mark

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.