You can Add WatchPoint during debug session on Read , Write and Access for the Port Registers
How? I still can't get this to work.
Taking your example given, you can see this register in SO.h file:
#define SO_PS (* (reg8 *) SO__PS)
If during debug, you right click this, are you not getting the option of "Add WatchPoint".I checked in Creator4.2. Presently, I don't have Creator4.0.
I do indeed get the "Add WatchPoint" option, but nothing really occurs beyond that. In the "Breakpoints" window, I can see a Variable Watchpoint has been added for that register, whether access, read or write.
However, the Hit Count always shows 0 and nothing occurs during debug.
What I am looking for is a method to review the state of port or gpio registers when I pause the debug execution. In CCS for example, I can pause the debug execution, and then review the current state of all registers in the system: GPIO state, GPIO direction, GPIO resistor enables, etc. Although this is not what I was asking, CCS allows the user to also edit register values during debug. For example, I can pause the debug execution, and manually toggle an output pin low and high. Or I can change the pin from output to input by changing the bit for that register.
Does PSoC Creator have similar functionality?
Also, I am now using PSoC Creator 4.2. There doesn't seem to be any difference with regard to the functionality in question.
When you add a watchpoint, it is a variable watchpoint by default. Hence to set a watchpoint on a memory address you need to add a memory watchpoint.
To add a memory watchpoint:
Go to Debug > New Breakpoint > Memory Watchpoint
Then add the address you want to monitor and change "Break on" to Access instead of Write.
During debugging you can see the hit count of the Watchpoint increase on every access in the Breakpoints window.
In the memory window, type the specific address and then edit the corresponding values to toggle the value of the pin. Try it out and let us know your observations.
1 of 1 people found this helpful
Thank you! This information helped answer the question. Actually, the breakpoint, while useful, doesn't really help my issue. However, knowing how to access the GPIO via the memory window does. This is the key, and for that you deserve the correct answer.
Simply because I found this process frustrating and assuming others will have a similar issue at some point, I would like to expand on this answer in specific relation to what I asked. Code Composer Studio has a built-in drop-down menu listing all core and peripheral registers. These registers are named and described clearly in the dropdown (i.e. Port_1_2>P1OUT0). There you can monitor or type in new values. That is what I am used to.
Now in PSOC Creator (4.2) the same result can be achieved through the Memory window, as ddka pointed out above. However the trick is finding the actual memory address. This may be obvious to more experienced users, but the file that contains all of the address values is "cydevice_trm.h". Here you can look up the addresses for everything on the PSoC.
To be consistent with my initial question, here is my indirect method of getting to the same file from where I was stuck.
In a simple LED blink project PSOC5LP (CY8CKIT-059) LED 1 is connected to Pin 2.1. Assuming I named the GPIO "LED1" and defined it as an output, a folder will be created called "LED1" with the following files: "LED1.c", "LED1.h", and "LED1_aliases". In the LED1.h file, scroll down to the following line:
/* Data Register */
#define LED1_DR (* (reg8 *) LED1__DR)
I have not found a way to directly copy and paste that define statement into the "Address:" input of the Memory window.However, if you right-click on the "(* (reg8 *) LED1__DR)" portion, you can then select "Go To Definition" or "Go To Declaration". This will open the cyfitter.h file and will highlight "#define LED1__DR CYREG_PRT2_DR". If you right-click on "CYREG_PRT2_DR" and select "Go To Definition", "cydevice_trm.h" opens and highlights "#define CYREG_PRT2_DR 0x40005120u". Copy and paste "0x40005120" in the address input and press enter.
The first column should start at 0x40005120. The next column over shows the 8-bit width register contents. If in HEX, a 0x02 (0b0000 0010) entered will turn the LED1 on, while a 0x00 will turn it off. From here, obviously, the pin state, etc. can also be modified. Also in the future, I will go directly to "cydevice_trm.h" file to look up memory addresses directly.