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

nRF52 - SWD - ICSP

//Hi Everyone! //I am programming a nRF52832 through the SDW interface and am having trouble answering some questions.

//So, first off is simply checking my understanding of the programming flow.

power chip //apply power to device.

// I have seen some literature saying there needs to be an access code sent here. y/n?

write 0x50000000 to DP a[3:2] = 0b01 (CTRL/STAT) //Requests power up

read 0xA0000000 from DP DP a[3:2] = 0b01 (CTRL/STAT) //Ack power on

// Some literature says there needs to be an DP - IDCODE read here. y/n?

write 0x???????? to DP a[3:2] = 0b10 (SELECT) //Set up write to CTRL-AP

write 0x00000001 to AP a[3:2] = 0b01 (ERASEALL) // Erase the chip and remove protection.

write 0xFC0000F0 to DP a[3:2] = 0b10 (SELECT) //Set up write to MEM-AP (BASE)

write 0x4001E000 to AP a[3:2] = 0b10 (BASE) //Write base adress of NVMCR

write 0x04000000 to DP a[3:2] = 0b01 (SELECT) //Set up write to MEM-AP (TAR)

write 0x00000504 to AP a[3:2] = 0b10 (TAR) //Point to CONFIG of NVMC

write 0x0C000000 to DP a[3:2] = 0b11 (SELECT) //Set up write to MEM-AP (DRW)

write 0x00000003 to AP a[3:2] = 0b10 (DRW) //Point to set up data to NVMC

// Now I haven't seen literature about how to trigger the write; or even that this is the correct way to set one up. Clarification would be great.

//At this point all my registers should be set up and I believe that through using the TAR and DRW/BD[0-3] I can send out data to flash. However I could not find any information on how to declare how much data to write out of the BD[1-3] or even to do so at all. Is this just the "size" field in the CSW of the MEM-AP?

//Thanks for the help!

Related