Hi,
To manufacturer production I would like to use the nrfjprog.dll in order to make an WPF C# application to program our NRF device.
I would like to use your nrfjprog.dll to do that.
I successfully import the nrfjprog.dll but when i want to pen the dll i alway have an failure error when opening the JLink ARM.
My code is as following :
namespace Programateur_NRF52 { /// <summary> /// Logique d'interaction pour MainWindow.xaml /// </summary> public partial class MainWindow : Window { static string JLinkPath = "C:\\Users\\JulienFERRER\\Desktop\\Workspace\\dev\\Script_Programmation\\Programateur_NRF52\\Programateur_NRF52\\bin\\Release\\JLINKARM.dll"; [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void msg_callback_cb([In, MarshalAs(UnmanagedType.LPStr)] string msg_str); private void msg_callback([In, MarshalAs(UnmanagedType.LPStr)] string msg_str) { textBlock = msg_str + "\r\n"; return; } //Instance to keep the garbage collector from removing it. private msg_callback_cb mCallBack; [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_dll_version(out int major, out int minor, out char revision); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_is_dll_open(out bool opened); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_open_dll(string jlink_path, System.IntPtr cb, int family); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void NRFJPROG_close_dll(); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_connect_to_emu_with_snr(out int serial_number, out int clock_speed_in_khz); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_connect_to_emu_without_snr(int clock_speed_in_khz); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_connect_to_device(); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_is_rtt_started(out bool started); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_set_control_block_address(int address); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_start(); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_is_control_block_found(out bool is_control_block_found); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_stop(); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_read(int up_channel_index, out char data, int data_len, out int data_read); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_write(int down_channel_index, [In, MarshalAs(UnmanagedType.LPWStr)] string data, int data_len, out int data_written); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_rtt_read_channel_count(out int down_channel_number, out int up_channel_number); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_read_device_family(out int family); [DllImport("nrfjprog.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int NRFJPROG_read_device_version(out int version); public MainWindow() { //Create an instance of the callback mCallBack = new msg_callback_cb(msg_callback); InitializeComponent(); } private void Button_Click_programme(object sender, RoutedEventArgs e) { int major, minor; char revision; bool open, started, found; open = true; int return_value; int clock_speed_in_khz = 4000; int down_channel_number, up_channel_number; NRFJPROG_close_dll(); return_value = NRFJPROG_open_dll(JLinkPath, Marshal.GetFunctionPointerForDelegate<msg_callback_cb>(mCallBack), 1); return_value = NRFJPROG_is_dll_open(out open); return_value = NRFJPROG_dll_version(out major, out minor, out revision); }
When I call the function NRFJPROG_open_dll i get the answer -101(JLINKARM_DLL_COULD_NOT_BE_OPENED) and this on the message calback
[Debug ] [nRF ] open_dll
[Debug ] [nRF ] Load library at C:\Users\JulienFERRER\Desktop\Workspace\dev\Script_Programmation\Programateur_NRF52\Programateur_NRF52\bin\Release\JLINKARM_NRF52_NRFJPROG.dll.
[Debug ] [nRF ] Library loaded, loading member functions.
[Debug ] [nRF ] Member functions succesfully loaded.
[Debug ] [Backend ] Logger callback at 0x2307e9e52ac registered in Segger backend logger.
[Debug ] [JLink ] Logger callback at 0x2307e9e52ac registered in JLink logger.
[Debug ] [nRF52 ] open
[Debug ] [Backend ] open_dll
[Debug ] [Backend ] Load library at C:\Users\JulienFERRER\Desktop\Workspace\dev\Script_Programmation\Programateur_NRF52\Programateur_NRF52\bin\Release\JLINKARM.dll.
[Debug ] [Backend ] GetErrorInfo failed.
[Debug ] [Backend ] Dll failed to open.
[Debug ] [Backend ] close
[Debug ] [Backend ] Segger Backend closed.
[Debug ] [nRF52 ] close
[Debug ] [nRF52 ] nRF family DLL closed
[Debug ] [nRF ] close_dll
My version of nrfjrpog.dll is 10.10.0.0 and for JLinkArm.dll i try with 6.80e and 6.12a.
If someone can help me with this issue i take it because i'm completly block at this moment.
Thanks,