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

SWD interface changing phase from send to receive?

Is there a more thorough documentation of the SWD interface as implemented on the nRF chips?

I'm seeing something I regard as strange when I look at things on a scope.

In order to make my nRF51822 accept a command (IDCODE for instance) I have to send the 0xA5 such that SWDIO changes on a falling SWDCLK but samples on the rising edge.

However, when the chip sends me back data that appears to change and the nRF chip changes SWDIO on a rising SWDCLK and I have to sample it on the falling edge.

That very definitely does NOT match any of the diagrams from ARM I have seen. The diagrams NEVER demonstrate a change of phase.

In addition, all of the diagrams indicate that data should change on rising edge and sample on falling edge. This is not what the nRF chips seem to be doing during the sending of the command.

However, there is a common convention in SPI that diagrams are meant to represent the transition from active to idle and is normally controlled by the Polarity and Phase bits. What is NOT common convention is changing the phase mid-transaction.

Am I missing something? I really tried to RTFM. But I'm perfectly willing to accept that I missed something that's actually documented--just point me at it.

Thanks.

(The use case here is that I need multiple programmers that can be located at the manufacturing line and that can program and can do a bit of functional test so that we can fail defective units at the line where they can be inspected in more detail and possibly reworked.)

Parents
  • Upvoted. Thanks for an actual reference with edges in it. You'd think ARM would put this in their other documentation somewhere.

    Yeah, the turnaround looks stupid from an outside point of view, but after thinking about it for a while it makes sense when you consider that that target has no running clock other than what is being provided by the debug probe.

    On target receive, the target has to 1) Sample on clock rising edge and then 2) do something with that sample on the clock falling edge. On target transmit, the target has to 1) Prepare something on clock falling edge and then 2) put that something on the line on the clock rising edge.

    And that's why the turnaround cycles are where they are. That way the system has an extra clock cycle to do something when it has to.

    Sigh. All this effort to avoid using 3 signals (SCK, SDO, SDI) instead of two (SCK, SDO/SDI) when most people would rather have the ability to use a dedicated SWO-like signal anyway.

Reply
  • Upvoted. Thanks for an actual reference with edges in it. You'd think ARM would put this in their other documentation somewhere.

    Yeah, the turnaround looks stupid from an outside point of view, but after thinking about it for a while it makes sense when you consider that that target has no running clock other than what is being provided by the debug probe.

    On target receive, the target has to 1) Sample on clock rising edge and then 2) do something with that sample on the clock falling edge. On target transmit, the target has to 1) Prepare something on clock falling edge and then 2) put that something on the line on the clock rising edge.

    And that's why the turnaround cycles are where they are. That way the system has an extra clock cycle to do something when it has to.

    Sigh. All this effort to avoid using 3 signals (SCK, SDO, SDI) instead of two (SCK, SDO/SDI) when most people would rather have the ability to use a dedicated SWO-like signal anyway.

Children
No Data
Related