#avr | Logs for 2017-01-15

Back
[00:12:31] <chisight> what is the most commonly used lib for targeting atmega338p? is there a site with docs on it?
[00:13:06] <chisight> i'd be working under linux.
[00:14:28] <chisight> I'm not new to C or embedded, just new to avr.
[00:44:28] <rue_shop3> avr-libc
[01:02:36] <chisight> rue_shop3: where is that hosted?
[01:04:16] <chisight> is that http://savannah.nongnu.org/projects/avr-libc/ ?
[01:06:00] <chisight> and, thanks rue_shop3.
[01:12:22] <Casper> that is it
[01:12:24] <Casper> but
[01:12:30] <Casper> your package manager probably already have it
[01:18:24] <chisight> Casper: thank you. i see there is a jtag debugger available, will openocd work for debugging too?
[01:18:44] <Casper> no idea, never used jtag, never saw the need to invest in that
[01:19:50] <chisight> openocd runs on a pi zero that costs 99 cents. not a very big investment.
[01:27:39] <chisight> Casper: looks like openocd does support debugging avr, it was in the openocd docs.
[01:28:56] <chisight> so if you have a pi or live near a retailer that sells them cheap, 99 cent debugger. (of course i've not actually done this yet.)
[01:33:17] <Casper> jtag is also costly pinwise
[01:33:32] <Casper> usually it also eat 4 of your ADC pins too
[01:36:14] <chisight> oh, that would be a problem for the app that i want to debug first.
[01:37:45] <Casper> there is other mean of debugging, like using serial
[01:37:47] <chisight> i started some code under arduino but quickly discovered the lack of hardware flow control in their serial implementation and serial was one of the main features of theirs that i was using.
[01:38:56] <chisight> does avr-libc have software serial on arbitrary pins?
[01:44:50] <Casper> no
[01:44:56] <Casper> you need some libs or make your own
[01:45:27] <Casper> for hardware, try peter fleury's lib
[01:46:08] <chisight> is there i good site to find this sort of thing that is compatible to avr-libc?
[01:46:49] <chisight> thanks, I'll look at fleury's for hardware serial.
[01:55:44] <chisight> http://beaststwo.org/avr-uart/ seems to be saying fleury's lib does not support the 328p. fortunately there is a version there that does.
[02:01:43] <chisight> the hardware serial is in use by the app, so i found a couple software options on http://www.avrfreaks.net/forum/software-serial-uart?page=all
[02:07:04] <chisight> is there a good site to find this sort of thing that is compatible to avr-libc?
[02:10:30] <carabia> probably everything found on avrfreaks is...?
[02:11:37] <Casper> if it do not, it is just a matter of changing some headers
[02:11:40] <carabia> if you're running into trouble using a "uart lib", make your own routines. takes you probably 15 minutes even if you're not familiar with it
[02:11:46] <Casper> most likelly a search and replace
[02:13:34] <carabia> possibly 20 mins tops!
[02:14:03] <chisight> I'm a slow programmer... aka, not very good.
[02:14:38] <carabia> okay, 45 then
[02:15:04] <carabia> you've already spent three quarters of an hour searching (or wasting time), get to it, NOW!!
[02:15:22] <chisight> thanks for the pointers. I've done serial on other chips, i guess you're right, it's not that hard.
[02:15:44] <carabia> there's like a million readily available bitbang uart implementations around, though
[02:16:49] <carabia> http://lmgtfy.com/?q=bitbang+uart+atmega328p
[02:17:05] <chisight> oh, I'm not near a dev machine, not an avr tonight.
[02:18:49] <carabia> then what
[02:21:04] <carabia> also chisight I /think/ you can get openocd to work with the dragon/ICE, apart from that it's a no-go
[02:21:35] <carabia> cause mega/tiny uses the atmel proprietary protocol for ocd
[02:21:45] <chisight> I'm just getting going and wanted to talk to humans to have some clue that i was taking a reasonable path. the hype on websites has a way of being very misleading when you have no clue.
[02:22:01] <carabia> even then, I would suggest using atmel studio over openocd for debugging it
[02:22:29] <chisight> is atmel studio linux now?
[02:22:34] <carabia> and the absolute need for ocd on mega/tiny is questionable at best
[02:22:35] <carabia> chisight: no
[02:22:54] <chisight> i don't have any windows boxen anymore.
[02:22:57] <carabia> just saying, it's thier proprietary protocol, and last I checked openocd did not play really great with it
[02:23:04] <carabia> their, even
[02:24:30] <chisight> ok, so probably bitbang serial is my only debug option short of paying many many times the cost of the avr to get proprietary tools that won't run on my computer anyway.
[02:25:21] <sabor> just debug with a scope
[02:25:53] <sabor> toggle some debug output pins when someting interesting happens in software and watch them
[02:27:11] <chisight> I'm down to one pin, plus the extra acd pins that are input only.
[02:28:02] <chisight> adc
[02:29:49] <carabia> debugwire is 1 pin!!
[02:29:59] <carabia> so go get some atmel gear(r)(tm)
[02:30:17] <carabia> though I guess you really can't change the dW pin :)
[02:30:44] <carabia> if you /really/ want ocd, feel free to look around google how the reversing of it is going
[02:31:59] <carabia> atmel lovers get all pissy when you hint that the maker favorite tiny/mega-line has a proprietary debugging protocol which still to date has not been reverse engineered fully
[02:32:18] <carabia> keyword: proprietary. "open hardware" :-D
[02:35:19] <carabia> of their jtag-shizzle i am unsure of, but afaik 328p doesn't have jtag in the first place. only dw
[02:38:03] <chisight> i was just googling around and yeah dw is on the 328p, but at $100, it's 50x the price of 328p board. i can get a whole lot of stm32 chips for that much change.
[02:38:59] <sabor> or you could get a lot of chips from a different manufacturer with different problems ;)
[02:39:30] <sabor> but out there are lots of chips with 2 or more hardware uarts...
[02:40:16] <carabia> chisight: yes, now you're on the right track.
[02:40:28] <chisight> so far stm32 debugs great under eclipse using openocd and a pi. it's a big environment and the chips cost twice as much though.
[02:41:33] <carabia> having worked many years with stm32s, never had problems with openocd and gdb using cheap clone stlinks
[02:42:13] <carabia> eclipse has gdb integration by default and you can easily set it up to fire an openocd server to write read and debug
[02:42:30] <chisight> i don't have an stlink yet. just wires. I'm getting an stlink to support stm8 though.
[02:42:33] <carabia> eclipse itself is dogshit however and i've stopped using it
[02:42:55] <carabia> stlink(v2) clones are a few dollars off ebay
[02:43:11] <chisight> i agree there, eclipse is a bit big and painful.
[02:43:48] <chisight> yeah, but the pi was 99 cents. the stlink is on the way, for stm8 chips.
[02:44:09] <carabia> pi?
[02:44:22] <chisight> raspberry pi zero.
[02:44:44] <carabia> is that a ca too?
[02:44:55] <carabia> i don't keep track of things in the ca world
[02:45:04] <carabia> they're too big, scary and complex
[02:45:34] <carabia> stm8's a bit of a pain in the ass, i think. Don't think you can use gcc. Can you?
[02:46:16] <chisight> it's an openocd ... not sure of the word... interface maybe. you can swd and jtag over gpio with it.
[02:46:35] <carabia> no i mean the pi zero is like, cortex-a, yes?
[02:46:38] <chisight> stm8 is sdcc like pic.
[02:46:44] <carabia> yeah, sdcc
[02:47:34] <chisight> it's cortex, probably a, it's a small pc to me, i never use it as anything but a pc like tool.
[02:47:56] <carabia> i guess you can get stm8s in dip, and that's probably the biggest thing for it to use over cortex-m0/3
[02:48:29] <carabia> with a c-m you can use cmsis for uniformity if you want
[02:49:16] <chisight> i got some for 11 cents each as boards with a crystal and a regulator with a usb connector for power.
[02:49:47] <carabia> yeah the price diff is one too. it's an order of magnitude roughly
[02:49:55] <carabia> if you go for production runs
[02:50:17] <chisight> yeah, i use cmis on stm32.
[02:50:26] <chisight> smsis
[02:50:29] <carabia> :D
[02:50:32] <carabia> once more
[02:50:41] <chisight> bah, you know what i mean.
[02:51:46] <carabia> yesh
[02:53:49] <chisight> i don't do the production runs, but the clients do. they tell me what their goals are and money is usually a consideration. avr is for me though. if i have a client choose it, I'll get an ATATMEL-ICE-BASIC at least.
[02:55:04] <chisight> arduino hardware is just dirt cheap, so i have some. their libs just suck too much so it's time to abandon them.
[02:55:27] <Emil> lol no
[02:55:41] <chisight> no?
[02:56:17] <Emil> avr's are expensive as fuck
[02:57:01] <carabia> you have no obligation to use the arduino libs
[02:57:06] <Emil> And "avr libs" are just fine, awespme
[02:57:07] <Emil> oh
[02:57:13] <carabia> oh, the pi zero is an older arm
[02:57:15] <Emil> hes talking about shitduino
[02:57:16] <carabia> it's like arm11
[02:57:24] <carabia> still too complex and scary for me.
[02:57:59] <Emil> Getting started with arm is cancer, though
[02:59:14] <Emil> I mean: downlosd this assembly blob to even boot your device, now download this to set up things and then start code
[02:59:38] <chisight> what's wrong arm? the m0 has been easy.
[03:00:19] <carabia> yeah cortex-ms are straightforward, but the pi zero is an arm11
[03:01:43] <chisight> avr 328p is a little over 2 bucks with a usb serial, crystal, reset button all on a handy breakout. not a bad deal.
[03:02:43] <chisight> oh, the zero is a small pc to me, i don't program them. the boot blob is not much different from the proprietary bios on my desktop.
[03:02:54] <carabia> anyway, on the note of arduinos, if you find some cheap arduino boards suitable for whatever project you happen to be working with at the time, get them and just use c. when you do serious projects i don't think you can just rely on the bootloader, you need to get a programmer. most likely a usbasp, if you don't want to invest in a legit programmer. Even then, if you want to keep it simple I think stm8 + stli
[03:03:00] <carabia> nk (if you're used to sdcc), is a safer bet, cause of all the problems usbasp seems to be causing
[03:03:35] <chisight> i have a usbasp, just haven't needed it yet.
[03:04:33] <carabia> yeah, a cm0 board with 3v3 reg, usb, xtal, rst button and pins broken out is roughly the same price
[03:04:54] <carabia> perhaps with a flashy led, too!
[03:05:55] <chisight> yeah. the only stm32 i have were for a client and are bigger m0 chips, lots of ram and flash. 4 bucks each.
[03:07:06] <carabia> yeah I think you can get stm32 m0s up to 256 KB flash / 32 KB sram
[03:07:07] <chisight> i have 2 more on the way that are like you describe though, for me.
[03:07:51] <chisight> iirc, it was 256/64.
[03:08:20] <chisight> nice chip.
[03:08:40] <carabia> hmmm
[03:09:26] <Emil> chisight: stm32*4 at least is fucking annoying
[03:09:43] <carabia> I don't think they make 64KB sram m0s, do they?
[03:09:51] <carabia> you sure it wasn't m3?
[03:10:22] <chisight> was a year ago and I've not touched it since. was bare chip since the discovery only came with the smaller chip.
[03:10:28] <Emil> chisight: and if you are talking about china modules that's different from actual chips
[03:10:46] <carabia> well, i could be wrong.
[03:10:59] <chisight> it was m0. it's more likely i remember the ram wrong.
[03:11:01] <Emil> carabia: wat
[03:11:12] <carabia> possibly.
[03:11:16] <Emil> carabia: one cant rely on bootloader wat
[03:11:50] <Emil> Avr is the fuck simples thing to work with.
[03:11:52] <chisight> i usually buy china modules but the stm32 was a chip without breakout Emil.
[03:12:52] <sabor> hi _ami_, you've got email right now :)
[03:13:23] <carabia> can I have some email, too?
[03:14:26] <chisight> i thought the bootloader might be an issue, i used them with pic and lost them now and then, so i bought the usbasp just in case.
[03:14:53] <chisight> so far no issues.
[03:15:52] <carabia> probably half the problems presented here are usbasp-related :D
[03:16:07] <carabia> some of which are probably miswiring, though
[03:17:00] <chisight> well then I'll try not to mess up linking and overwrite the bootloader, if avrdude can even overwrite the bootloader.
[03:18:16] <Emil> chisight: pls. Avrdude flashes the whole chip (unless config things and hacking)
[03:19:00] <Emil> So you'll lose the bootloader everytime you flash with usbasp unless you include your bootloader
[03:20:00] <chisight> thanks Emil, that's good to know. i don't plan to use usbasp unless i blow the bootloader or for some reason need the space.
[03:21:04] <chisight> with pic, you just had to link at the right address to avoid overwriting the bootloader.
[03:21:56] <chisight> guess i should say pic14, so sdcc.
[04:24:58] <_abc_> .
[04:25:09] <Jartza> ,
[04:25:52] <_abc_> Okay so my dds adventures in atmega inline asm: I spent some time to make it work, the problem is gcc refuses to stay off the global register volatile bytes I reserved for the high speed asm in the single isr.
[04:27:02] <_abc_> I can make it work with very simple C code but as soon as I get anything more than string.h in there (no printf no math) the compiler starts clobbering my precious phase accumulator bytes (4 reserved) and throws warnings. Looking at the .lst shows ...
[04:27:06] <_abc_> ... clearly that it makes a complete mess.
[04:27:37] <_abc_> Rewriting on top of these vars in various places and also seems to completely lose the plot on setting them from constants.
[04:28:41] <_abc_> I tried to turn off optimization, going down to -O1 and even -O0 where this happens in C code functions, and that also did not help. -O3 creates completely insane code, -O2 is somewhat usable.
[04:29:18] <_abc_> So, any hints on how to make things like 'register volatile uint8_t foo asm("r16");' co-exist peacefully with C code would be much appreciated.
[04:30:22] <_abc_> Also I ran the tests to see what happens with the delay Jartza and I see 4 (!) jitter delays in atmega328 as predicted, not 3. 2 are very frequent, the next is rare, the 4th happens once every 30 million instructions or so.
[04:30:51] <Jartza> I wouldn't use anything else than -Os on avr
[04:30:53] <_abc_> Make that 300 million.
[04:31:10] <_abc_> I tried -Os too, not a good idea with inline asm.
[04:31:46] <_abc_> I am trying to figure out if I use the clobber section of inline asm();, would that help with the compiler noticing the silly things are in use and are not to be clobbered?
[04:32:09] <_abc_> Are other compilers better for this? Keil, IAR?
[04:46:13] <sabor> _abc_: why don;t you just separate the things in 2 files, put C code in main.c and put assembler in main.s
[04:49:01] <_abc_> How would that solve anything. The variables are global and used all the time in the isr
[04:50:13] <sabor> you mean register?
[04:50:55] <_abc_> I mean global. Top level. And yes register and volatile.
[04:51:03] <sabor> the C compiler doesn;t touch any variables you don't tell it to touch
[04:51:31] <sabor> registers are a different thing, i don't know if a directive exists which tells it to not touch a register
[04:51:35] <_abc_> volatile register uint8_t dp1 asm("r21"); is touched very much thanks.
[04:52:01] <_abc_> As code gets more complex, I find it is used for temps and such in functions.
[04:52:21] <sabor> store your variable sin RAM, not in registers
[04:52:46] <sabor> or don;t mix with C, if you write everything in ASM you have full control over it
[04:53:09] <_abc_> And I get a warning like (2) "warning: optimization may eliminate reads and/or writes to register variables" and "warning: call-clobbered register used for global register variable"
[04:54:06] <_abc_> It is not possible to write fast asm code in isr with vars stored in ram, push and pop are way too expensive, so is indexed access to ram
[04:54:32] <_abc_> Those vars need to stay in the register file, this is the purpose of this project, to make that part work, the rest is details
[04:55:41] <_abc_> So this is really a compiler question, there are 32 registers in the cpu, I am appropriating 4 or 5, why can't the compiler NOT touch them at all?
[04:56:18] <_abc_> Note that if I simplify the code a lot, then it works, they are left alone
[04:57:00] <sabor> do you link other code to it which has not been compiled with this "locked" register?
[04:57:07] <_abc_> no
[04:57:30] <_abc_> the .lst file shows that the violations occur in my own functions, which are unrelated to the ISR
[04:57:32] <sabor> are you sure?
[04:57:36] <_abc_> yes
[04:57:41] <sabor> because you mentioned string functions and math.h
[04:58:06] <_abc_> string functions are not on math.h and they are inside the lst which is byte accurate vs output hex.
[04:58:32] <_abc_> The violations are temp register allocations made by the compiler, ignoring the reserved nature of the global registers. Also, it does not save them
[04:59:00] <_abc_> I will try to restrict my use of reserved registers but it gets really tedious.
[04:59:03] <sabor> saving them won't help, the interrupt can come any time
[04:59:20] <_abc_> I know but the compiler should at least pretend it is respecting my allocation!
[04:59:37] <sabor> somehow it thinks it has to use them because it's running out of registers or something
[04:59:46] <_abc_> Not only does the interrupt come at any time, it comes all the time. The isr runs extremely fast in this application, that is the point.
[05:00:01] <sabor> yeah
[05:00:42] <_abc_> It tries to use large temp register banks in functions which deal with simply copying uint32_t bytes (not even shifting) instead of using a pointer or similar.
[05:00:58] <_abc_> Even with -Os
[05:03:48] <sabor> somehow this doesn't make sense that it ignores that register allocation sometimes
[05:04:22] <_abc_> Tell me about it
[05:09:59] <hypermagic> <Emil> Getting started with arm is cancer, though - i tend to agree an case microchip and atmel arms, but what do you think about nxp arms?
[05:11:53] <sabor> hypermagic: what's wrong with microchip and atmel arms? (i never looked at them)
[05:12:24] <_abc_> nxp is non open source non free cancer with a pedigree
[05:12:55] <_abc_> pic and avr are/were the most popular arches since the late 1990s and still are made and used by the ton.
[05:13:02] <hypermagic> atmel: starting to bootloaderbundle crappy usb shit, and no real linux support, microchip, even more issues
[05:13:21] <sabor> ooh, ok
[05:13:30] <_abc_> also mchip's pic32 is mips not arm.
[05:13:35] <hypermagic> _abc_, what? gcc-arm can compile or arm
[05:13:43] <sabor> i'm playing with an stm32 at the moment...
[05:13:58] <_abc_> hypermagic: the special tools needed to program nxp arms became open source only lately
[05:14:18] <hypermagic> sabor, i avoid microchip like cancer, those are unreliable chips
[05:14:20] <_abc_> How slow is a stm32 to ouptut to an io? 3-4 core clocks?
[05:14:37] <_abc_> hypermagic: well yes they are however documented in silicon erratas
[05:15:11] <sabor> hmm, have to do a speed test...
[05:15:17] <hypermagic> _abc_, what special tools? the programming device can be made using parallel port
[05:15:31] <_abc_> hypermagic: for stm32? jtag mode?
[05:15:36] <hypermagic> noooo
[05:15:40] <hypermagic> nxp arm!
[05:16:09] <_abc_> hypermagic: is it finally targetted by gcc with no more binary crutches?
[05:16:40] <hypermagic> _abc_, ;/ compile your toolchain from source on linux dude
[05:17:00] <hypermagic> you don't need to use a bootloader unless you want one
[05:17:16] <_abc_> which nxp part exactly do you have in mind.
[05:17:36] <hypermagic> i have picked a few i liked
[05:17:52] <_abc_> such as?
[05:18:14] <hypermagic> LPC1763FBD100
[05:18:31] <hypermagic> cheap and good in my opinion
[05:18:48] <_abc_> $7 at digikey?
[05:18:53] <hypermagic> http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc1700-cortex-m3/256kb-flash-64kb-sram-no-can-lqfp100-package:LPC1763FBD100#featuresExpand
[05:19:01] <hypermagic> approx
[05:19:15] <_abc_> Plus a tqfp capable pcb needed
[05:19:30] <hypermagic> i like tqfp more than bga
[05:19:46] <hypermagic> more reliable
[05:19:49] <_abc_> And no usb?!
[05:20:15] <hypermagic> there are versions with usb and ethernet but i dont want one
[05:20:32] <hypermagic> usb is crapshit in hardware terms
[05:21:38] <hypermagic> (and atmel is bundling usb with some preinstalled bootloader for you) ;)
[05:23:31] <hypermagic> they figured it will be simpler to extract your (locked) stuff (with master keys) if they don't even need a reader, just plug in a laptop
[05:24:46] <_abc_> let's see how we can cool you down: $4.5, soic, can diy board at home, mips32 40MHz, USB, as much ram and flash as yours http://www.tme.eu/en/details/32mx270f256b-i_so/32-bit-microchip-microcontrollers/microchip-technology/pic32mx270f256b-iso/
[05:24:56] <_abc_> *$4.9
[05:25:04] <_abc_> in ones/4.5 10
[05:25:17] <hypermagic> and it is always good to have an unreliable link with strict communication bitrate speed without ecc as communication link
[05:25:46] <hypermagic> _abc_, there was a reason i picked 80-100MHz eones
[05:25:57] <_abc_> Yeah, right.
[05:26:12] <hypermagic> and no microchip thanks ;)
[05:26:38] <_abc_> to each his own. Btw this is #avr pertaining to atmel avr which is owned by microchip.
[05:26:53] <hypermagic> there are no miracles that could make those industrial grade
[05:27:01] <_abc_> There should be a #nxp channel on freenode where you can take this ;) Also a #stm32 one
[05:27:23] <hypermagic> there is an arm chan here just didn't join now
[05:27:32] <_abc_> microchip pics are and have been in like 60-80% of small industrial automation devices
[05:27:41] <_abc_> And they stay that way, mostly.
[05:28:18] <hypermagic> hah i see arm is pretty dead now
[05:28:27] <_abc_> Mchip even has some pic32s in DIP. Breadboardable mips who would have thought
[05:30:34] <carabia> I guess you are arguing with hypermagic
[05:30:41] <carabia> there really is little-to-no point in doing that
[05:32:20] <_abc_> :)
[05:32:23] <hypermagic> _abc_, you are wasting your time if you want to convince me to use any pic, even if they are free, i have solid reasons
[05:32:44] <_abc_> Oh, there's a #pic channel too somewhere,
[05:32:49] <hypermagic> same goes for anything made by max
[05:33:10] <_abc_> back to avr gcc. Any ways to make the compiler not touch my precious global register variables?
[05:33:39] <hypermagic> maxim creates gadgets for hobby at high price
[05:34:18] <hypermagic> _abc_, you mean static?
[05:35:46] <hypermagic> http://www.avrfreaks.net/forum/static-variables-between-main-and-isr
[05:36:57] <_abc_> avr libc byte packing in uint32_h is little endian or big endian?
[05:37:02] <carabia> and no, it's 2 clocks for io toggle. I think it's throughout the line, stm32
[05:37:19] <_abc_> carabia: yes, most arms do that
[05:37:33] <carabia> yeah, so why didn't you say that in the first place then
[05:37:34] <_abc_> 4 for read modify write and 2 for toggle set or clear
[05:37:45] <_abc_> Because I was hoping things improved ;)
[05:38:10] <carabia> ...
[05:38:10] <_abc_> Compare with a scenix pic lookalike from circa 1999, 100MHz clock, one clock per io.
[05:38:46] <carabia> ...
[05:39:06] <_abc_> http://www.brouhaha.com/~eric/ubicom/ see SX projects
[05:39:16] <_abc_> 1998
[05:39:35] <_abc_> 23 years have passed and we STILL can't do that cleanly in a cheap mcu
[05:39:49] <hypermagic> _abc_, how long are you in the programming business?
[05:40:50] <_abc_> Jartza: http://www.brouhaha.com/~eric/ubicom/servid/ fun blast from the past, compare with your video code in avr tiny in the /topic
[05:44:43] <hypermagic> _abc_, http://stackoverflow.com/questions/346306/what-is-the-difference-between-a-static-global-and-a-static-volatile-variable
[05:45:34] <hypermagic> also do you use ATOMIC_BLOCK() ?
[05:55:07] <Jartza> _abc_: that's 20x4 and 1200bps
[05:55:22] <Jartza> I do 32x16 at 9600 with attiny85
[05:55:35] <Jartza> and support ansi escapes
[05:56:49] <Jartza> https://github.com/rakettitiede/octapentaveega
[05:57:09] <Jartza> 6x10 pixel font
[06:00:06] <Jartza> so pentaveega is a little sister of that one :)
[06:01:43] <hypermagic> Jartza, text output 3 processor sli vga card ;> https://github.com/rakettitiede/octapentaveega
[06:01:44] <_abc_> yes but yours had 23 years to grow.
[06:02:11] <Jartza> hypermagic: indeed
[06:02:51] <Jartza> but you get monochrome with single attiny :)
[06:03:01] <hypermagic> ;<
[06:03:09] <hypermagic> i want a laser display
[06:03:14] <Jartza> I could've done 8-color from single attiny but with less characters on screen
[06:03:17] <hypermagic> can you?
[06:04:08] <hypermagic> Project on wall or in midair with 24-32 bit BGR or BGAR
[06:05:30] <hypermagic> btw laser printers have a spinning mirror
[06:06:53] <Lambda_Aurigae> of course they do...at least, the ones that don't have an LED bar.
[06:07:53] <hypermagic> Well yea ;/
[06:08:48] <Lambda_Aurigae> and most laser displays have 2 spinning mirrors...much easier to move the beam than it is to move the laser or laser diode.
[06:09:46] <Lambda_Aurigae> the ones I've seen use a curved mirror for the second one.
[06:10:24] * _abc_ wonders if his avr-gcc questions would be welcome in #gcc or in #workingset
[06:10:50] <Lambda_Aurigae> if it's a compiler question, probably
[06:11:16] <Jartza> yeah
[06:11:36] <Jartza> if it's you using compiler wrong, probably they'll just bash you
[06:11:44] <Jartza> a bit elitistic those channels
[06:11:52] <_abc_> They tend to flame people in gcc. Anyway what DOES avr-gcc use for markers in per device configs to leave io registers alone when they are not present or special
[06:12:05] <Jartza> at least they were few years ago, which is why I parted
[06:12:09] <_abc_> Indeed
[06:12:50] <Jartza> _abc_: do yoi have multiple files in compilation?
[06:12:56] <_abc_> one
[06:13:00] <Jartza> hmm
[06:13:12] <Jartza> and you reserve register globally?
[06:13:17] <_abc_> not by accident ;) I am a rookie at avr asm not at hacking bit level stuff.
[06:13:20] <_abc_> yes
[06:13:35] <Jartza> and it's not one of the "special"?
[06:14:51] <_abc_> nope. r16 17 18 19 are reserved, and left alone, then r20 21 22 23 - when reserved - things go South
[06:15:12] <_abc_> I assume the compiler simply can't work with the remaining registers.
[06:15:31] <_abc_> But code emitted is grotty without -O2.
[06:25:34] <shangul> attiny5?!
[06:26:15] <shangul> i have seen attiny11 but this?
[06:27:29] <Lambda_Aurigae> like an attiny
[06:27:31] <Lambda_Aurigae> only smaller!
[06:36:19] <shangul> how many/much pins, flash, eeprom?
[06:38:11] <shangul> is this code right to have 8 leds on?
[06:38:12] <shangul> ser r16
[06:38:12] <shangul> out 0x18, r16
[06:38:12] <shangul> a: rjmp a
[06:40:08] <Lambda_Aurigae> look at the datasheet for info.
[06:40:52] <Jartza> shangul: 6 pins, 512 bytes flash, 32 bytes ram
[06:40:57] <Jartza> no eeprom
[06:41:44] <shangul> <Lambda_Aurigae> look at the datasheet for info. => for code or attiny5?
[06:42:01] <Lambda_Aurigae> tiny5
[06:42:13] <Lambda_Aurigae> or ask Jartza...hehe
[06:42:42] <shangul> <Jartza> shangul: 6 pins, 512 bytes flash, 32 bytes ram => thx, 6 pin with or without power pins?
[06:42:43] <Jartza> heh
[06:42:50] <Lambda_Aurigae> 6 pins
[06:42:51] <Lambda_Aurigae> total
[06:43:04] <Lambda_Aurigae> so you get 4 pins for i/o max
[06:43:10] <shangul> cool!
[06:43:12] <Jartza> shangul: 6 pins. in that vga I have 3 usable pins
[06:43:47] <Jartza> out of 6, three are reserved for vcc, gnd and clock
[06:44:11] <Jartza> check the link in topic, there is schematics and pics
[06:44:15] <Lambda_Aurigae> to turn no the i/o pins you have to set the port to output and set the pins high..unless you are sinking rather than sourcing.
[06:44:39] <shangul> clock?what's this?needs external crystal?
[06:45:30] <Lambda_Aurigae> he uses external clock, not just a crystal.
[06:45:41] <Lambda_Aurigae> crystal is an external timing source for internal oscillator.
[06:45:57] <Lambda_Aurigae> Jartza's vga thingie uses an external oscillator.
[06:46:18] <Lambda_Aurigae> only uses 1 pin for clock rather than 2 for crystal.
[06:46:26] <Jartza> shangul: vga requires very precise timings
[06:46:42] <Jartza> none of the internal oscillators are accurate enough
[06:46:42] <Lambda_Aurigae> internal RC oscillator is not stable enough for VGA.
[06:47:04] <Lambda_Aurigae> would be nice if they put an internal crystal on a microcontroller though.
[06:47:10] <Jartza> I use sot23-5 sized resistor configurable oscillator
[06:47:21] <Jartza> LTC1799
[06:49:19] <shangul> aha
[06:49:21] <_abc_> I think they make xtal osc's in that size now
[06:54:15] <_abc_> I really can't believe that there is not one common mcu with a dds approach capable timer or peripheral. How hard is it to implement an accumulator, an adder, and a phase delta register in hw? It's nothing.
[06:57:13] <shangul> it was intresting
[06:57:17] <_abc_> wait, microchip's enhanced pic's have NCO which is a 20 bit dds
[06:57:21] * _abc_ slaps head
[06:58:14] <Lambda_Aurigae> NCO dds?
[06:58:35] <_abc_> NCO is a Numerically Controlled Oscillator
[06:58:42] <_abc_> Mchip's name for a dds.
[06:58:55] <shangul> inserted pipe instead of newline: ser r16 | out 0x17, r16 | out 0x18, r16 | a: rjmp a
[06:59:25] <shangul> Lambda_Aurigae, ^
[06:59:59] <Lambda_Aurigae> no clue about your 0x17 and 0x18
[07:00:05] <Lambda_Aurigae> that varies from chip to chip.
[07:00:10] <Jartza> shangul: that attiny5 thingie is my project :P
[07:00:22] <shangul> i know
[07:01:00] <shangul> <Lambda_Aurigae> no clue about your 0x17 and 0x18 => ddrb and portb, now it's right?
[07:01:13] <Lambda_Aurigae> should be.
[07:01:27] <Lambda_Aurigae> depends on how your LEDs are connected though.
[07:01:58] <shangul> 8 leds are connected to portb
[07:02:12] <shangul> now it's right?
[07:02:13] <Lambda_Aurigae> yeah, I get that.
[07:02:20] <Lambda_Aurigae> but there are two ways to connect your LEDs to portb
[07:02:34] <Lambda_Aurigae> are they connected to VCC or GND on the other end?
[07:02:43] <shangul> gnd
[07:02:46] <Lambda_Aurigae> active low or active high?
[07:02:52] <Lambda_Aurigae> then that should be right.
[07:02:57] <shangul> what?
[07:03:19] <shangul> <Lambda_Aurigae> active low or active high? => ?
[07:03:23] <Lambda_Aurigae> active low means the AVR provides a GND connection..the other end of the device connects to VCC
[07:03:29] <Lambda_Aurigae> active high is the other way around.
[07:04:18] <Lambda_Aurigae> on another note
[07:04:20] <Lambda_Aurigae> Ringling Brothers Circus closing!
[07:04:23] <Lambda_Aurigae> NOOOOO!!!
[07:04:59] <shangul> bbl
[07:05:40] <_abc_> Lambda_Aurigae: they are closing animal circuses down here too, using an accident at a retired animal facility which burned down as an excuse.
[07:06:12] <_abc_> Greent*rds are at work, although most circus animals have an enviable life even when compared with cattle.
[07:06:18] <Lambda_Aurigae> well, Ringling Brothers retired their elephants a couple years back.
[07:06:36] <Lambda_Aurigae> yeah,,,PETA is one of the main reasons they are closing down here.
[07:06:45] <Lambda_Aurigae> People Eating Tasty Animals.....
[07:07:34] <_abc_> I have had not too close encounters with dangerous terroris militants of that kind before, and I know what kind of 'peace' they are after. They are anti-human. Everything else is secondary to that consideration.
[07:07:35] <Lambda_Aurigae> next generation of kids are really going to miss out.
[07:07:56] <Lambda_Aurigae> the worst are the Vegeterrorists....
[07:08:32] <_abc_> Lambda_Aurigae: Well I assume small scale clowns etc with accompanying animals will exist. I agree that having tigers and lions in small cages so they can jump through hoops on fire is not good, but most other animals are not THAT badly treated.
[07:09:00] <Lambda_Aurigae> the circus is just not the same without the elephants.
[07:09:21] <Lambda_Aurigae> I've been to Ringling Brothers shows probably 20 times over the last 49 years.
[07:09:24] <_abc_> I knew some carny people a long time ago who would move into the animal trailers in Winter because they saved on heating that way. Breakfast a la donkey etc. Was fun for them. It smelled a bit but not much worse than normal stables.
[07:10:09] <Lambda_Aurigae> and used to go visit the Ringling Brothers training and animal care facility in Florida when I lived down there.
[07:10:25] <_abc_> Elephants don't normally need to be enclosed/tied up etc. There was a big scandal here when a travelling foreign circus had one of it's elephants go out on a grassy meadow and graze with nobody around. I think one of the handlers was not too far away.
[07:10:46] <Lambda_Aurigae> just big cows!
[07:10:47] <Lambda_Aurigae> hehe
[07:10:58] <_abc_> They apparently do go berserk sometimes but usually for good reasons.
[07:11:06] <Lambda_Aurigae> I've petted and been near elephants a few times and they are generally gentile.
[07:11:12] <Lambda_Aurigae> but the same can be said for cows.
[07:11:12] <_abc_> India and Africa can show a bit of usually wild elephant rampage.
[07:11:33] <_abc_> Considering that in comparison with say traffic accidents, per number of cars vs elephants, makes it really ridiculously low.
[07:11:36] <Lambda_Aurigae> ok..off to the gym.
[07:11:40] <_abc_> bye
[08:19:06] <_abc_> Okay so the NCO in the enhanced pic's is 20 bit I need at least 24 bit wide, 28 is almost ideal
[08:19:43] <_abc_> Does anyone know of a NCO like peripheral in a mcu? Other than in a pic?
[08:25:34] * _ami_1 going to boot orange pi plus - wish me luck! :)
[08:39:51] <_abc_> Trying to move the register defined vars into the ISR itself as statics. No luck. Code: register static uint8_t acc0 asm("r16"); -> gcc says "error: expected string literal before 'register'"
[08:40:06] <_abc_> Is this a bug/lack of features or am I trying to do something which is verboten.
[08:40:33] <_abc_> I would expect the compiler to obey the register static thing then and there.
[08:42:43] <_abc_> Apparently a local variable cannot be both register and static class at the same time. Pity.
[09:10:22] <Jartza> uhh
[09:11:07] <Jartza> _abc_: so you are using r16?
[09:11:28] <Jartza> I thougjt all the time you are using one of the safe registers
[09:11:36] <Jartza> r2..r7
[09:12:20] <Jartza> also depending of gcc version you might be safer with __asm__()
[09:12:32] <hypermagic> _abc_, how long have you been in the programming business?
[09:14:52] <hypermagic> hi twnqx sup?
[09:15:21] <twnqx> not much, mr. anderson
[09:18:38] <_abc_> Jartza: I tried with r2..7 and later with r16..23, about the same outcome. Am working now to push the asm section into the main loop, and give up on interrupts, or optimize C in the interrupt as much as possible and see how far that goes. Bbl
[09:19:03] <_abc_> Remember I need the registers untouched all the time, since I only touch them in asm
[09:19:52] <_abc_> I could move to an all asm solution but then I have to give up on high level code and math I was also trying to put in this avr, instead of using a dual mcu system.
[09:21:00] <_abc_> The fun part is that the avr is about as much money as the Analog Devices it does not (yet) replace
[09:21:29] <_abc_> So using 2 cpus will not happen, one cpu plus dds chip from analog.com was the previous solution.
[09:21:33] <_abc_> bbl
[10:29:56] <_abc_> avr-gcc is so full of hooey. I placed: "static uint8_t acc0 asm("r16");" in ISR, then, in same isr: "acc0 += dp0;". Reading resulting .lst shows gcc placed acc0 in sram at 0x12B or such, no warnings, nothing.
[10:30:00] <_abc_> Wtf.
[10:30:40] <Richard_Cavell> It's not required to follow your orders
[10:32:11] <specing> GCC is a strong, independent compiler.
[10:34:39] <_abc_> what specing said.
[10:44:06] <hypermagic> #define magic static inline
[10:44:18] <hypermagic> magic void ... ;>
[10:45:07] <hypermagic> _abc_, https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html#Global-Register-Variables
[10:47:18] <hypermagic> _abc_, also do you even volatile?
[10:48:45] <hypermagic> http://www.ethernut.de/en/documents/arm-inline-asm.html
[11:07:08] <_abc_> http://188.25.6.109:8881/mypaste/a0daa060507db22a41cf/avr-gcc-rant-1.txt
[11:09:08] <_abc_> specing: in view of it's efforts to ruin what I am trying to do, I suggest we award it citizenship and a pension. Maybe that way it will cooperate better.
[12:07:01] <hypermagic> _abc_, should not use global register var reservations
[12:08:49] <hypermagic> using -o3 can be made to use more registers btw
[12:10:00] <hypermagic> was playing quite a it with this on amd64 with ddr400, the memory speed is the bottleneck there
[12:12:03] <hypermagic> http://www.nongnu.org/avr-libc/user-manual/inline_asm.html
[12:13:22] <hypermagic> _abc_, you can asm volatile ( - if you want something, you also need to define register clobber list
[12:17:45] <hypermagic> gcc will try to use all variables... it usually does a good job at shuffling stuff around in registers
[12:18:40] <antto> everyday it's shuffling
[12:21:21] <hypermagic> https://www.youtube.com/watch?v=37WO9NHoJuQ
[12:21:45] <specing> hypermagic: you dont't understand
[12:22:04] <specing> these register reservations are to avoid load/stores in interrupt handlers
[12:22:56] <specing> and in my experience (on AVR), gcc does not put stuff in registers across contexts
[12:30:45] <hypermagic> specing, http://stackoverflow.com/questions/15210327/how-to-pass-functions-parameters-in-a-register-with-gcc-asm-keyword never tried this on avr though
[12:31:14] <hypermagic> __attribute__((fastcall,noinline))
[12:36:31] <hypermagic> btw i had to make a macro to avoid calling wasted cycles in c even with inline asm to achieve >58MHz call rate of a function
[12:51:44] <specing> well I've done registers outside isr handler before
[15:32:50] <Emil> ...
[15:32:57] <Lambda_Aurigae> ,,,
[15:32:57] <Fleck> ,,,
[15:33:00] <Fleck> :D
[15:33:03] <Emil> hypermagic: with what processor
[15:33:26] <Emil> uc*
[15:34:31] <Emil> specing: hmm, so if I wanted naked interrupts with avrs I could dedicate some registers only for that task?
[15:34:40] <Emil> And skip the bloody push pop cycle
[15:40:11] <specing> Emil: sure
[15:40:21] <specing> attribute (naked) for isrs
[15:40:25] <specing> no pops, no pushes
[15:41:20] <Emil> specing: I know but then I must make sure to push/pop everything myself
[15:42:39] <specing> well..d'oh
[15:43:58] <Emil> specing: not really documented with C
[15:44:40] <specing> well its implementation defined, like many other things in C
[15:44:49] <specing> so read gcc doc
[15:54:04] <Emil> >read doc lol
[15:54:32] <Emil> Context is still Avr C
[15:55:16] <Emil> anycase, with registers that are reserved one can have asssembly interrupts that have no overhead nd still code in C
[15:57:25] <specing> there is no such thing as "Avr C"
[16:07:17] <Emil> specing: sure there is
[16:07:42] <Emil> it's Avr flavoured C
[16:12:02] <Jartza> it's C
[17:58:37] <Jartza> 336 bytes, LOL
[17:59:16] <Lambda_Aurigae> that's huge!
[17:59:36] <specing> yuuuugeeee
[18:04:51] <Jartza> Lambda_Aurigae: made it even better ;)
[18:04:51] <Jartza> https://www.youtube.com/watch?v=1079rWSyE84
[18:04:59] <Jartza> now the bars don't just "appear" to screen
[18:05:02] <Jartza> they slide in and out nicely
[18:05:21] <Lambda_Aurigae> sweet.
[18:05:34] <Lambda_Aurigae> still needs a button or two and a skiier.
[18:05:38] <Jartza> :D
[18:05:42] <Jartza> I want TEXT
[18:05:44] <Jartza> with font
[18:05:47] <Jartza> :D
[18:05:57] <Lambda_Aurigae> I want a game!
[18:09:54] <Jartza> hehe
[18:09:59] <Jartza> I guess that's a different project then :P
[18:24:31] <Jartza> hmm
[18:25:19] <Jartza> https://www.youtube.com/watch?v=xiDNkZm1lyk
[18:25:22] <Jartza> how bout this then?
[18:26:59] <Lambda_Aurigae> pwetty.
[19:12:36] <Jartza> https://www.youtube.com/watch?v=0onA1ioAI3s
[19:12:40] <Jartza> that's about it for tonight :)
[19:12:42] <Jartza> more tomorrow
[21:01:47] <hypermagic> Emil, amd64 2200MHz
[21:02:09] <hypermagic> (on linux)
[23:03:48] <Levitator> Well, I seem to have bricked my avr, and I remember I got around it once before, and now I can't remember what I did wrong or how I fixed it.
[23:04:42] <Levitator> When I cal avrdude on it, L flashes, followed by RX, and then there is no TX, and avrdude times out.
[23:04:45] <cehteh> the only way to brick an avr is setting wrong fuses
[23:05:03] <Levitator> I seem to remember. Ah! It was the watchdog timer.
[23:05:15] <Levitator> Maybe that's still what's wrong with it....
[23:05:37] <cehteh> bootloader? serial/usb flashing?
[23:05:45] <cehteh> that could be too, thats not really bricked
[23:06:22] <Levitator> I think I wrote a program that immediately enabled the watchdog, so now it resets itself instead of loading.
[23:06:36] <cehteh> i heared that some bootloaders are buggy in regard of watchdog handling
[23:06:39] <hypermagic> http://www.avrfreaks.net/forum/how-utilize-watch-dog-timer-wdt-atmega8-newbie
[23:06:54] <cehteh> yes, watchdog stays active when resetting
[23:07:09] <cehteh> a bootloader should immediately disable that
[23:07:38] <cehteh> but maybe you can flash by powercycling unless you forced the watchdog on by a fuse
[23:08:24] <cehteh> if that doesnt help you can do spi programming
[23:09:02] <Levitator> I think I remember how I fixed this before now. You have to hold in the reset button while plugging into USB.
[23:09:19] <Levitator> Then you have to release the reset at the exact right time as avrdude runs.
[23:09:23] <Levitator> It's a serious pain in the ass.
[23:09:24] <cehteh> yes
[23:09:42] <cehteh> thats one way. preventing your program to start and enable the watchdog
[23:10:12] <cehteh> lesson learned, only enable watchdog when you know you need it and handle it correctly
[23:10:44] <cehteh> and when you use a bootloader, use one which disables the watchdog, at least while waiting for programming
[23:13:14] <cehteh> why do you need the watchdog anyway?
[23:15:15] <Levitator> Might not have been the watchdog. I'm trying to remember what it was.
[23:15:41] <Levitator> Yeah, it was. I was trying to force an output on on power-up for the bootloader.
[23:15:41] <cehteh> prescaler?
[23:16:02] <Levitator> So that I could update over the air using an ESP in transparent mode.
[23:16:10] <Levitator> Now, something is thoroughly bolloxed.
[23:18:54] <cehteh> you didnt changed any fuses right?
[23:19:02] <Levitator> No.
[23:19:20] <Levitator> I could swear I got around this by getting lucky with timing, but I can't reproduce it.
[23:19:21] <cehteh> then it is not bricked
[23:19:46] <cehteh> you have a programmer?
[23:20:32] <Levitator> No, I don't. Just the bootloader.
[23:21:14] <cehteh> better order one now :D makes things easier
[23:21:31] <cehteh> usbasp costs $3 or so
[23:22:21] <cehteh> https://www.amazon.de/SODIAL-Programmer-Adapter-ATMEGA8-ATMEGA128/
[23:23:28] <cehteh> how goes your bootloader in programming mode? timeout after reset? or some pin pulled up/down?
[23:23:48] <cehteh> arduino bootloader?
[23:24:02] <Levitator> Arduino bootloader.
[23:24:14] <Levitator> It never transmits. I wonder if I burnt something somehow.
[23:24:33] <cehteh> then powercycle, while pluggin in keep reset pushed,
[23:24:40] <cehteh> start avrdude, release reset
[23:25:20] <cehteh> reset only wont disable the watchdog, you need to powercycle
[23:26:07] <cehteh> and not start your program, bootloader has to pick up programming instantly
[23:26:08] <Levitator> That's what I'm doing, and if I remember right, the timing is really precise, and I can't seem to get it.
[23:26:17] <Levitator> On the order of milliseconds.
[23:26:33] <cehteh> iirc it has a 1 second timeout
[23:26:40] <Levitator> Hrm.
[23:26:56] <cehteh> after you start avrdude you have a bit time to release the reset
[23:27:06] <Levitator> Avrdude has a long timeout, but the problem is getting the handshake to fall into just the right window.
[23:27:11] <cehteh> and the usb connection has to be established
[23:27:29] <cehteh> well .. get a usbasp, that makes this easy
[23:27:32] <Levitator> No, you plug in the USB with the reset button held in so that the USB establishes, and then that variable is done with.
[23:27:52] <Levitator> THen, the trick is launching avrdud and releasing reset at the exact right time.
[23:29:04] <carabia> also, the planets need to be aligned perpendicular to the milky way
[23:46:20] <Levitator> Lols. Maybe I can rig this mini to erase the flash on the nano and then it will work again.
[23:50:46] <carabia> you should be able to, yes
[23:53:06] <cehteh> yes, but think about that you likely purge the bootloader as well, or is the bootloader section protected from chip erase?
[23:53:21] <cehteh> dunno about the fuses there