-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Powering down the DP when disabling DAPLink SWD control. #189
base: main
Are you sure you want to change the base?
Conversation
This issue should already be fixed by #175. Can you confirm? |
@c1728p9 Unfortunately I don't have many answers since Michal Jakabovic did all the work on this patch. However, I'm following up with the design team about why the last read of the UUID causes an error. I was also wondering why clearing the stickyerr is not sufficient—I'll try to get an answer. |
return 0; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swd_off is just for shutting off the pins. This logic should be added to swd_uninit_debug().
@c1728p9 Michal did some more testing and writing a 0 to CTRL/STAT then doing a readback works instead of setting CDBGRSTREQ. I'll update the patch. (And I'm trying to figure out why the readback is required.) |
@flit, let me know what you find and when this patch is ready to start testing. |
any updates on this @flit? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs updating and rebasing
@flit Shall we rebase and update this one? |
This patch fixes an issue where target devices were unable to enter the Very Low Power Stop (VLPS) mode when running Kinetis SDK low power demos (and presumably customer apps) when using DAPLink. The J-Link app for OpenSDA does not exhibit the same issue. Note that removing the line in
prerun_target_config()
that reads the target UUID will also fix the issue.Issue description from Michal Jakabovic:
Reading from the memory through the SWD causes the debug access port to lock up.
The function above is located in the
/source/target/target_reset_Kseries.c
file. This function calls the functionswd_read_block()
of the/source/daplink/interface/swd_host.c
file from theswd_read_memory()
. On the last read of the UUID from memory in the loop of the following image the debug access port, DP, sets its flagbit of the CTRL/STAT register STICKYERR to 1, which prevents any future communication with this register.This issue has occurred on all boards I have tested it on, including TWR-KE18F, FRDM-K64F, FRDM-KL46Z, as soon as the board is powered up.
To recover from this error it is required to set the STKERRCLR bit of the DP_ABORT register and send a reset request to the control/stat register.