Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi, 

I'm using the CY5672 PRoC BLE Remote Control Reference Design Kit, and I'm trying to understand what the code exactly does. 
So my idea was to do debugging, and see how the code works. 

But, when i'm in debugging mode, and try to do step by step, i fall on system interrupt part. I searched here by this problem and see this is "normal" (it was a known behaviour), and if I want to do debug I have to use one of this solutions (saw this solutions on case: System interrupt problem in debugging): 

"Ways out: When at the breakpoint, disable interrupts when single-stepping, before executing a run-command enable them again. There is an icon in the menu for interrupts. 

Or 

remove Breakpoint and set a new one at the next line you want to stop, then execute a Run-command" 

Although, when I'm trying to implement the first solution, and I'm at the breakpoint (with the interrupts now disabled), I try to do step by step and it happens that the code jumps to another place. Also, If I continue to do step by step it give me this error: 

"Debugger exited unexpectedly during run. Encountered error (Target disconnected See output window for more information.)" 

The other solution, I remove the breakpoint and set a new one close to the previous one where the code should go, but when I execute Run-command it doesn't reach there. For example, on the figure in annex when I execute the Run-command it should stop in the breakpoint that I set, but never has arrived there. Only arrives if a key is pressed again, but it should had arrived in the previous case (because the variable isBatteryLow had the value 0 and the variable isActivitiyDetected had the value 1). 

I'm using the code provided with the kit for remote control without any changes. 

Could you help me about these problem? What should I have do?

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

I already figured out the solution, so the solution to this was to disable WDT in Platform.h and following the steps indicated in my first post (# 1) that I initially said did not work. Anyway, thank you Bob for trying to help me.

   


Regards,

   

Walter

View solution in original post

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

Welcome in the forum, Walter.

   

Usually debugging is just the other way: checking if a program runs as expected 😉

   

I have given up to debug any of the generated code modules. There is no need to understand how it works, my assumption is that it will work.

   

Some more tip: in Project -> Build settings -> ARM GCC -> Compiler set the optimization to "none". This will ensure that the program flow is exactly the same as your code reflects. This setting will consume more flash but you may set that on a file base.

   

Sleep modes will interfere with debugging, because the communication between the chip and USB ceases. So go through the code and check whether you need to disable sleep modes.

   

Understanding programs and program flow can be done in a different way: left click on a function call and choose "Go to Definition". This will bring you to the function itself and you may see what it does. A "<ctrl>-" (Control minus) will bring you back to where you came from. Good way to study these things. Be aware that you have got the opportunity to display the call stack, so you can see from where you entered the function where your breakpoint resides.

   

 

   

Happy coding

   

Bob

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received
        Please post your code so we can test it.   
0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

Bob when I said that I need to understand how this works it's because I want to do some adaptations to the code, and if have a problem in the code I need to do debug to understand where I did it wrong. Doing "Go to definition" don't help me to check where is my error. 
So, in first, I tried to do debugging without change the code to understand how this works as I explained above.

   

So, I tried to implement the tips that you gave to me, but still continues to give me that problems that I mentioned above. I will attach my project to see if you can help me with this,  and see what I'm doing wrong. This project contains the tips that you told me to do (disabled sleep mode and set the optimization to 'none' in some files of my interest), and some comments done by me.  

   

I'm using Psoc Creator 3.3.

   

Please help me if you can.

   

Regards,

   

Walter

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

"I'm using Psoc Creator 3.3"

   

This is the main problem, upgrade to Creator 4.0 and update your project's components.

   

Making changes in the generated code will get overwritten after a new build, so it's better to avoid that.

   

 

   

Bob

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

Hi,

   


So i uninstalled all the software of cypress, and installed the PSoC Creator 4.0 and updated all the components. The problem still persists, and with your tips mentioned upwards the problem still exists. I will attach again the project. Help me if you can, I really need this.

   

 

   

Best Regards,

   

Walter

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

In platform,h line 64 you wrongly commented MCU_DEEP_SLEEP_DISABLED.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi,

   

Yes Bob you are right, i forgot to change this in this new project. But I still continue with the same problem...

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

No more suggestions, sorry.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi,

   

I already figured out the solution, so the solution to this was to disable WDT in Platform.h and following the steps indicated in my first post (# 1) that I initially said did not work. Anyway, thank you Bob for trying to help me.

   


Regards,

   

Walter

0 Likes