On 13.3.2015 9:20, Paul Fertser wrote:
> On Fri, Mar 13, 2015 at 09:14:47AM +0100, Tomas Vanek wrote:
>>> Debug: 1352 22408 command.c:145 script_debug(): command - ocd_psoc4.cpu 
>>> ocd_psoc4.cpu arp_waitstate running 200
>>> Debug: 1353 22409 ftdi.c:944 ftdi_swd_run_queue(): Executing 2 queued 
>>> transactions
>>> Debug: 1354 22409 ftdi.c:976 ftdi_swd_run_queue(): JUNK AP read reg 0 = 
>>> ffffffff
>>> And here "arp waitstate" fails. Do you think it wouldn't fail if there
>>> was enough of a delay after srst deassertion? Also, I would expect
>>> ahbap_debugport_init called after the release to help here, have you
>>> tried it? Also, you can try catching "arp waitstate" errors in Tcl
>>> (since it's your custom reset_inner procedure already) and run it
>>> several times. IMHO, more real life testing needed here to understand
>>> how to handle it best.
>> PSoC4 needs SWD init seq here so probably master version proceeds to poll
>> and it resync correctly.
>> This change tries to "handle" failed state but apparently without
>> init seq.
> This is the first fail in SWD communication, The SWD init seq will be
> sent automatically the very next attempt to talk to the target. If you
> loop arp_waitstate for few times, it should succeed eventually.
Unfortunately the very next attempt is sometimes too late. As in real life.
> To sum up my thoughts on this and your previous mail:
>
> I do not quite like the idea of additional hooks here because they
> seem to be unnecessary, if we can handle all the targets with the
> common code. What seems to be missing is that ahbap_debugport_init
> doesn't retry on an error. I do not see why we shouldn't make it loop
> for few times before reporting an error, it should cover both
> sysresetreq and srst cases for psoc4, and sysresetreq for sam4l (it's
> unclear how to handle srst with it IMHO, 1966 feels incomplete to me).
>
I fully understand you are reluctant to complicate code with such hooks.
Particularly to ahbap_debugport_init() after reset:
At least two targets need to send SWD init first. It sounds like an 
acceptable compromise
to send SWD init when ahbap_debugport_init() retries.
Again to be robust, ahbap_debugport_init() should retry until some timeout.
The question is do we need to configure that timeout? It is like an 
equivalent
of adapter_nsrst_delay for sysresetreq, well not exactly.

T


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to