This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrfjprog.dll - nrfjprogdll_go not starting SoC

Hi

I used nrfjprog.dll in our internal software. implementation is in C#.

Everything works just fine - except for the last call to NRFJPROGDLL_go - it seems like it starts the proc for a couple mseccs, then it returns to halted state.

If I call it from command line (nrfjprog -f nrf51 --run) everything is fine and the device starts to work...

Is there any more detailed information on how the commands --run and --go are implemtend in nrfjprog?
I already had a look pynrfjprog but this does not give any insight on this issue.

I'm usijng the latest version of nrf command line tools.

Any hints?

Parents
  • Do you perform any actions after _go() ? Some functions in the nRFJProg DLL halt the processor to ensure data integrity.

    If possible, could you post the nRFJProg log, or a pseudocode of your script?

  • Hi

    pseudo code below:

    void flashingDevice(){
        
        NRFJProg.NRFJPROG_open_dll ();
        
        NRFJProg.NRFJPROG_is_dll_open( ref open );
        
        if(open){
            NRFJProg.NRFJPROG_is_connected_to_emu( ref connected );
            
            if(!connected){
                NRFJProg.NRFJPROG_connect_to_emu_without_snr( 8000 );
                
                NRFJProg.NRFJPROG_read_connected_emu_snr( ref serial );
                
                NRFJProg.NRFJPROG_connect_to_device();
                
                // GET SOME DEVICE INFOS
                NRFJProg.NRFJPROG_is_connected_to_device( ref deviceConnected );
                if ( deviceConnected ) {
                    NRFJProg.NRFJPROG_halt();
                    Thread.Sleep( 200 );
                    
                    NRFJProg.NRFJPROG_is_halted( ref halted );
                    
                    NRFJProg.NRFJPROG_erase_all();
                    
                    foreach(cell in sdHex){
                        NRFJProg.NRFJPROG_write(cell, ...);
                    }
                    
                    foreach(cell in fwHex){
                        NRFJProg.NRFJPROG_write(cell, ...);
                    }
                    
                    // SET DATA TO UICR
                    NRFJProg.NRFJPROG_write_u32();
    
                    if(protect)
                    NRFJProg.NRFJPROG_readback_protect(NRFJProg.readback_protection_status_t.ALL);
                    
                    // Write some more data to RAM
                    NRFJProg.NRFJPROG_write_u32();
                    Thread.Sleep( 200 );
                    
                    // JUST A TRY
                    //NRFJProg.NRFJPROG_sys_reset();
                    //Thread.Sleep( 400 );
                    
                    NRFJProg.NRFJPROG_go();
                    Thread.Sleep( 400 );
                    
                    NRFJProg.NRFJPROG_disconnect_from_device();
                    
                    // becoming desperate
                    NRFJProg.NRFJPROG_go();
                }
            }
            
            NRFJProg.NRFJPROG_disconnect_from_emu();
        }
    }

  • Ah, you're protecting, then doing go?

    You should perform a debug reset instead, this will reset your device and start the program. Since you've enabled readback protection, the go probably fails, as you no longer have access to the core.

  • currently I'm not setting protection, this was also one of my first thoughts.

    should I do a debug_reset instead of sys_reset anyways?

Reply Children
Related