Debug mode keeps failing/disconnecting

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
KeSn_4175816
Level 2
Level 2
10 sign-ins 10 replies posted 5 replies posted

About 85% of the time after the device outputs  "...successfully programmed at..."  I receive 2 errors  (see below). I get these errors on multiple devices (PSoC 4200L and  PSoC 4200M). This happens even when I use example code from Cypress.

Currently I am using PSoC Creator 4.2 on windows 7 and encounter the problem in multiple example projects/codes such as I2C_SCB_Master, I2C_SCB_Slave, Breathing_LED, etc.

The debug select in the system tab of the  .CYDWR file is set to SWD (serial wire debug).

I've used example code from cypress, and made sure only one device is plugged in at a time.

I'm not using sleep or deep sleep modes

I've tried different USB cables, and different USB ports.

To my knowledge PSoC creator is whitelisted on AV software (also not getting any red flags in AV software) and disabling AV software is not an option .

The only solution I have found thus far is to unplug the device wait a second and re-plug in the device, and then I usually have to select the target and click port acquire multiple times in order to acquire the target and connect.

The errors:

PSoC Creator Error dbg.M0007

The run request failed. Encountered error (Invalid thread id: 1)

The request to run the application on the target failed. Make sure that your code is valid and that the selected target supports debugging.

PSoC Creator Error dbg.M0015

Debugger exited unexpectedly during run. Encountered error (Remote communication error. Target disconnected.: No error.)

There was an unhanded error during the debug session. This has forced the debugger to shutdown. Try again.

Unless there is some sort of register I need to clear, I'm out of ideas and searching for the errors hasn't proved fruitful.

Can anyone point me in the right direction for dealing with these errors?

Thanks in advance

0 Likes
31 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There have been issues like yours that were caused by the USB cable. Can you use a different/shorter one?

Bob

0 Likes

Bob,

Thanks for the advice, I've ordered a shorter cable with ferrite choke.

-KeSn

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

KeSn.

I had similar issue a while ago, then it disappeared. Can't think anything changed in software. I suspect that cable was changed. I believe that during those issues the board supply voltage was lower then usual (~4:7V).

/odissey1

0 Likes

/odissey1

Good to know! I've ordered a different cable and will check the board supply voltage.

-KeSn

0 Likes
KeSn_4175816
Level 2
Level 2
10 sign-ins 10 replies posted 5 replies posted

Update:

The new cable has no effect.

Vin measured from J13 on the Lseries pioneer kit is 4.6V even when attempting to connect..

The operating voltage jumper is set to 3.3V  and the 3.3V LDO seems to be working fine as VDD measures at 3.34V

VBUS on the Mseries prototype kit is measuring at 5.0V

...if I click "Port Acquire" repeatedly and quickly (possibly out of exasperation) and then am able to click "OK/Connect" quickly it seems to increase the success rate of actually entering debug mode.

0 Likes

What is the debugger you are using?

Regards,

Dheeraj

0 Likes

I am using the default debugger built into PSoC creator 4.2

Toolchain:  GCC 5.4-2016-q-2-update

Debug target: Application Code and Data

-KeSn

0 Likes

Sorry I should have been clearer. I wanted to know which programmer/debugger you are using like Kitprog/Miniprog3. The errors suggest a bad USB cable, it seems to be disconnecting due to a loose connection or something.


Please change the cable and also maybe try a different USB port on your PC.

Regards,

Dheeraj

0 Likes

Hi Dheeraj,

I am using Kitprog version 2.21.

I have used 3 different cables and tried multiple USB ports to no avail.

-KeSn

0 Likes
  • Check if the Debug Select option in the DWR settings is configured properly (see the figure below). If this is configured as GPIO, then debugging will not be enabled.

Device-is-disconnected-during-debug-sessions_23.png

  • Check if the debugging clock frequency is fast. If the debug clock frequency is more than one-third of the system clock, then debugging cannot be done properly.
  • Check if there is a software breakpoint in the IMO frequency initialization segment in the code startup section. The debug process needs the IMO to be initialized correctly. It is not recommended to use software breakpoints in the IMO initialization section.
  • Check if you have WDT or software reset statements in the code. These reset states will cause disconnection.

