Segger J-Link Known Issues with FX3/CX3/FX3S - KBA229847

Version 3

    Author : HemanthR_06          Version: **

     

    Question: The following errors are displayed while debugging Cypress FX3/CX3/FX3S USB SuperSpeed Device Controller using the Segger J-Link debugger:

    • ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x3 (TAP Command: 15)
    • ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command: 2) @ Off 0x5

    Why do these errors occur? How do I fix these errors?

     

    Answer:

    These errors might occur with FX3/CX3/FX3S during JTAG debugging using the Segger J-Link:

     

    • ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x3 (TAP Command: 15)

    This error occurs when you Step Into the CyU3PKernelEntry () API of the main function. The CyU3PKernelEntry () API is a non-returnable call and using Step Into for the CyU3PKernelEntry () API will cause the firmware control to be struck at a non-returnable call. This can result in the JTAG debug session, using the J-Link debugger, to break during runtime and throw the TAP Command: 15 error.

     

    Preventing the TAP Command: 15 Error:

    Follow these steps to prevent the TAP Command: 15 error:

      1. By default, the debugger stops at main ().
      2. After reaching the CyU3PKernelEntry () API, do a Step Over so that the control reaches the next breakpoint.
      3. Add another break point at the ThreadEntry function (for example, UVCAppThread_Entry in the UVC firmware provided in AN75779).

    From the default breakpoint at main, you can navigate using Step In or Step Over until the CyU3PKernelEntry () API is reached. Once the control reaches CyU3PKernelEntry(), use Step Over to reach the next breakpoint at the application define function; from there you can either use Step In and Step Over to navigate inside the function or use Resume to navigate to the next breakpoint at the ThreadEntry function.

     

    This error can occur in FX3 family during JTAG debugging using Segger J-Link due to change in FX3 CPU frequency during runtime when the CyU3PDeviceInit () API in the main function is called. For the resolution to this issue, see KBA229087.

    The same error also occurs while debugging UVC firmware. The UVC driver will rigorously try to put the device into suspend mode to save power by sending suspend request to the device.

    When the host sends the suspend request, USB_SUSP_EVENT_FLAG is generated. This event flag is handled in the default firmware by calling the CyU3PSysEnterSuspendMode () API, which puts the device in suspend mode until any of the wakeup sources are triggered. In suspend mode, the CPU stops running and the device enters a low power state, which breaks the link between Segger J-Link and the device (CPU).

    Preventing the TAP Command: 2 Error:

    In addition to the steps to prevent the TAP Command: 15 error, the firmware should not handle suspend requests from the host.

    This can be done by removing USB_SUSP_EVENT_FLAG from the bit mask in the CyU3PEventGet() function.