5 Replies Latest reply on Jan 27, 2020 5:31 AM by YashwantK_46

    ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2)

    MaSt_4567191

      Here I am again

      the issue have been solved some days ago but moving on it reappeared ... very frustrating

       

      Unfortunately I cannot reopen a closed discussion so here I am

       

      The design is a CX3 configuration design, the hardware is based on the denabola board

      I did not touch the clock configration just after main entry

      According to

      : Fix “Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2) @ Off 0x5” Error in SEGGER J-Link Debugging Provided with FX3 SDK - KBA229087

      I added

       

      monitor memU32 0xE0052000 = 0x00080015

      monitor sleep 1000

       

      in the startup tab of the run commands text box. Does not work ....

       

      monitor memU32 0xE0052000 = 0x00080014

      monitor sleep 1000

       

      does not work as well

        • 1. Re: ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2)
          MaSt_4567191

          The issue is triggered by the following code

           

                      if (eventFlag & CX3_USB_SUSP_EVENT_FLAG)

                      {

                          /* Place CX3 in Low Power Suspend mode, with USB bus activity as the wakeup source. */

                          CyU3PMipicsiSleep();

                          CyCx3_ImageSensor_Sleep();

                         

                          status = CyU3PSysEnterSuspendMode (CY_U3P_SYS_USB_BUS_ACTVTY_WAKEUP_SRC, 0, &wakeReason);

                          CyU3PDebugPrint (4, "\n\rEnterSuspendMode Status =  0x%x, Wakeup reason = 0x%x", status, wakeReason);

                          if (glMipiActive)

                          {

                              CyU3PMipicsiWakeup();

                              CyCx3_ImageSensor_Wakeup();

                          }

                      }

                  }

           

          Is this related to the suspend event? How?

          • 2. Re: ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2)
            MaSt_4567191

            update

            to get rid of any JTAG ICE related issues I am debugging using the UART now. I am simply printing a counter in the main application thread endless loop

            If do not comment this line

               if (eventFlag & CX3_USB_SUSP_EVENT_FLAG)

            I cannot see any counter print on my Teraterm so the issue looks like related to the application

            namely, the system is messed upd when calling the

                            CyU3PSysEnterSuspendMode (CY_U3P_SYS_USB_BUS_ACTVTY_WAKEUP_SRC, 0, &wakeReason);

            Any idea before I build a Cx3 app from scratch?

            Thanks much

            • 3. Re: ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2)
              MaSt_4567191

              This issue is alsopresent when debugging with JTAG ICE a fresh CX3 Configuration project (just to make sue I did not screw up anything)

              • 4. Re: ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2)
                MaSt_4567191

                I tried now to build the 'release' configuration hoping that the different linked release library would work. No joy ...

                I suppose this is normal as I read from the API guide

                 

                "The function can be called only after initializing the device completely. The device will enter into the suspended

                mode until any of the wakeup sources are triggered. This function does not return until the device has already

                resumed normal operation.

                The CPU stops running and the device enters a low power state. Any combination of CY_U3P_SYS_PPORT_W -

                AKEUP_SRC_EN, CY_U3P_SYS_USB_WAKEUP_SRC_EN and CY_U3P_SYS_UART_WAKEUP_SRC_EN can

                be used as the wakeup trigger.

                This function does not affect the state of the USB PHY on the FX3 device. If the USB PHY is to be powered off

                while in the low power mode, the caller should explicitly call the CyU3PConnectState API to do this."

                 

                Am I supposed to wake-up the CPU somehow? how does it work in the sample application? Does the system never get there? Sorry for my lack of understanding in USB communication ...

                • 5. Re: ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP Command : 2)
                  YashwantK_46

                  Hello,

                   

                  The code snippet that you have added in response:2 checks for the event CX3_USB_SUSP_EVENT_FLAG.

                  This event is set when the UVC driver sends a request for the device to enter suspend/ low power mode to save power since there is no activity.

                  The code snippet handles this event and puts the CX3 to suspend mode completely by using CyU3PSysEnterSuspendMode() API until there is a wakeup event.

                  During this time, the J-TAG can't communicate with CX3 CPU as it is in suspend mode and that's the reason for the error that you see.


                  The workaround for this would be to comment out the line or comment out the entire if (eventFlag & CX3_USB_SUSP_EVENT_FLAG) condition to avoid the handling of any suspend mode requests from host:

                  // status = CyU3PSysEnterSuspendMode (CY_U3P_SYS_USB_BUS_ACTVTY_WAKEUP_SRC, 0, &wakeReason);

                   

                  This will prevent the device from going into low power mode even if the hosts requests for it and so, the J-TAG can communicate with CX3.

                   

                  Regards,

                  Yashwant

                  1 of 1 people found this helpful