nRF Command Line Tools: nrfdfu.dll 32bit version problem when updating nRF9160 firmware

Dear support team,

we use the Nordic nrfdfu.dll (64bit) in our Win11 C#/.Net application for modem update which works fine.
When we switch our application to 32bit process and change to the Nordic nrfdfu.dll (32bit) the modem update functionality no longer works. The communication start between PC application and nRF9160 modem seems to fail and the application hangs until we stop it after some minutes.


Via DllImport we use the following methods of the nrfdfu.dll: 

        [DllImport(nrfDfuDllName, EntryPoint = "NRFDFU_connect_to_mcuboot_target", CallingConvention = CallingConvention.Cdecl)]
        [DllImport(nrfDfuDllName, EntryPoint = "NRFDFU_connect_to_modemdfu_target", CallingConvention = CallingConvention.Cdecl)]
        [DllImport(nrfDfuDllName, EntryPoint = "NRFDFU_program_package", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        [DllImport(nrfDfuDllName, EntryPoint = "NRFDFU_close_connection", CallingConvention = CallingConvention.Cdecl)]
        [DllImport(nrfDfuDllName, EntryPoint = "NRFDFU_verify_package", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]

Do you have any idea what the reason could be?

Best regards,

Peter   

  • Hello,

    From the log messages you have shared:
    It looks like the error occurs when Windows tries to open the serial port (COM18), and the message is coming from Windows rather than dll. This typically happens if the serial port is already in use by another program (for example another instance of the application still running).

    To verify this, could you try connecting to COM18 using a 32-bit version of PuTTY? If PuTTY can open the connection, it would indicate that  DLL and worker executable are running correctly and that the issue is likely related to another application holding the port. If PuTTY cannot open it, then the port may currently be locked or there may be a Windows configuration issue.

    Kind Regards,

    Abhijith

  • Hi Abhijith, when I just compile the standalone console app as x64, using COM18 is OK. So I doubt, that serial port is blocked by another application.

  • Hello Peter,

    Since the standalone x64 console application can open COM18, the port itself appears to be working. However, this does not completely rule out an issue related to the 32-bit DLL, such as the port already being in use or how the process accesses the port.

    To help rule this out, I recommend trying the 32-bit version of PuTTY, as mentioned in my previous response.

    Kind regards,
    Abhijith

  • Hi Abhijith,

    I'm calling the method NRFDFU_connect_to_modemdfu_target() and for both, 32bit and 64bit , the result value is "0", so it seems to me, that the connection on COM18 is established. after that I'm calling NRFDFU_program_package(). In case of 64 bit everything is OK, in case of 32bit the method NRFDFU_program_package() return -220.

  • Start update
    'testhost.net48.x86.exe' (CLR v4.0.30319: TestSourceHost: Enumerating source (C:\SvnWorks\Toolbox\02 Wilo.Tooling\trunkSvn\AccessoriesCatalog\BasicSmartSensor_UnitTest\bin\Debug\BasicSmartSensor_UnitTest.dll)): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Remote Debugger\x86\Runtime\Microsoft.VisualStudio.Debugger.Runtime.Desktop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    Progress: 1% UserState: Modem Update: Modem is in update mode...
    The thread 14276 has exited with code 0 (0x0).
    The thread 38424 has exited with code 0 (0x0).
    'testhost.net48.x86.exe' (CLR v4.0.30319: TestSourceHost: Enumerating source (C:\SvnWorks\Toolbox\02 Wilo.Tooling\trunkSvn\AccessoriesCatalog\BasicSmartSensor_UnitTest\bin\Debug\BasicSmartSensor_UnitTest.dll)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_13.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    Progress: 2% UserState: Modem Update: Is connected To modem...
    The thread 1316 has exited with code 0 (0x0).
    [UpdateModemDfu] NRFDFU_program_package return -220
    The program '[29312] testhost.net48.x86.exe' has exited with code 4294967295 (0xffffffff).

Related