#avr Logs

Jan 04 2021

#avr Calendar

09:18 AM rue_mohr: --
09:32 AM rue_mohr: -- Jan 4:
02:52 PM ixil: hello, avr newbie I'm having trouble that my arduino mega resets when I go into a cli - sei protected block
02:52 PM ixil: how can I fix this / work out why it resets?
02:57 PM ixil: I narrowed it down to a section which is just setting some pins to Output mode, and setting then the pins to low
03:04 PM ixil: now the problem has dissapeared - perhaps a heisenbug or I forgot to save the file before retesting after fixing it
03:28 PM ixil: Nope it's a heisenbug, I have no idea why adding/removing serial.prints fixes/breaks it
03:29 PM cehteh: you shouldnt do i/o with interrupts disabled
03:29 PM cehteh: nor disable interrupts for extended times
03:29 PM cehteh: sounds like a data race
03:37 PM skz81_: https://imgur.com/a/brTAn46 << With an extern 16MHz XTal, how should I set the last bits (CKSEL0, SUT1..0) ?
03:38 PM skz81_: I mean, is that (slowest option) most likely to work with any source ? Or is it a bit more complicated ?
03:40 PM skz81_: cehteh, I know you're way more into that than myself... I would value any comment.
03:41 PM cehteh: skz81_: read datasheet :D
03:41 PM cehteh: i would need to do so too
03:41 PM cehteh: if in doubt use the slowest startup thats the most stable
03:42 PM cehteh: only when you application requires extremely fast start times investigate on how to improve that
03:49 PM skz81_: cehteh, did you check that link ? That's the very parapgraph in the datasheet. Even with my "handnotes" in red. That's what i'm suggesting, by underscoring that last option.
03:50 PM skz81_: cehteh, hey, I read the DS for others too, don't be rude, when i'm asking, i'm totally in doubt
03:51 PM skz81_: I don't mean you're rude, but hey "read datasheet", meh ?
03:52 PM cehteh: well i am bit distraced, i glanced it, nevermimd, moment
03:52 PM cehteh: you have an xtal not an oscillator
03:53 PM skz81_: yup xternal xtal
03:53 PM skz81_: 16MHz i hope (not tested yet)
03:53 PM cehteh: https://www.engbedded.com/fusecalc/
03:53 PM skz81_: But I guess I just should go for 111 111
03:54 PM skz81_: CKSEL[3..1] [0] SUT[1..0]
03:54 PM cehteh: full swing are not supported ny newer chips anymore
03:54 PM skz81_: as you said just the longest "wakeup" time. I don't care. Even in the final app
03:55 PM cehteh: duh i really have to read it again as well
03:55 PM skz81_: (Soil moisture sensors)
03:55 PM skz81_: cehteh, don't bother
03:55 PM cehteh: but you are always on the safe side to make the startup time as long as possible
03:55 PM cehteh: and use caps slightly smaller than recommended, because the pins/traces add few pF as well
03:55 PM skz81_: cehteh, that's my guess too
03:56 PM cehteh: so when the crystal wants 22pF then use 18pF
03:56 PM cehteh: usually not critical
03:56 PM skz81_: arg I picked up 22pF, that's in the top of the range
03:58 PM skz81_: cehteh, what does it imply ? If it is clock inaccuraty, well AVR CPU is not impacted. It maybe can impact my app, but not totally
03:58 PM cehteh: usually the crystal datasheet says how many F you need
03:59 PM skz81_: https://github.com/SKZ81/temp_AutoWatS_moisture_WIP
04:01 PM skz81_: NB : an EE in my company answer the 3 first of "My Questions" in the README, so don't bother with them. The 4rth is still open tho
04:02 PM skz81_: answered*
04:06 PM skz81_: cehteh, note that's a side projet, that EE could just be a friend (not a âid project here)
04:06 PM skz81_: paid*
04:45 PM IanLiu: I've uploaded the ArduinoISP to my Mega and wired everything to my ATmega32A. Now I want to flash the USBasp bootloader. Which PROGRAMMER should I use? Would "-c arduino" do the trick?
04:45 PM LeoNerd: -c arduino is about using the over-uart bootloader to write application flash. That can't write the bootloader itself
04:46 PM LeoNerd: You'll need something ISPish to write that
04:46 PM IanLiu: oh, right. I guess I should use stk500v1, then?
04:46 PM LeoNerd: If you have one
04:47 PM IanLiu: I mean, I guess that the ArduinoISP sketch _is an_ implementation of stk500v1