NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
noarb has joined #openocd
Wonka has quit [Ping timeout: 244 seconds]
Wonka has joined #openocd
noarb has quit [Quit: ZNC 1.8.2 - https://znc.in]
noarb has joined #openocd
noarb has quit [Quit: ZNC 1.8.2 - https://znc.in]
noarb has joined #openocd
noarb has quit [Quit: ZNC 1.8.2 - https://znc.in]
noarb has joined #openocd
noarb has quit [Quit: ZNC 1.8.2 - https://znc.in]
noarb has joined #openocd
alkane has quit [Ping timeout: 244 seconds]
alkane has joined #openocd
nerozero has joined #openocd
d_olex_ has quit [Read error: Connection reset by peer]
Haohmaru has joined #openocd
Hawk777 has quit [Quit: Leaving.]
Giedrius has joined #openocd
<jancoow> is it also possible to pull the reset line from gdb
<jancoow> or at least do this after programming?
<Haohmaru> from gdb you can always send commands to openocd via "monitor <blah>"
<Haohmaru> so if you know the openocd command that does that - toss it thru "monitor ...."
<Haohmaru> or "mon ...." for short
<jancoow> I do use monitor reset init but this will trigger a 'software reset'
<jancoow> i need to trigger an 'external reset' with the hardware reset pin
<Haohmaru> maybe that's done with one of those openocd commands that have "srst" in their name?
<jancoow> mmh
<jancoow> do you know which command?>
<Haohmaru> nope
<Haohmaru> i mostly use "mon reset halt"
<Haohmaru> that's while debugging tho
<karlp> mon help adapter ;)
<Haohmaru> jancoow ^
<karlp> (you'll often need to do a resync with gdb afterwards of course, but if that's what you're trying to do...)
<PaulFertser> jancoow: "reset init" is "reset halt" and then running reset Tcl handler.
<PaulFertser> jancoow: it IS using hardware SRST line if OpenOCD has SRST enabled at all (either with trst_and_srst or srst_only).
<jancoow> PaulFertser weird, my target still thinks it's a software reset
<jancoow> PaulFertser I've enabled reset_config srst_nogate
<Haohmaru> it's a good thing i slapped a LED on the debugger for the reset state
<jancoow> hehe
<jancoow> yea we should add those to our program stations as well
<jancoow> i was thinking the same actually
<Haohmaru> but i hope i flipped its logic
<Haohmaru> so that it lights on when the reset is low
<jancoow> that's easy fixable
<Haohmaru> i don't think so
<jancoow> why not
<jancoow> turn led around, cut trace
<Haohmaru> "cut trace" <hell_no.gif>
<jancoow> ?
<Haohmaru> but i think i've done it "right" https://antonsavov.net/tmp/samd21_daplink.pdf
<Haohmaru> yes, led is wired up to 3.3V and "pointing down" towards the reset signal
<Haohmaru> so it should light up when reset is low
<Haohmaru> i do _not_ like cutting tracks and butchering PCBs
<Haohmaru> this is already 2nd revision of this board
<jancoow> you get used to in rapid development
<Haohmaru> this is an experiment only
<jancoow> yea so if you can test/fix the led by cutting one trace
<jancoow> we even had to add a solder blob between two pins in production once for 1500 prints
<jancoow> because of a stupid non documentated bug, thanks microchip
<Haohmaru> nah, it seems i've put the LED cleverly in the first place
<Haohmaru> if it was "normal logic", then it'd be lit while the chip works, and a short reset won't be very noticable due to how human eyes work
<Haohmaru> but when it's inverted, it'll be off most of the time, and a short reset would cause it to light up, which will be much easier to notice
<PaulFertser> joconor: please show -d3 log.
<PaulFertser> Sorry, I meant jancoow
<PaulFertser> jancoow: it will show for sure what kind of reset is used when.
Giedrius has quit [Quit: Client closed]
Giedrius has joined #openocd
<jancoow> PaulFertser how do I enable that?
<karlp> jancoow: what does "your software still thinks it's a software reset" mean?
<jancoow> karlp the microcontroller
<karlp> yes, I gathered you meant hte sw on your mcu....
<Haohmaru> jancoow, "-d3" means running openocd with -d3 flag, that's for debug level 3, kinda like more verbous
<Haohmaru> * verbose
<Haohmaru> it prints more text messages with internal details
<jancoow> karlp no, the microcontroller reset cause
<PaulFertser> jancoow: or with "debug_level 3" command in config or on command line.
<karlp> are you reading some sort of internal "reset reason" register?
<PaulFertser> SRST != POR btw
<Haohmaru> PaulFertser, it can be enabled afterwards?
<karlp> ^^
<PaulFertser> Haohmaru: yes, sure
<jancoow> PaulFertser thnx I'll enable
<karlp> it'
<jancoow> correct POR != SRST
<Haohmaru> karlp, probably reading the RSTC reset reason
<Haohmaru> PaulFertser, cool
<jancoow> but we have different behaviour for software reset then POR or external :)
<PaulFertser> jancoow: let's first see the log to be sure hardware line is used.
<jancoow> and in this case after programming it will think the RAM is still intact after a software reset, but it's just flashed
<karlp> PaulFertser: we know it is, they can now connect when they couldn't before
<jancoow> so it shouldn't be a software reset after flash
<karlp> I htink this is just an interpretation of the reset reasons issue.
<PaulFertser> Then after you see there's no doubt about that you'll have to concentrate on that reset cause register meaning etc.
<jancoow> karlp nah.
<jancoow> no problems in atmel studio either
<Haohmaru> jancoow, i've noticed on some MCUs that right after flashing, when the firmware runs - the reset cause is left in some WTF state
<jancoow> Haohmaru that's why I need to reset it with the reset pin ;)
<PaulFertser> jancoow: here we can know right away with the log what kind of reset is used after flashing, then investigation can be directed.
<jancoow> PaulFertser yes gimma sec :D
<karlp> what target is this again? saml11?
<Haohmaru> an additional software reset might fix it (if the reset cause bits are not sticky like on some other MCUs, but you'll have to check this)
<jancoow> samr35
<jancoow> but that's basically a saml21
<karlp> where do I get the rest of the manual form, this datasheet is only 60 pages.
<karlp> so are you printing out _all_ the bits set, or just chekcing for specific bits? (of RCAUSE?)
<jancoow> penocd: Debug: 10308 9296 cortex_m.c:986 cortex_m_halt(): [atsaml21e18b.cpu] target->state: reset
<jancoow> openocd: Debug: 10309 9296 command.c:155 script_debug(): command - atsaml21e18b.cpu invoke-event reset-assert-post
<jancoow> penocd: Debug: 10310 9296 command.c:155 script_debug(): command - atsaml21e18b.cpu invoke-event reset-deassert-pre
<jancoow> openocd: Debug: 10313 9296 command.c:155 script_debug(): command - atsaml21e18b.cpu arp_reset deassert 1
<jancoow> karlp RSTC->RCAUSE.reg;
Foxyloxy_ has joined #openocd
Foxyloxy has quit [Read error: Connection reset by peer]
<PaulFertser> jancoow: please use some pastebin and show FULL LOG
Giedrius has quit [Quit: Client closed]
<karlp> jancoow: right, and what values of that reg are you seeing in what cass, vs what you expect in what cases?
<jancoow> PaulFertser the program is very long
<jancoow> so i'm not sure if that's nececary
<jancoow> debug log *
<Haohmaru> the openocd -d3 log would be long, but this is how the folks here can get information about what's happening in your case
<Haohmaru> thus use a pastebin
<karlp> I'm 99% sure we're doing what we say we're doing, because otherwise they wouldn't have been abel to get their "cold" attach to work.
<Haohmaru> unless it worked because he's in a very cold room ;P~
<jancoow> ye understand but vscode also formats it weird
<jancoow> there u go :)
<jancoow> PaulFertser this is what you mean?
<Haohmaru> i run openocd in a terminal outside the IDE
<jancoow> I am not
<jancoow> PaulFertser if I enable reset_config trst_and_srst I'm unable to connect anymore so
<jancoow> I would expect seeing a reset external
<jancoow> but it keeps triggering a reset software
<jancoow> is using -interpreter-exec console \"monitor reset halt\" wrong?
<PaulFertser> jancoow: there's "openocd: Error: 96 90 core.c:620 adapter_system_reset(): BUG: can't assert SRST" in your log!
<PaulFertser> Wasn't it visible with default debug level?
<Haohmaru> ^ what causes this inability?
<Haohmaru> debugger doesn't control the reset pin?
<PaulFertser> Haohmaru: OpenOCD isn't supposed to touch that pin because it's not enabled in the reset config, yes.
<Haohmaru> oh, you mean some config tells openocd that the reset pin shall not be touched, and then later some algorithm attempts to touch it but openocd rejects it due to config?
<PaulFertser> And indeed since it's not enabled OpenOCD just does this: openocd: Debug: 235 333 cortex_m.c:1516 cortex_m_assert_reset(): [atsaml21e18b.cpu] Using Cortex-M SYSRESETREQ
<Haohmaru> that smells like soft-reset
<PaulFertser> It's interesting how this buggy way works to attach to saml part though. It's not meant to be working like that but it does here, I see from the log and source code.
<PaulFertser> jancoow: ready for my theory?
<Haohmaru> do tell if you think something could work also for the SAME54 "security bit" case
<PaulFertser> Haohmaru: here it probably works because there's enough time between deasserting reset while SWD pins are still working before disabled by firmware.
<Haohmaru> ah right, his case is different than mine
Guest33 has joined #openocd
<Guest33> Hi All, just wondering is there any effort providing support for ch32v targets riscv based debug over swd type of transport layer?
<jancoow> PaulFertser ye go ahead :D
<jancoow> now i'm curious
<jancoow> PaulFertser so it's unable to use the hardware reset pin?
JoseT has joined #openocd
<karlp> Guest33: they'd have to support swd first...
<PaulFertser> jancoow: well, apparently your target doesn't actually support "srst_nogate", in other words, it doesn't talk SWD or JTAG while SRST is asserted at all.
<karlp> there's an openocd fork that has support for ch32v with some wchlink interfaces, but it's pretty flaky, and not at all close to being upstreamed
<PaulFertser> jancoow: so you can use hardware reset but without srst_nogate (and naturally without connect_assert_srst).
<PaulFertser> jancoow: why it's working for you there is likely because OpenOCD CMSIS-DAP driver specifically ignores that SRST is not available and still tries to use it for connecting under reset, but CMSIS-DAP firmware seems to handle it somehow on its own and deasserts reset before actual communication. And OpenOCD has enough time to talk to target after that before SWD is turned off in software.
<PaulFertser> jancoow: hah, what you can do as a trick is using that bug as you do currently for connecting, then change "reset_config" in runtime after it by adding "srst_only srst_gates_jtag connect_deassert_srst" and that should make all resets use hardware reset.
<Haohmaru> i think i saw some room in daplink firmware for "target-specific" reset procedures
<Haohmaru> but no idea if this is related or what it is at all
<PaulFertser> I don't know either.
<PaulFertser> Probably no and it's just pulling SRST low on init and then deasserts normally after openocd: Error: 96 90 core.c:620 adapter_system_reset(): BUG: can't assert SRST and then justt proceeds to connecting in the time window just opened.
<PaulFertser> jancoow: hm, re power-savings with SWD pins and reliability, isn't it normally enough to just add external pulls so that they're not floating?
<PaulFertser> (if the target doesn't have internal ones for the purpose)
<Haohmaru> most SAM chips recommend having an external pull resistor on SWCLK
<Haohmaru> quite a low value even, like 1k
<PaulFertser> So if you have one then it's not leaking any energy right?
<PaulFertser> Only really floating pins are bad like that.
<Haohmaru> this is from SAML21 datasheet
<Haohmaru> but no idea..
<PaulFertser> Please consider using imgbb.com in the future.
<PaulFertser> What's the "related link" there?
<Haohmaru> no idea.. however, there's also another illustration for when you wanna use a button for external reset, there they show 10k pull up resistor
<Haohmaru> plus a capacitor tho
<Haohmaru> oh wait, this is the reset pin, not SWCLK
Guest33 has quit [Quit: Client closed]
<Haohmaru> i guess coffee levels are low
<Haohmaru> could maybe the text that talks about "related link" be about the Xplained board?
<Haohmaru> ah, found it, they've copy-pasted this from other datasheets but removed the actual link
<Haohmaru> from SAMD20 datasheet, there's a link to "Operating in noisy environments"
<Haohmaru> "If the device is operating in an environment with much electromagnetic noise it must be protected from this noise to ensure reliable operation. In addition to following best practice EMC design guidelines, the recommendations listed in the schematic checklist sections must be followed. In particular placing decoupling capacitors very close to the power pins, a RC-filter on the RESET pin, and a pull-up resistor on the SWCLK pin is critical for
<Haohmaru> reliable operations. It is also relevant to eliminate or attenuate noise in order to avoid that it reaches supply pins, I/O pins and crystals."
<Haohmaru> same thing in the SAMD21 datasheet
<Haohmaru> 1k pullup on SWCLK
<Haohmaru> most of these say they have built-in pull up on the RESET pin, but still most of them recommend having also an external pull up resistor (different values in different chip datasheets are given) plus a capacitor
<PaulFertser> Good to know!
<Haohmaru> i just follow those recommendations and don't think about it much ;P~
russ has joined #openocd
Haohmaru has quit [Quit: saionara]
Hawk777 has joined #openocd
russ has quit [Remote host closed the connection]
russ has joined #openocd
bacam has quit [Ping timeout: 252 seconds]
bacam has joined #openocd
<karlp> space
JoseT has quit [Quit: Client closed]