STM32F407 Debugging via JTAG: STICKYERR issue with DHCSR register access

79 Views Asked by At

I am playing with debugging STM32F407 via JTAG protocol and DAP interface etc. I want to use the DHCSR register to stop the processor (set the C_HALT bit in this register). And to do this through the interface DAP need to configure the register CSW, write the address of DHCSR in the register TAR and the necessary data in the register DRW, all this I do but after all this procedure I constantly get an error STICKYERR in the DAP register CTRL/STAT and accordingly can not read the register DHCSR or write to it. What I do wrong?

I attempted to halt the STM32F407 processor using the DHCSR register via the JTAG protocol and DAP interface. My steps:

  • Write 0b1010 (the DPACC register code) into the IR register.
  • Some settings in the AP register CSW need to be configured. To access this register, we need to select the corresponding AP and register bank in the DP SELECT register. Write to the DR register:
    • DATA[31:0] = 0x00
      • APSEL[31:24] = 0x00
      • APBANKSEL[7:4] = 0x00
    • A[3:2] = 0b10 (address of SELECT register)
    • RnW = 0b0
  • Next, we need to write the CSW register. Since this is an AP register, we need to use the APACC register to access it:
    • Write 0b1011 (the APACC register code) into the IR register.
  • Form the data for the configuration: set the data size for writing to 32-bits (Size[0:2] = 0b010), disable the auto-increment function of the address (AddrInc[5:4] = 0b00). Write to DR:
    • DATA[31:0] = 0x2200 0002 (MasterType=1, Hprot1=1, Size=b010)
    • A[3:2] = 0b00 (address of CSW register)
    • RnW = 0b0
  • Then we need to set the address of the memory cell to which we want to write the data. This is done through the AP register TAR. And since this register belongs to the same AP as CSW and is in the same bank, we can omit the reference to the DP SELECT register and immediately write the address value. Write to DR:
    • DATA[31:0] = 0xE000EDF0
    • A[3:2] = 0b01 (address of TAR register)
    • RnW = 0b0
  • The last step is to actually write the data. To do this, we need to write them to the DRW register. Write to DRW:
    • DATA[31:0] = 0x03
    • A[3:2] = 0b11 (address of DRW register)
    • RnW = 0b0

After this I got STICKYERR in the DAP register `CTRL/STAT.

0

There are 0 best solutions below