Regards,

Dheeraj

0 Likes

Hi Dheeraj,

The debug select in the system tab of the  .CYDWR file is set to SWD

I am using example code for the pioneer kit, so I don't think there are any WDT/ resets in the code.

I have clicked delete all breakpoints and then added a single one in main, after where initialization/startup code is supposed to go and still get the issue.

I am not familiar with where to find the IMO segment code, and I can't find anything that looks like a setting for a "debug clock", can you point me to some documentation for that?

Thanks,

KeSn

0 Likes

In PSoC Creator, please go to Tools > Options > Program/Debug > Port Configuration > Miniprog3. Please check the value of clock speed setup.

pastedImage_0.png

You need to make sure the clock speed is less than 1/3 of the bus clock frequency at which the PSoC operates. Anything less than 6Mhz should work without any problems. Please check this value.

Regards,

Dheeraj

0 Likes

Dheeraj,

I checked that value, it is 1.6MHz.

However, I am using Kitprog (version 2.21,  not miniprog. Is there a relationship between the settings for miniprog3  and kitprog and that I am unaware of?

Also, I don't see any clock options in:

Tools > Options > Program/Debug > Port Configuration > Kitprog2

Thanks

-KeSn

0 Likes

Today got exactly the same problem but with CY8CKIT-059. Yesterday and this morning all was OK. CY8CKIT-059 examples behave similar. In rare cases when debug launched single steps may took up to several tens of seconds.

Also, during normal debug process KitProd LED flashes rapidly. I case of fail connection it stays permanently on.

0 Likes

Switching to Creator 4.1 solved the problem. Debugging works with both Kitprog and MiniProg3.

4.3 Beta - same issue as in 4.2

0 Likes

Hello KeSn,

Can you try downloading the latest PSoC Programmer from here: https://www.cypress.com/products/psoc-programming-solutions ​?

Then restart PSoC Creator and check if it solves your issue.

Regards,
Dheeraj

0 Likes

I used a minprog 4.
Miniprog4: I Upgraded the device, closed the programmer app, unplugged the device, restarted creator, and still had device thread id error.

Miniprog3: Debugging worked like a charm

I changed nothing between these two debug tests

0 Likes

Hi Dheeraj

I installed PSoC programmer 3.28.5, and used the utility "upgrade firmware". It succeeded and still displays KitProg Version 2.21

Same issue as before.

-KeSn

0 Likes

Can you please explain your hardware setup? Are you using a Cypress kit or your own custom board? Also, can you please try using a Miniprog if you have one and check if you are able to debug?

Regards,
Dheeraj

0 Likes

PSoC 4200L and  PSoC 4200M pioneer kits (one at a time)

I do not have a miniprog

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

This may not apply to your case,

but recently I encountered a similar situation.

dbg.M0015 noise matters aka PSoC in a bookshelf

May be checking where you place the board and PC makes some difference.

moto

Hi moto,

I will try it out in a different location. Though, I'm using it on a grounded ESD mat and the USB cable is shielded with a choke.

MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear KeSn-san,

You have a much better environment than mine, but I hope that trying some will not harm.

Best Regards,

23-Nov-2019

Motoo Tanaka

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I just created a project for 4200M (CY8CKIT-044/CY8C4247AZI-M485) with PSoC Creator v4.2.

As it has "NO" I/Os, I hope that it is safe to be used with any hardware.

And it is debuggable with my PSoC Creator v4.2.

If you can build and debug this project with your PSoC Creator v4.2,

I hope that your PSoC Creator v4.2 should be basically fine,

but some functions from v4.1 is not happy working with v4.2.

If you can not build or debug this project with your PSoC Creator v4.2

there may be problem with the installation of your PSoC Creator v4.2.

moto

0 Likes

Hi,

I'm also having the same problem:

The run request failed. Encountered error (Invalid thread id: 1)

I'm using the CYKIT-059.

The problem persists, even if i plug it directly into an USB Hub (2.0, 3.0, doesn't matter) (w or w/o cable).

To me I suspect a problem with "new" Software Windows 10.

The failure rate is 4 out of 5, so debugging is getting quite annoying.

Regatds

Bodo

0 Likes
lock attach
Attachments are accessible only for community members.

Attached is a project that blinks an LED on the CY8CKIT-046 which has the PSoC4200L device. Please try to debug this project and let me know if it works.

Regards,

Dheeraj

0 Likes

Dheeraj,

Is this the same blinking LED project that you can find in the start page under kits?

0 Likes

Dheeraj,

I have tried it with your example and received the same errors

0 Likes
MaPf_1293106
Level 2
Level 2
5 sign-ins 10 replies posted 5 replies posted

Had this problem several times with 4.1 and 4.2.

Sometimes reboot works, several times now it took days to recover (still working on the code without debugging).

Last time, after 1 week of errors, I bought a Miniprog 4, plugged it in, connected to the target and (after selecting CMSIS-DAP HID mode) it was working. Rest of the setup unchanged!

Then just connected the Miniprog 3 back to the target and worked again, much faster than Miniprog 4. Since then it is working.

0 Likes
lock attach
Attachments are accessible only for community members.
KeSn_4175816
Level 2
Level 2
10 sign-ins 10 replies posted 5 replies posted

I think it is a problem with the Kitprog firmware version or something to do with the PSoC programmer.

I upgraded to PSoC creator 4.3 and PSoC Programmer 3.28.7 on a different computer running Windows 10 that was working with previous versions. After upgrading the firmware on a working CY8CKIT-059, I encountered the same problems that I was encountering with the CY8CKIT-046 (4200L Series) and CY8CKIT-043 (4200M Series).

I was able to observe more informative error messages in PSoC Creator 4.3:

  • In the Select Debug Target window: device name says PSoC 5LP CYC5888LT*-LP097 instead of CYC5888LTI-LP097 and has yellow warning triangle with message "Could not stop processor, click port acquire to reset”
    • clicking port acquire did not work (will either not respond or throw dbg.M0036).... unplugging and re-plugging the devices reset this error

  • In the Select Debug Target window:  The device shows up as “ARM Debug Port” instead of the chip/device name “This device was recognized, but PSoC Creator does not support using it at this time”
    • Clicking port acquire repeatedly will sometimes get it to acquire the target.

  • In the Select Debug Target window: Clicking port acquire will throw Error dbg.M0036 : “Error Unable to acquire target device PSoC5LP CY8C5888LT*-LP097: SWD error OK|WAIT|FAULT was received while trying to change the selected target

  • If able to get past port acquire then Error dbg.M0007: “The run request failed. Encountered error (Invalid thread id:1)” and Error dbg.M0015: “Debugger exited unexpectedly during run. Encountered error (Remote communication error. Target disconnected.: No error.)” will most likely appear preventing debug

The 4200L also exhibited these errors, and at times was unable to even be viewed in the port acquire window because it was giving a message as if it were busy and a port was open by PSoC Programmer. However, PSoC programmer was not open, but when I opened it  (to establish and close the connection) PSoC programmer could not connect because it was saying the 4200L was busy. ( It is worth noting again that the code/project loaded onto the devices is the simple blinking LED Example code provided by Cypress)

I attempted to do a factory install/recovery of the kitprog bootloader  (per the Kitprog User guide) by holding the reset button when plugging into PSoC programmer to no avail.

I uninstalled all cypress products from my computer and then installed PSoC 4.1 Update 1, I flashed the Kitprogs on both the 4200L and 5LP with whichever version of PSoC programmer came with the PSoC Creator 4.1 Update1, and they both worked fine.


After a bit of back and forth with different versions of PSoC creator and PSoC programmer (and the resulting Kitprog versions) I Isolated the problem to the Kitprog versions greater than Kitprog v2.18 (couldn't find version 2.19)

I can debug in PSoC Creator 4.3 if I am using Kitprog version 2.18, resulting from ‘upgrading’ the firmware using PSoC Programmer version 3.26, though I have to ignore warnings about firmware matching….After reverting the Kitprog firmware to v2.18, PSoC Programmer can be updated to its current version 3.28.7 and you can still debug

Thus I think it is a problem with PSoC Programmer, or Kitprog firmware or both...unless I've somehow duplicated a bad environment via default preferences

0 Likes