#avr Logs

Oct 23 2019

#avr Calendar

05:46 AM egy: hello y'all!
05:51 AM djph: o/ egy
05:51 AM egy: in atmel studio 7, how can i debug USART in my application, knowing that i've no boards connected or w/e ?
05:51 AM egy: o/ djph
07:01 AM Fuchikoma: egy: For output you can run in debug mode and use the register viewer to see what's going on
07:01 AM egy: Fuchikoma: ah yeah the i/o debug mode is lit
07:02 AM Fuchikoma: For input you can probably build a stimuli file but that's something I've never done myself
07:02 AM egy: it's pretty-printed gdb, i love it; problem is interaction with the terminal
07:02 AM egy: (i.e with the USART)
07:02 AM egy: alright, will look for a stimuli file
07:03 AM Fuchikoma: Basically Atmel Studio has a whole scripting language for simulating things external to the uC
07:04 AM egy: i see. i hope there's good documentation out there
07:04 AM egy: thanks a bunch! will notify you if i made any progress
07:06 AM Fuchikoma: Apparently there is also a Terminal Window extension for Atmel Studio
07:06 AM Fuchikoma: https://www.youtube.com/watch?v=YW1C0bK6_ks
07:08 AM egy: yes, i saw that; but it's just a bare version of any decent terminal out there; it connects to a port of your choice then receives/sends i/o
09:26 AM skz81: Fuchikoma, egy : when I tried it, the stimuli "language" was very basic...
09:26 AM skz81: IIRC it was on AS7 but some while ago. Maybe new version updated that
09:39 AM Fuchikoma: I never really looked into them, seemed like a PITA
10:54 AM skz81: https://sweetsimplevegan.com/wp-content/uploads/2018/05/Homemade_Pita_Bread_Sweet_Simple_Vegan-copy.jpg*
10:54 AM skz81: I want a kebab
10:55 AM skz81: PITA bread :p
10:55 AM polprog: mmm
11:18 AM Smashcat: Gah, spend almost an hour trying to work out why a circuit seemed to be crashing. In the end it was because I was using "PORTx|=(1<<PIN);DDRx&=~(1<<PIN);" for an active low input. Forgot the chips now use the PUEx register for input pullups, so it thought a button was constantly pressed, holding up the code :)
11:18 AM Smashcat: (problem was sporadic, as the pin was obviously only oscillating low sometimes - which didn't help!)
12:56 PM egy: Smashcat: spending an hour is sometimes good; i spent this morning (in vain) trying to figure why register C of uart (aka UCSRC) is not set even though i clearly set the hell out of it
12:57 PM egy: skz81: thanks for sharing! i think your AS7 was fairly recent (current version is 7.0.23), so no "major" updates took place
12:57 PM Smashcat: :)
01:33 PM flip214: with avr-gcc, is there a trick to get the length of a memory area into a register? a: .byte 0,0,0,0 b: and somewhere else ldi r19, lo8(b) - lo8(a) gives an error "garbage at end of line"
01:34 PM flip214: I guess that lo8 isn't evaluated to a constant at that time... can I force that somehow?
01:35 PM djph: wha
01:35 PM djph: ldi only takes two operands, a register, and a byte.
01:35 PM polprog: flip214: like in any assembly code
01:36 PM polprog: a: .byte whatever bla bla bla
01:36 PM djph: polprog: except nop
01:36 PM polprog: len_a: .-a
01:36 PM polprog: ?
01:36 PM djph: polprog: 'nop' is a complete command, with no additional parameters
01:36 PM djph: hahahaha
01:37 PM polprog: what?
01:37 PM djph: polprog: no op (just burn a clock cycle)
01:37 PM polprog: yeah, what about the nop
01:38 PM djph: polprog: I said ldi [...] you added in "like any assembly code". I countered with "except nop"
01:38 PM djph: and I'm pretty sure my brain is leaking out my ears having to listen to these managers talk
01:38 PM polprog: ah i get it now
01:39 PM polprog: flip214: yeah so thats how you do it. a .len label
01:39 PM polprog: should be len_a: .byte .-a
01:40 PM flip214: polprog: but then there's a RAM location containing the length ... I hope to do a load immediate into a register
01:40 PM flip214: RAM is scarce ;)
01:40 PM polprog: hmm
01:40 PM polprog: you could try putting that in bss then
01:40 PM polprog: as in
01:40 PM polprog: a: .byte 12,34,56
01:40 PM polprog: a_end:
01:40 PM polprog: .bss
01:41 PM polprog: nah
01:41 PM polprog: wrong approach
01:41 PM polprog: try .equ
01:55 PM flip214: Can I have a pin change wake the AVR from SLEEP but not generate an actual interrupt?
01:58 PM polprog: i dont think so
02:01 PM LeoNerd: Just ignore the interrupt.. you can have an empty ISR
02:03 PM polprog: ^
02:08 PM flip214: yeah... seems wasteful, the reti and the space for the jump vector table
02:08 PM flip214: ;)
02:08 PM polprog: waking up from sleep isnt that super fast either
02:08 PM polprog: and if there isnt an interrupt, theres a jmp in the vector table anwyays :D
02:23 PM polprog: why assembly though
02:23 PM polprog: hmm got the camera working
02:24 PM polprog: in IR mode
02:24 PM polprog: i love those CCTV lenses
02:24 PM polprog: the range is crazy. 5-50 mm on a .33 inch sensor is an enormous range
02:24 PM polprog: and the focus range is amazing
02:24 PM polprog: shame it doesnt keep focus when zooming
02:28 PM Fuchikoma: flip214: Use acompact interrupt table and the whole thing is like... 8 bytes
02:29 PM polprog: thats shorter that some modern x86 registers
02:29 PM polprog: ^_^
02:31 PM Fuchikoma: I forget the actual size but you can set a config register to use "compact" vector table, which lumps all of the various interrupt source into just 3 or 4
02:31 PM polprog: huh, til
02:32 PM Fuchikoma: Three.
02:32 PM Fuchikoma: Compact Vector Table bins all interrupts into Non-Maskable, Level 1 and Level 0
02:33 PM Fuchikoma: I guess technically there's still Interrupt Vector 0 which is Reset
02:35 PM Fuchikoma: Of course if you're relying on multiple interrupt sources this can make it a hassle to figure out what caused the interrupt, since they all trigger the same vector, but presumably that's not a problem if you're using this option :)
03:15 PM egy: TIL compact vector table
03:32 PM polprog: must not have been in mega16/8 or any other ive dealt with
03:32 PM polprog: t4313
05:20 PM fengshaun: I'm trying to graduate from arduino and move on to C on avr (I've done C on x86 before). Where do I go for a good source to get started?
05:21 PM djph: fengshaun: you already wrote for arduino, right?
05:21 PM nohit: join #avrs for staters
05:21 PM fengshaun: djph, yes
05:21 PM djph: haha and that
05:21 PM nohit: and check out the topic
05:22 PM djph: fengshaun: in which case, you've already "finished(tm)" the "source to get started"
05:22 PM fengshaun: hmm arduino hides pretty much everything though
05:23 PM fengshaun: I want to work with bare avr
05:23 PM nohit: yes there's plenty of tutorials @ #avrs topic. cant link it here because of reasons
05:23 PM fengshaun: -_- alright, thanks
05:24 PM nohit: and there's also helpful people there
05:24 PM djph: fengshaun: yet, it's still "C on avr". There's not ... really ... all that much extra to learn. Everything else is kinda just in the datasheets
05:25 PM fengshaun: thanks
11:39 PM day__ is now known as day
11:43 PM rue_mohr: fengshaun,
11:44 PM rue_mohr: an origional arduino is just an avr on a carrier baord
11:44 PM rue_mohr: the only software bit that ends up on the thing is a bootloader
11:44 PM rue_mohr: if you would like I can walk you thru coding one in C
11:44 PM rue_mohr: w/o the arduino ide