cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

user_4814686
New Contributor

Hi,

After modifying the TOC2 registers to disable the SWJ pins at startup, I have been unable to "Erase all Flash" using PSoC Programmer. When trying to erase, I get a "CPU stopped at wrong address" error message .

How can I prevent this? Furthermore, what is the recommended process to unlock the SWJ pins once they have been locked using the SWJ_PINS_CTL register?

Thank you,

Xavier

0 Likes
Reply
1 Solution
DheerajK_81
Moderator
Moderator

Hello Xavier,

After power on or hardware reset, the SWJ pins are not active. They are activated at the very end of boot code execution, unless prohibited by the TOC2_Flags register. The timeline looks like this:

pastedImage_0.png

Hence, since you disabled the SWJ pins by writing to the TOC2 register, when you reset the device, the pins won't be configured as SWJ anymore and you won't be able to enter test mode. Test mode is required for performing any operations like erase or program. This is why erase operation is failing.

To unlock the DAP, the user application must toggle the SWJ_PINS_CTL value and also update the TOC2 checksum as well. You only asked about disabling the DAP in your earlier interaction, so I think you did not do this step.

If you haven't written any application code to unlock the DAP, you have no way to reprogram the device using SWJ. The device on reset, will skip test mode and proceed to execute the user application.

For more information please refer:

PSoC6 Programming Specification
PSoC6 Architecture TRM

Regards,

Dheeraj

View solution in original post

0 Likes
Reply
1 Reply
DheerajK_81
Moderator
Moderator

Hello Xavier,

After power on or hardware reset, the SWJ pins are not active. They are activated at the very end of boot code execution, unless prohibited by the TOC2_Flags register. The timeline looks like this:

pastedImage_0.png

Hence, since you disabled the SWJ pins by writing to the TOC2 register, when you reset the device, the pins won't be configured as SWJ anymore and you won't be able to enter test mode. Test mode is required for performing any operations like erase or program. This is why erase operation is failing.

To unlock the DAP, the user application must toggle the SWJ_PINS_CTL value and also update the TOC2 checksum as well. You only asked about disabling the DAP in your earlier interaction, so I think you did not do this step.

If you haven't written any application code to unlock the DAP, you have no way to reprogram the device using SWJ. The device on reset, will skip test mode and proceed to execute the user application.

For more information please refer:

PSoC6 Programming Specification
PSoC6 Architecture TRM

Regards,

Dheeraj

View solution in original post

0 Likes
Reply
Top labels