NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
[itchyjunk] has quit [Remote host closed the connection]
tsal has quit [Ping timeout: 265 seconds]
tsal has joined #openocd
boru` has joined #openocd
boru has quit [Killed (NickServ (GHOST command used by boru`))]
boru` is now known as boru
thinkfat has quit [Ping timeout: 245 seconds]
thinkfat has joined #openocd
akaWolf has quit [Ping timeout: 252 seconds]
akaWolf has joined #openocd
c4017__ has joined #openocd
c4017_ has quit [Ping timeout: 246 seconds]
Hawk777 has joined #openocd
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #openocd
tlwoerner has quit [Quit: Leaving]
c4017__ has quit [Ping timeout: 245 seconds]
c4017 has joined #openocd
[itchyjunk] has joined #openocd
[itchyjunk] has quit [Read error: Connection reset by peer]
ericonr has quit [Quit: WeeChat 3.2]
ericonr has joined #openocd
ericonr has quit [Client Quit]
ericonr has joined #openocd
danergo has joined #openocd
nerozero has joined #openocd
<danergo> great, thanks!
<danergo> one little thing in texi: "for performance reasons" might be misleading for some future devs at first sight
<danergo> because it's actually not performance reason, just register limitation, so it's more a software-architecture limitation, hm?
<PaulFertser> danergo: no, I meant it. If I implement setting GPIOs in different registers it would be more operations and so the tight bitbanging loop will get longer.
<danergo> ah okay, yes, true
<danergo> :)
<danergo> PaulFertser: it's much better now
<danergo> I changed the 32 gpio to some lower (14), and it started working with some minor issues, like:
<danergo> occasinally "Error: Invalid ACK (0) in DAP response"
<danergo> I can live with that
<danergo> it might depend on the series resistor
<danergo> and interestingly, in verification phase: this error comes:
<danergo> "Error: error executing cortex_m crc algorithm"
<danergo> in spite I'm using "set WORKAREASIZE 0"
<PaulFertser> danergo: probably it gets overwritten later. I'd check -d2 log to see if it's used.
<danergo> it's my last command before the actual programming command
<danergo> each and every time, during verification I got these errors:
<danergo> 1.) Error: Invalid ACK (0) in DAP response
<danergo> 2.) Error: error executing cortex_m crc algorithm
<danergo> but programming seems to finish without errors
<danergo> one thing might be good to fix: this SRST problem
<danergo> as I have a standard gpio, and now, to reset my target I have to write:
<danergo> gpio write 28 0; sleep 0.5 gpio write 28 1; sleep 1;
<danergo> this might be needed in between program and verify, but now if I define the srst, a lot of errors appeared
<danergo> but we might be able to fix the SRST, and then this verification issue might be solved also
Hawk777 has quit [Quit: Leaving.]
<PaulFertser> danergo: I'd compare the log without SRST and with.
<danergo> yes, sure. right now I'm using "program xy.bin verify exit". could you please recommend another command if there is a better one for flashing and verification ?
<PaulFertser> Hm, it looks as if cortex-m always tries to use the CRC algorithm. But then I can't see how it can fail with that message if memory isn't available.
<danergo> aham. I removed that workarea disabler for now
<danergo> to have a better view
<PaulFertser> danergo: program is the tool of choice for fully targets but yours is a bit odd so probably worth trying some different combinations. What it does essentially is "reset init", then "flash write_image erase ..." , then "verify_image" and then optional "reset"
<PaulFertser> s/fully targets/fully supported targets/
<danergo> aha
<PaulFertser> You can probably try to add another "reset init" before verify step.
<danergo> so it also does a "verify_image"?
<PaulFertser> It does.
<danergo> then I don't really need the "verify" step?
<PaulFertser> If you have "verify" listed in "program" arguments then it calls verify.
<danergo> I have this: "program CC2652R_coordinator_20210708.hex verify exit"
<danergo> aha
<danergo> so this is a single "program" command with arguments of
<danergo> CC2652R_coordinator_20210708.hex
<danergo> verify
<danergo> exit
<danergo> ?
<PaulFertser> Yes
<danergo> now if I add "reset init", it doesn't like:
<danergo> -c "program CC2652R_coordinator_20210708.hex reset init verify exit"
<danergo> Error: Invalid command argument
<danergo> shall I open another command with -c?
<PaulFertser> danergo: there's no option "init" for "program". There's option "reset" it means "reset run" after verify finished.
<PaulFertser> danergo: please refer to user manual.
<danergo> yes, I'm reading it right now :)
<PaulFertser> You might need to use some explicit action list instead of "program" as your target is odd.
<PaulFertser> Probably I'd add "reset init" before "verify_image".
<PaulFertser> I'd experiment a bit from telnet to find a suitable sequence.
<danergo> aham
<danergo> nice idea!
<PaulFertser> Probably tried several verify_image in a row, probably tried "reset halt" instead of "reset init" etc.
<danergo> in telnet I can execute these commands as-is right?
<PaulFertser> Yes, all commands from the manual.
<danergo> okay, I'll play with it
<danergo> one more question for now:
<danergo> I added the "preverify" option, and this was the result:
<danergo> **pre-verifying**
<danergo> Error: Invalid ACK (0) in DAP response
<danergo> Warn : target was in unknown state when halt was requested
<danergo> Error: error executing cortex_m crc algorithm
<danergo> **Verified OK - No flashing**
<danergo> my question is about the last line: "No flashing"
<danergo> can I trust in this verification in spite of the errors reported during this phase?
<PaulFertser> Looks like an error in the script. It's supposed to do verification and if it fails then flash. But in your case verification doesn't happen and it should be ignored by it's treated as verification ok for whatever reason.
<danergo> ok, so I must retry in this case
<PaulFertser> danergo: probably you should try to use WORKAREASIZE of reasonable size but your memory pointer is wrong?
<PaulFertser> danergo: in target/cc2538.cfg I do not see working memory specification, have you tried adding it?
<danergo> no I haven't
<danergo> I have just added workareasize 0
<danergo> it was either 0 or either missing
<PaulFertser> I suggest the opposite, try adding proper workarea specification.
<PaulFertser> With reasonable RAM address!
<danergo> oh wait
<danergo> if it's missing, it'll be set to 0x4000
<danergo> in line 48
<danergo> 7in line 48
<danergo> __in line 47__
<PaulFertser> danergo: how big is SRAM in your target?
<danergo> hard to tell:
<danergo> 8KB of cache SRAM (alternatively available as
<danergo> general-purpose RAM)
<danergo> – 80KB of ultra-low leakage SRAM. The SRAM is
<danergo> protected by parity to ensure high reliability of
<PaulFertser> danergo: if you source target/ti_cc26x2.cfg then it'll overwrite whatever WORKAREASIZE you set.
<danergo> operation.
<PaulFertser> danergo: what SRAM is available by default right after reset and where is it mapped to?
<danergo> I know, but my workarea 0 config was added after target sourcing
<danergo> hm, how can I check that? :/
<PaulFertser> danergo: after target sourcing it does nothing.
<danergo> oh
<danergo> then that hadn't had any effect
<PaulFertser> The datasheet of the MCU should have memory map and other essential details.
<PaulFertser> It's interesting the flash driver is using algorithm succesfully.
<PaulFertser> And in fact it can't work without judging by the driver code.
<danergo> okay, I was checking the wrong datasheet with 71pages.
<danergo> now I have the real one with 2000+ pages .D
<danergo> Paul, SRAM's base address is "0x2000 0000
<danergo> "
<PaulFertser> danergo: that matches the config
<PaulFertser> danergo: I'd try "reset halt" and then manual "verify_image".
<danergo> ahha
<danergo> fyi: I left openocd running without commands, and periodically there is this situation:
<danergo> Error: Invalid ACK (0) in DAP response │
<danergo> Polling target cc26x2.cpu failed, trying to reexamine
<danergo> then of course it finds the CPU again
<PaulFertser> danergo: probably there's watchdog enabled?
<PaulFertser> danergo: is that after "reset halt"?
<danergo> no, it's simply just this: openocd -c "debug_level 2" -f interface/rpi-native.cfg -c "transport select jtag" -f target/ti_cc26x2.cfg -c "adapter speed 900"
<danergo> no other command is issued
<danergo> for watchdog I don't know if the firmware has it, but I'd bet for no
<PaulFertser> Probably the target goes into some sleep mode for a bit, probably there's signal integrity issue (do you have resistors atm?).
<danergo> 100R only on TCK
<PaulFertser> To make sure it's not a sleep mode I'd monitor it after halt.
<danergo> aha, so simply add -c "reset halt"?
<PaulFertser> I'd run telnet and interactively try different things.
<danergo> aha, reset halt in telnet
<danergo> okay
<PaulFertser> -c "reset halt" should work if you do it after "init" (to switch from configuration to run stage).
<PaulFertser> I'd also try to see how it depends on different adapter speed values.
<danergo> now, without terminal I ran this: openocd -c "debug_level 2" -f interface/rpi-native.cfg -c "transport select jtag" -f target/ti_cc26x2.cfg -c "adapter speed 900" -c "init; reset halt"
<PaulFertser> That should provide more data, yes.
<danergo> but it's already arrived the first Error about invalid ACK
<PaulFertser> So try the same with different adapter speed.
dreamcat4 has quit [Ping timeout: 245 seconds]
<PaulFertser> To see how it depends (if it does) on it.
<danergo> again
<danergo> (just wrote to have some idea of frequency)
<PaulFertser> I'd also do another series of experiments with/without series resistors.
<danergo> yes, now I have a lot of trials to do :)
<danergo> first thing to make this connection rock-solid by preventing those ACK errors
<danergo> with either resistors or speed changes
<danergo> because these are affecting the flashing process as well
<danergo> but it's strange, as in last 5mins no invalid ACK arrived until now
<danergo> can I somehow ask openocd to print date tag in front of each logline?
key2 has quit [Read error: Connection reset by peer]
nohit has quit [Read error: Connection reset by peer]
key2 has joined #openocd
nohit has joined #openocd
dreamcat4 has joined #openocd
<danergo> ts manages that in case others need
<danergo> obviously after redirecting 2>&1
dreamcat4 has quit [Ping timeout: 252 seconds]
nohit has quit [Ping timeout: 252 seconds]
key2 has quit [Ping timeout: 260 seconds]
nohit has joined #openocd
dreamcat4 has joined #openocd
key2 has joined #openocd
danergo has quit [Quit: Client closed]
godSend23 has joined #openocd
godSend23 has quit [Client Quit]
danergo has joined #openocd
<danergo> @800kHz with 100R in TCK 2hours passed without any invalid ACK(0) error messages
<danergo> I think now this is OK :)
<PaulFertser> danergo: hm, so was it just 900 vs 800 difference?
<danergo> @800kHz, and from telnet, both flash_write, both verify_image runs successfully
<danergo> without any single errors
<danergo> and I don't even have to reset between flash write_image and verify_image
<danergo> it works safe even with the easy "program" command
<PaulFertser> danergo: good news!
<danergo> this is the magic: "init; reset halt; sleep 1000; program .... exit"
<danergo> this way no telnet is needed
<PaulFertser> danergo: you take into account "program" does "reset halt" too? I wonder how it can make a difference.
<PaulFertser> But if it does, well, great you found it.
<danergo> oh, and adapter speed of 800kHz seems also very important
<PaulFertser> Probably that's all the trick and you do not need that extra reset halt?
<danergo> at 1000kHz, Error: error executing cortex_m crc algorithm
<danergo> reappears
<danergo> yes, it seems extra reset halt and sleep is not needed
<PaulFertser> danergo: does that 100R change the result when you use 800 kHz?
<danergo> I haven't yet tried that out
<danergo> now 100R is in
<danergo> I'll try to remove that
<danergo> but sooner or later I'll get back to the start point :D
<PaulFertser> danergo: aren't you convinced enough by now that this can be reliable enough for your new PCB project?
<danergo> maybe the CPU has been "settled" and now it works great
<PaulFertser> :D
<danergo> yes, I don't have doubts now, thank you so much! :)
<danergo> do I need init in this: "init; program .... " ?
<PaulFertser> danergo: I'm glad I could help, and sorry about that bug. Not that I could predict it back then I guess.
<PaulFertser> danergo: no, program has implicit init.
<PaulFertser> Back in 2012 :)
<danergo> wow. yes time flies :)
<danergo> oh, i gotta go
<danergo> thx again!
<PaulFertser> Good luck, see you
akaWolf has quit [Ping timeout: 260 seconds]
[itchyjunk] has joined #openocd
danergo has quit [Quit: Client closed]
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #openocd
akaWolf has joined #openocd
zjason has quit [Remote host closed the connection]
zjason has joined #openocd
danergo has joined #openocd
<danergo> PaulFertser: it works as intended without the 100R (based on my experience, it works more solid without that
<danergo> there were only two bad decision: GPIO selection, and speed
<danergo> earlier 900kHz worked (kinda), I wrote a script which tries 10 times
<danergo> but now, different physical env, different wires around (although the module has the very same wires as before): these require lower speed, 800 seems rock-solid
<danergo> this also solves the SRST problem which we can't solve earlier with 900kHz
<danergo> thank you so much for your precious time and help!
<danergo> ah, I was wrong, reset is still not working. (wires were detached :D)
<danergo> I have to disable reset handling, otherwise I got a lot of
<danergo> Error: Invalid ACK (0) in DAP response
<danergo> then one
<danergo> Error: Could not find MEM-AP to control the core
<danergo> then
<danergo> ** Unable to reset target **
<danergo> I'll play with this a little more
<danergo> and let u know my results
<danergo> so, here is my observation:
<danergo> in any case, if I run openocd with only interface and target definition (no init, or reset commands are added):
<danergo> if I attach telnet to it and run a reset, it will bomb me with invalid ack(0)s
<danergo> even, if I don't run a reset command, just assert and deassert srst via telnet, same invalid ack(0)s
<bencoh> do you still "reset halt" though?
<bencoh> or did you switch to "reset; halt" ?
<danergo> and if I don't run anything in telnet
<danergo> but I assert and deassert the target with "gpio write"
<danergo> same invalid ack(0)s are coming
<danergo> so it seems, if the target is reset while openocd is attached to it, openocd can't survive and has to be manually killed
<danergo> bencoh: I tried with "reset run", "reset halt", and also "reset"
<bencoh> I'm quite certain it doesn't bother openocd that much here, but I might be wrong
<bencoh> (ie openocd eventually retries and gets a proper answer)
<danergo> but as it doesn't work even if I do a reset outside of oocd, I guess it's some kind of a driver problem
<bencoh> could be actually
<bencoh> if your jtag driver was poorly designed, it might be retrying in a loop
<bencoh> forever
<danergo> yes, now I'm 100% sure
<danergo> invalid ack(0)s are also coming if I reset the target with wires physically
<danergo> without typing any button on the keyboard
<bencoh> do you see higher-level messages from openocd between the io-level ack errors?
<danergo> will level3 be enough?
<danergo> on level3 no, not really, very rarely one line is between them:
<danergo> arm_adi_v5.c:900 dap_find_ap(): No AHB3-AP found
<danergo> anyway, it's full of
<danergo> adi_v5_jtag.c:425 jtagdp_overrun_check(): Invalid ACK (0) in DAP response
<bencoh> adi_v5_jtag.c isn't io-level afaict
<danergo> level 3 is the largest?
<danergo> in level 4, no errors are coming :o
<bencoh> level 3 is debug, level 4 is io
<bencoh> not all jtag drivers respect that though
<danergo> so if I define level4, no errors
<bencoh> ?
<danergo> as I write:
<danergo> if I run this:
<danergo> openocd -c "debug_level 3" -f interface/rpi-native.cfg -c "transport select jtag" -f target/ti_cc26x2.cfg -c "adapter speed 800"
<danergo> and I reset the target, I got a lot of errors
<danergo> if however I run this:
<danergo> openocd -c "debug_level 4" -f interface/rpi-native.cfg -c "transport select jtag" -f target/ti_cc26x2.cfg -c "adapter speed 800"
<danergo> and I reset the target, I don't get ANY error
<bencoh> odd
<danergo> but it also doesn't work anything I want to run afterwards tells me IR capture error
<danergo> which is valid, I guess due to low performance RPi, something collapses in oocd
<danergo> can I somehow stop jtag dp run and dp sync?
<danergo> I believe that's the problem
<danergo> first we would need to stop those, then reset the target, and then reenable i.e. init
<bencoh> you already tried adding a delay to reset, right?
<danergo> I tried with gpio write X 0; sleep 1; gpio write X 1;
<bencoh> no I meant, configuring the reset delay
<bencoh> and using the reset command
<danergo> I tried that earlier, but let me retry it now
<bencoh> openocd should honor that and wait for target before it retries
<danergo> yes, doesn't make any real difference:
<danergo> now the storm comes after the defined delay.
<danergo> this is clearly a driver issue
<danergo> because if I reset the target _before_ running oocd, it works perfectly.
<danergo> can I stop the JTAG subsystem via telnet?
<bencoh> you could try adding a reset hook to work that around, maybe
<bencoh> although I doubt re-running the init commands from there would work
<danergo> what is a "reset hook"?
<bencoh> see https://openocd.org/doc/html/Config-File-Guidelines.html#The-reset_002dinit-Event-Handler but I'm pretty certain you can't re-init your jtag adapter from there
<bencoh> I'm not certain you'd need to though
<danergo> i don't see how this can help, sorry :(
<danergo> I would need to somehow detach the TAP, and completely reinit the whole statemachine to such state as if oocd just have been started from scratch
<danergo> I have 0.10 version, what is the fastest way to upgrade to 0.11? possible without compiling, as bcm2835 is not that great on that :D
<danergo> maybe 0.11 has some upgrades for cc26x2 targets..
<PaulFertser> Debian stable ships what's basically 0.11.0
devanagram has quit [Ping timeout: 265 seconds]
<danergo> TI is aware of OOCD's reset issues in their cpus and has branched their custom version of oocd
<danergo> which has this commit:
<danergo> PaulFertser: I'm on armhf, and only 0.10.0 seems available there
<danergo> shall I update or modify my apt.sources, or this is what it is, and I have to build it for myself?
<PaulFertser> That's current stable.
<danergo> (Y)
<danergo> thank you
devanagram has joined #openocd
nohit has quit [Ping timeout: 252 seconds]
nohit has joined #openocd
<PaulFertser> danergo: it might be that your target is incompatible with "reset halt" when hardware SRST is used. I would try to use larger (like few seconds) srst delay first to see if reset halt with srst is possible. But even if with big delay it is not, I'd consider it just broken target and you could use "reset; halt" as a workaround instead.
<danergo> even with as large delay as 5 seconds, it is still invalid acks
<danergo> reset; halt:
<danergo> same
<danergo> I'm going to migrate to bullseye, and retry with 0.11
emeb has joined #openocd
<PaulFertser> danergo: how do you change delay btw?
<danergo> with adapter srst delay 5000
<danergo> can you check my earlier diff on TI's website, if that's still valid?
<danergo> it talks about "fixing" the reset issue on TI's chips cc13x2 and cc26x2
<PaulFertser> danergo: probably reset handling in 0.11.0 changed enough. But building OpenOCD on raspberrypi isn't that long, probably 30 minutes, so I'd also try current master.
<danergo> it's now upgrading to bullseye
<danergo> we'll see
akaWolf has quit [Ping timeout: 265 seconds]
akaWolf has joined #openocd
nerozero has quit [Ping timeout: 252 seconds]
Hawk777 has joined #openocd
<borneoa_> danergo: that commit in TI git is also in openocd gerrit. If I remember correctly it breaks on other devices, so was not merged. TI device has some issue with the incorrect double reset sent by openocd. The fix would be more deep in openocd code then TI patch does.
<danergo> ahha, and that fix is already in 0.11 or not?
<danergo> do you remember on that as well?
<danergo> by any chance ? :)
<borneoa_> danergo: no, was not merged
tlwoerner has joined #openocd
<danergo> thx
<danergo> hm. why is that not merged? it seems it shouldn't break anything else only those who define srst_once, no?
<danergo> or because of those other 17 conflicts?
Steffanx has quit [Quit: Whop whop]
Steffanx has joined #openocd
Hawk777 has quit [Quit: Leaving.]
<danergo> guys, I'm compiling oocd, and after configure step I got on SEGGER J-Link enabled:
<danergo> I only want to use adapter driver bcm2835gpio
<danergo> which programmer should I enable then?
<danergo> openjtag?
<danergo> CMSIS-DAP?
<danergo> thx
<PaulFertser> danergo: --enable-bcm2835gpio
sbach has quit [Read error: Connection reset by peer]
<PaulFertser> danergo: ./configure --help | grep enable
sbach has joined #openocd
[itchyjunk] has quit [Remote host closed the connection]
danergo has quit [Quit: Client closed]