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

Writing variable in RAM after programming

Hello,

i want to write a global unsigned long variable in RAM after programming the device. The Use-Case is to set the clock value to the actual time. So the new unsigned long value will be generated from the host PC from the actual time. This new value should be set via the SWD interface. Is that possible by using the --ramwr option from nrfjprog.exe? We will use the Segger Flasher ARM.

Thanks and regards, BTprogrammer

  • Good moorning, now I tried the JLink Commander. First I did

    h
    

    then I did

    w4 0x20002990, 0x55E7EAF0
    

    But when I read back the memory, I get:

    mem32 0x20002990, 1: 20002992 = 00000000
    

    I expected to get 55E7EAF0, when I read back the memory!? Also in my application, it seems that the memory doesn`t have the right value... Any ideas? Do I have to unlock the memory in any way?

  • works perfectly for me - no unlocking needed, it's RAM. As long as the processor is halted, it writes to the memory.

  • removed and turned into an answer as comments don't format properly

  • J-Link>halt
    PC = 0001D5C6, CycleCnt = A86EB1D0  
    R0 = FFFFFFFF, R1 = FFFFFFFF, R2 = 00000003, R3 = 0001F000
    R4 = FFFFFFFF, R5 = 00000000, R6 = 00000000, R7 = 00000000
    R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    R12= 00000000
    SP(R13)= 200021F0, MSP= 200021F0, PSP= 00000000, R14(LR) = FFFFFFFF
    XPSR = 61000000: APSR = nZCvq, EPSR = 01000000, IPSR = 000 (NoException)
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    FPU regs: FPU not enabled / not implemented on connected CPU.
    J-Link>mem32 0x20000000, 1
    20000000 = 00003000 
    J-Link>mem32 0x20002990, 1
    20002990 = 772CCFFD 
    J-Link>w4 0x20002990, 0x12345678
    Writing 12345678 -> 20002990
    J-Link>mem32 0x20002990, 1
    20002990 = 12345678 
    

    that happens to be an NRF52 board because it was on the table, but it works fine as you can see

Related