Quantcast
Viewing all articles
Browse latest Browse all 5103

General • Re: RP2040 SWD entry once more

However I have two issues:
* if I do something in a different way (e.g. NOT reading IDCODE or reading IDCODE before SELECT), things go wrong and I start getting ACKed AP responses with all zeroes as described in topic linked in the beginning.
* in other circumstances (which I do not remember) i get IDCODE 0x0BC12477, on subsequent TARGETSELs (even incorrect) I always get 0x01002927 - it always switches to DP
That sounds like the expected behavior to me. I wouldn't say that the target selection process is fragile but I would say that it has very specific needs since there are 3 devices hanging on the same SWD bus, all listening to see if they should be activated and start responding to requests from the host. This means that you have to send the request in just the right way so that the correct target is activated.

In the ADI v5.2 specification there is a section which describes the process needed to select the target:
B4.3.4 Target selection protocol, SWD protocol version 2
  1. Perform a line reset. See Figure B4-9 on page B4-124.
  2. Write to DP register 0xC, TARGETSEL, where the data indicates the selected target. The target response must
    be ignored. See Figure B4-9 on page B4-124.
  3. Read from the DP register 0x0, DPIDR, to verify that the target has been successfully selected.
A write to the TARGETSEL register must always be followed by a read of the DPIDR register or a line reset. If the response to the DPIDR read is incorrect, or there is no response, the host must start the sequence again.

The target is selected on receiving a line reset sequence.

After receiving a line reset sequence, if the target receives a write request to TARGETSEL that does not select the same target, the target is deselected.

When deselected, the target ignores all accesses and must not drive the line. To select or deselect the target, a write to TARGETSEL must immediately follow a line reset sequence.
Writes to TARGETSEL at any other time are UNPREDICTABLE.
It does seem that the RP2040 has a target which will respond to a DPIDR read right out of reset but doesn't function otherwise. I am not sure what is going on there. However in my experience, if you use the correct target selection process on the RP2040 then things work as expected but if you don't then the RP2040 will sometimes give kind of weird responses.

Statistics: Posted by adam_green — Sat Oct 19, 2024 10:47 pm



Viewing all articles
Browse latest Browse all 5103

Trending Articles