#avr Logs

Oct 06 2019

#avr Calendar

12:00 AM very_sneaky: is it possible to have multiple `RET` statements in a subroutine?
12:05 AM very_sneaky: as an example: https://bpaste.net/show/4F2z
12:11 AM Thrashbarg: very_sneaky: as long as you keep track of the stack, there's no problem with doing that
12:12 AM very_sneaky: Thrashbarg, when you say keep track of the stack, what do you mean? properly pop'ing anything that was push'ed in the subroutine?
12:13 AM Thrashbarg: yes
12:13 AM very_sneaky: sweet, cheers
12:14 AM Thrashbarg: I always keep in mind the individual instructions in any CPU are pretty dumb and do exactly what they're supposed to do in their own bubble
12:14 AM very_sneaky: yeah, that was my understanding as well, but i'm seeing some behaviour that i wouldn't expect, that could have been explained if `RET` statements were being ignored
12:15 AM Thrashbarg: can't happen :P
12:15 AM very_sneaky: lol, good to know
12:16 AM very_sneaky: are there any issues with using the special registers just as ordinary registers?
12:16 AM very_sneaky: specifically for counters
12:16 AM Thrashbarg: the fault isn't whether ops are ignored, it's whether the code flow gets to them, and whether the parameters for the opcode will make it do what you want it to do
12:17 AM Thrashbarg: registers are weird in the AVR. The lower 16 can't be used for a lot of things
12:17 AM very_sneaky: yeah, i'm using 16-30 atm
12:17 AM very_sneaky: but 26-30 are special registers
12:17 AM very_sneaky: X and Y reg's
12:18 AM Thrashbarg: yup, they can be used for anything, including the X/Y pointer functions
12:21 AM very_sneaky: hmm, okay cheers
04:36 AM hook007: hello
04:54 AM very_sneaky: general question; what sort of things would cause a program to restart?
04:55 AM very_sneaky: I'm seeing behaviour where it breaks out of the control loop and goes through the initialisation process again, and I can't see for the life of me how that would be possible
04:57 AM hook007: maybe a restart of the device
05:01 AM hook007: bod
05:01 AM very_sneaky: hook007, what would cause the device to restart?
05:05 AM hook007: no power
05:06 AM hook007: depends on the peripherals
05:07 AM hook007: is a brown out detection configured
05:14 AM very_sneaky: nah it's not
05:16 AM very_sneaky: this is a minimum example of the code: https://bpaste.net/show/7psP; some subroutines are missing but it's line 22 and 23 causing the issue
05:16 AM very_sneaky: it works if i comment those out
06:04 AM Kliment: Sigh, this is annoying - I can't seem to wake up from pin change interrupts in standby mode on the 416
06:09 AM LeoNerd: Hrm.. that should work
06:20 AM Kliment: I guess I'll have to stick to idlewait
06:21 AM Kliment: it does wake up - exactly once
06:21 AM Kliment: the next time, it no longer does
06:23 AM Kliment: oh wait, I think I know what's happening
06:24 AM Kliment: the timer clock is disabled
06:24 AM Kliment: because of a bug in atmel start
06:24 AM Kliment: I asked it to run the 16MHz clock in standby, but it doesn't
06:40 AM LeoNerd: Ah, I don't bother with Atmel Start.. I just write my own C code
06:40 AM LeoNerd: I have a nice little HAL in progress here, seems to nicely abstract out most of the bits I use on aVR 1s
06:54 AM Kliment: LeoNerd: I'm unfamiliar with the platform so I'm using start a lot to get correct initialization code in place
06:55 AM Kliment: next stop - getting the bod interrupt to work
07:16 AM Kliment: Looks like bod cannot be configured at runtime, fun
07:31 AM LeoNerd: Oh yeah BOD is a fuse config
07:32 AM LeoNerd: I'm actually impressed how little is fuse-config on the 1-series
07:32 AM LeoNerd: Fuse selects between 16 and 20MHz oscillator, but runtime registers for divider and clock source itself
07:34 AM Kliment: BOD is fuse config for everything except standby mode
07:48 AM Kliment: it's an odd design
12:11 PM rue_bed: I'm gradually getting the impression the 416 is a microchip design FAIL
12:12 PM rue_bed: there seems to be a growing list of issues
12:12 PM rue_bed: are you sure there isn't a flag that needs to be reset regarding the interrupt before you put it back to sleep?
12:13 PM rue_bed: what company are the people working for now that designed the 8 bit avrs?
12:13 PM rue_bed: (tho I think some of the perphials were contracted out)
12:15 PM cehteh: i tihnk microchip brought atmel to put it to an slow and painful death
12:20 PM nohit: yes but it doesnt matter
12:21 PM nohit: avr will stay alive because of the hobbiest community
12:21 PM nohit: and if you need MCUs for professional stuff, then there's STM32
12:22 PM nohit: they are better in every way
12:26 PM rue_bed: actually the stm32 are cheaper than the 8 bit avrs
12:26 PM rue_bed: and microchip will probably do somehting stupid like change the programming protocols on existing chips
12:27 PM rue_bed: which would explain them almost giving away programmers there for a while
12:27 PM rue_bed: they did that before with the pics
12:27 PM rue_bed: the A series was not backwards compatible
12:28 PM rue_bed: 16F84 vs 16F84A
12:28 PM rue_bed: if you had a parallel port hobby programmer, you were screwed
12:28 PM rue_bed: that was the last straw for me and microchip
12:29 PM rue_bed: the only way to program their chips was to buy a programmer form microchip
12:29 PM rue_bed: and, no C compiler
12:29 PM rue_bed: (there was, but it wasn't real C, and you had to buy it)
12:34 PM cehteh: i am planning just to swithc over to risc-v
12:34 PM Kliment: I really like the 416 actually
12:34 PM Kliment: it's the only non-BGA MCU in a 3x3mm form factor
12:35 PM Kliment: So I'm using 416/816 in space constrained designs a lot because I can do 2 layer
12:36 PM Kliment: And the UPDI is also nice for only needing a single pin for programming
12:37 PM rue_bed: I still havn't worked out what to use a tiny10 for
12:38 PM cehteh: i wonder how much of the AVR profits are from hobbyists .. at least they educated a generation of programmers on AVR, its a bit sad when that gets down the drain
12:38 PM rue_bed: well, I almost never see them used for industry
12:39 PM rue_bed: I got some thermostats that use avrs tho
12:39 PM cehteh: i have such an impression too .. but then when you look closer you find them somewhere on motherboards power supplys and other stuff
12:39 PM rue_bed: the power board on them was failing, so there were lots in the garbage
12:39 PM nohit: it doesnt go down the drain :D
12:39 PM rue_bed: their better than the pics
12:39 PM cehteh: 8051 :D
12:40 PM rue_bed: pics are horridly sensitive to power line noise
12:40 PM nohit: oh that strange CISC mcu
12:40 PM rue_bed: and the whole "its 20Mhz!" but with a /4 on the lock was not cool
12:40 PM cehteh: AVR's have a lot good sides, would be a bit sad when they die
12:40 PM rue_bed: I'm migrating to stm32
12:40 PM rue_bed: its just a lot of labour
12:41 PM rue_bed: stm32 as a leap over to arm, technically
12:41 PM nohit: they wont die. just like 6502 ot others
12:41 PM cehteh: i looked at arm, including stm32, may be an option but i rather go for risc-v now, so much nicer in a lot details and chips are coming competive to stm32
12:42 PM rue_bed: I wonder whats happening with the 12F 16F and 18F chips
12:42 PM rue_bed: the prices on the stm32 are better
12:42 PM rue_bed: I was surprised
12:42 PM rue_bed: I can get a pro-mini for like $4, or a stm32 for like $2
12:42 PM rue_bed: bluepill
12:43 PM nohit: they are really cheap
12:43 PM rue_bed: 8Mhz vs 72Mhz
12:43 PM cehteh: i ordered some redpills .. same price than bluepill, just less pwoer, more performance :D
12:43 PM cehteh: will take some time until they arrive
12:43 PM nohit: im looking into the new G4 series, they have plenty of DAC/ADC and plenty of power
12:44 PM nohit: also the MPU is also interesting. i have the linux board, havent had time to play with it yet
12:46 PM nohit: im gonna buy one of these https://www.mouser.fi/ProductDetail/STMicroelectronics/NUCLEO-G474RE?qs=T3oQrply3y%2FWWTZ0gC%252Br%2FA==
12:49 PM nohit: my application is audio electronics so that G4 seems pretty good for it
12:50 PM nohit: with its built-in 12bit ADC/DAC(s)
12:52 PM nohit: that board costs 15e. for a long while there's wasnt any affordable (audio) DSP dev kits available, now there is and with free C compiler. that's amazing
12:53 PM nohit: and you dont need mcu+dsp setup anymore, both functions can be implemented in the same chip
12:56 PM nohit: cehteh: why youre switching to risc-v ? are you planning to be unemployed for the rest of your life ?
12:56 PM nohit: arm is the thing
12:57 PM cehteh: risc-v is the future
12:57 PM nohit: i doubt it
12:57 PM cehteh: i am pretty sure ... esp since trump paves the way :D
12:58 PM nohit: i dont understand why some people have so much trouble for switching to arms
12:58 PM nohit: alkinds of excuses
12:59 PM cehteh: well i was thinking about switching to arm, should be doable as well, but its not so important
12:59 PM cehteh: and actually arm is a big mess, there sint much left from the simple risc arch it once was
01:00 PM cehteh: still its manageable no doubt, its by far the must used 32/64 bit cpu nowadays
01:00 PM nohit: it might be the most used processor
01:00 PM nohit: probably is
01:00 PM cehteh: yeap
01:01 PM cehteh: but have you seen how much risc-v is sprouting, most with well success and a lot more on the horizon
01:01 PM nohit: tbh i havent looked into that
01:02 PM cehteh: then you missed sometihng :D
01:02 PM cehteh: WD switching to it completely for their disc controllers
01:03 PM cehteh: there are plenty chips in the make around the globe, many from china which will use them for the coming IoT stuff which is all made there
01:04 PM nohit: ok
01:04 PM nohit: might be good
01:04 PM nohit: but i would still get arm skills
01:05 PM cehteh: sure, arm wont die anyway
01:07 PM cehteh: https://www.theregister.co.uk/2019/07/27/alibaba_risc_v_chip/
01:10 PM nohit: alibaba is making chips :D ?
01:11 PM cehteh: yeah Trump makes China great again :D