#avr Logs

Sep 14 2021

#avr Calendar

02:30 AM specing_ is now known as specing
03:10 AM LeoNerd: WOO! My ATtiny1616s have shipped :)
03:10 AM LeoNerd: I might actually be in physical posession of some chips soon
03:11 AM twnqx: congratulations! meanwhile i got more refunds for more fake V20Hs from chinese sellers...
03:12 AM twnqx: can't tell if it's a fun source of free V20s, or annoying as I really want V20HLs...
09:13 AM exp: i've been surprised that a few chips i stocked up on as they had long lead times are suddenly in supply of a few thousand
09:14 AM exp: not a bad surprise of course
09:14 AM qu1j0t3: sometimes they find inventory. i was watching a particular common transistor on Mouser. Had 16 in stock, next arrival December. but a day later they had found another 95.
09:15 AM LeoNerd: Presumably as more of their parts bins become empty, they're finding misplaced stock hidden behind the boxes
09:15 AM qu1j0t3: Semiconductor Santa
09:40 AM exp: LeoNerd: annoyingly my order from mouser went the other way
09:40 AM exp: ordered all of a connector they had in stock, plus i backordered some others
09:40 AM exp: they delivered n-1 of the in-stock item, but now have the backorder in stock in decent quantity
09:40 AM exp: but haven't shipped it, and don't plan on until december, because that's when the in-stock item is backordered until
09:40 AM exp: (you can email them to ask them to ship, but it's a bit of a backward default!)
09:41 AM LeoNerd: Hmmm
09:46 AM exp: haha speaking of which, digikey just tried to bill a card that expired a few months ago for a backorder
02:31 PM specing_ is now known as specing
03:01 PM c4017w_: Is this the right place to discuss SAMD10 (ARM cortex M0+)?
03:02 PM c4017w_: I'll ask anyway. Anyone used the PM->EXTCTRL.SETDIS bit on SAMD10 to disable external reset? It seems to have no effect
03:10 PM amahl: exp: got my attiny13 producing the right pulse train for the motor ESC. timer interrupt ticks at 50 hz and uses _delay_us() to get the 1500-2000 us pulse exactly right. of course waiting 2ms in an interrupt is silly but it works. couldn't get the other interrupt approaches working at all
03:15 PM amahl: dunno why I couldn't get OC0A pin to automatically change state by setting the COM01,COM00 bits. and it seemed like timer compare interrupt triggered at random
03:17 PM amahl: the one I ended up using is overflow interrupt
03:18 PM amahl: since attiny13 only has 64 bytes of RAM stack overflow is a possibility. but its hard to debug
03:19 PM nohit: c4017w_: it is but not many people have used those atmel arms
03:31 PM nohit: "Disabling External Reset should not be done at very beginning of the main() function. It is advised to disable RESET line after few instructions/delay. Otherwise reprogramming may have problem with the programming tools. Programming tool uses RESET line to program the device. So tool needs sufficient time to get the control of RESET line and complete programming.
03:31 PM nohit: "
03:32 PM nohit: c4017w_: ^
03:39 PM c4017w_: nohit, where is that from?
03:40 PM nohit: https://microchipsupport.force.com/s/article/RESET-line-as-GPIO-pin-in-SAM-D11-device
03:40 PM c4017w_: I'm not having trouble reprogramming. In fact, I think the SWD debugger connects without the reset line at all. Problem is that I can't disable reset in the first place!
03:41 PM c4017w_: Yeah, I'm doing it as they say. It's several thousand clock cycles after entering main
03:42 PM nohit: okay
03:42 PM nohit: how do you confirm that it doesnt work
03:42 PM nohit: maybe your gpio setting is somehow wrong
03:42 PM c4017w_: I short the reset pin low and see that the device still resets
03:42 PM nohit: ah
03:42 PM c4017w_: Also, I'm unable to set the pin up as a GPIO pin
03:42 PM c4017w_: Which should be possible after setting SETDIS high
03:43 PM c4017w_: i.e the pin doesn't toggle when I try to set it high or low
03:51 PM nohit: i cant find anything special from the PORT registers that would need setting
03:52 PM nohit: you have set it as output ?
03:52 PM nohit: with DIR register
03:53 PM nohit: default state is input
03:53 PM c4017w_: yes, I tried setting it to output with `PORT->Group[0].DIRSET.reg = 1 << 28`, but it also has no effect. The same line works on another pin (27 for example)
03:54 PM nohit: mkay
03:56 PM c4017w_: wait I just tried adding a 50 ms delay after writing to SETDIS and now it works...
03:57 PM c4017w_: lets see how short before it breaks again
04:02 PM nohit: strange that they have nothing about this on the datasheet. but good if it works
04:09 PM nohit: how much delay does it need ?
04:27 PM c4017w_: Seems its only partially working, or I have another problem as well. Don't have time to dig deeper at the moment but I will report back
04:33 PM nohit: okay
04:50 PM c4017w_: Ok, not exactly sure what I was seeing earlier. Now, setting SETDIS high disables the external reset as expected with no delay needed. However there is another problem...
04:51 PM c4017w_: The entire reason I wanted to disable reset is to troubleshoot an issue where some noise was being coupled onto the reset pin from a nearby switch and causing the device to reset
04:51 PM c4017w_: Even with reset disabled, I'm still able to get it to reset if a strong enough falling edge is coupled onto the reset line!
04:55 PM c4017w_: and after this reset, PM->RCAUSE tells me it was caused by an external reset! lol, this is great. It's like the signal from pressing the switch is strong enough to couple into the internal reset circuitry inside the chip or something
05:19 PM exp: amahl: remember you were using CTC mode i think? that can lead to seemingly random behaviour, a hacky solution, but if it works... :)
05:20 PM exp: c4017w_: what's the overshoot like?
05:21 PM exp: tbqh a simple switch coupling enough noise to cause a reset is not something i've ever seen
05:21 PM exp: is this breadboarded by any chance?
05:22 PM c4017w_: good point let me check
05:22 PM c4017w_: no, it's on a PCB
05:23 PM exp: does the part have a particularly piss-weak internal pull-up for ~RESET?
05:23 PM exp: because i've got plenty of switch lines almost adjacent to comms lines
05:23 PM exp: and capacitive coupling barely moves the needle, so to speak
05:24 PM exp: (or is the switch particularly high current or sparky?)
05:24 PM c4017w_: heh, about -2V undershoot directly into the IO pin
05:24 PM exp: there's your reset cause
05:24 PM exp: but how?
05:25 PM exp: you got a 40ft cable on this?
05:25 PM c4017w_: Adding a strong 470 ohm pullup to reset does fix it
05:25 PM exp: add a proper clamp and an RC on your switch line, or at least an R
05:25 PM exp: as it seems you've got the C and L sorted ;)
05:26 PM c4017w_: only a few inch cable, but I think it's a poor circuit design. There's a 100nF cap on the IO pin for debounce and the switch shorts it directly to ground. This causes a current spike and then LC oscillation between the cap and cable
05:26 PM exp: honestly that's quite impressive
05:27 PM exp: i've been very negligent with my long line design
05:27 PM exp: and i've yet to see a 2v undershoot
05:27 PM exp: anyway a resistor inline will solve all your problems
05:27 PM exp: but it doesn't hurt to clamp too
05:27 PM c4017w_: yeah, I'm surprised it's quite this bad. Also surprised there's nothing in the chip clamping it to -0.7V
05:28 PM exp: well there will be, but they're tiny and weak
05:28 PM c4017w_: I probably blew them up already lol. I don't see any hint of clamping on my scope capture
05:29 PM exp: i'm very ignorant of actual IC design internally
05:29 PM c4017w_: Ok lesson learned. I'll probably end up bodging a reset pullup on the boards. Already have a bunch build up
05:30 PM exp: it's general good pratice, as well as 0 ohms on every long line
05:30 PM exp: i typically have an RC and a simple tvs clamp onto a FET gate, but an experienced engineer would probably tell you this is just wasting components
05:31 PM exp: and just the R is enough
05:44 PM twnqx: i have a clock generator on an 8088 board that overshoots to +6 and undershoots to -2 on every cycle, and the trace isn't even long
07:06 PM exp: things that annoy me: that's not 'undershoot', it's badly named and often gets mistaken
10:49 PM rue_shop2: hmm
10:49 PM rue_shop2: is that chip fed +12?