#avr | Logs for 2016-03-15

Back
[05:59:57] <julius> hi
[06:00:54] <julius> inst there always a ~10k resistor on reset even when using ISP?
[06:02:59] <theBear> you don't need a resistor if you got something active to make reset go up/down as required, tho for mostly convenience it is usually not removed just cos you programming or whatever
[06:10:05] <RikusW> julius: Atmel recommends a 10k on reset at all times
[06:10:22] <RikusW> its doesn't affect programming at all
[06:11:01] <RikusW> hi theBear long time no see
[06:12:50] <theBear> oh, i was about to say something about i already agreed and don't need no lectures, then i comprehended a bit harder and decided to say hello instead :)
[06:55:25] <Jartza> yeah. 10k pull-up for reset is good.
[07:37:33] <theBear> my memory wants to say sometimes you even need a 4.7 or 1k, possibly due to naievely loading reset with something (i dunno, maybe a programming led ?) or possibly cos it's been defected by years of drug and alcahol abuse, and is thinking of those little all in one bandpass modulated-ir receivers like tv remotes use
[07:57:09] * RikusW don't like alcohol much
[07:57:58] <theBear> i don't advocate it, theBear ain't the same as humans, you can tell by the spelling, not even same number of letters !
[07:58:10] <RikusW> heh
[08:07:17] <aandrew> a 10k pullup is pretty weak
[08:07:29] <aandrew> it shouldn't affect anything at all
[08:07:44] <aandrew> I don't ever advocate relying on internal pullups unless there's a VERY good reason for it
[08:10:24] <LeoNerd> 10k on reset -can- affect HVSP though
[08:11:01] <LeoNerd> I find that an 841 doesn't enter HVSP mode if I put the reset pullup in
[08:11:08] <LeoNerd> tiny841
[09:01:17] <julius> RikusW, yeah thats what im building in
[09:01:38] <julius> aandrew, internal pullups for pin inputs you mean?
[09:03:50] <julius> just received a constant current source, but that thing has no display. i need it to output ~1a for a led. can i just attach a car light bulb (12v, 55w) and use that as a load to measure with a multimeter and reduce the current to 1a?
[09:09:01] <aandrew> julius: yes
[10:19:59] <LeoNerd> I use a car headlamp bulb as a test load for my current probe :)
[10:32:02] <julius> my constant current source was whining while the bulb got brighter
[10:32:21] <julius> voltage broke down from 9 to 6
[10:32:36] <julius> so the current was probably set way to low?
[10:33:34] <julius> theBear, just read your above comment, hello :)
[10:51:32] <hetii> Hi
[10:51:59] <hetii> In the past someone provide a link to some software port of usb host to handle keyboard
[10:52:06] <hetii> any clue about where it was ?
[10:53:40] <julius> got it. the 9v were even to low for the led. that thing is specified for 9..12v. at 11.5
[10:53:42] <julius> maybe vusb?
[10:54:53] <twnqx> obdev.at or so
[10:58:34] <theBear> i forgot a lot today, it's all too much, but hello, and if i start calling you orange don't be confused, i dunno exactly what orange you is, but i like the sound of it, it sounds like something good
[10:58:50] <theBear> for host it'd have to be lufa i think
[10:59:28] <twnqx> isn't lufa just for the hardware versions?`
[10:59:34] <theBear> with a usb capable avr, pretty sure even igor, the master of all that isn't supposed to be possible on a micro, can't make a non usb avr do host
[10:59:43] <theBear> pretty sure yeah
[10:59:44] <LeoNerd> Is LUFA pronounced like loofah?
[11:00:13] <theBear> yeah, as i recall there was or was gonna be a run of promotional actual ones right at the beginning times
[11:19:56] <julius> this mosfet: http://www.irf.com/product-info/datasheets/data/irlr7843.pdf is available in a D-pack housing...why did they snip the middle pin that short?
[11:20:24] <julius> to-252
[11:23:38] <theBear> d pak don't got a middle pin technically, they use the top/bit that would be heatsink mount on a to220 or so
[11:24:49] <julius> ah ok
[11:25:02] <julius> so the heatsing is transfering the current too
[11:25:55] <julius> is that wise from a security point of view?
[11:26:39] <theBear> security ?
[11:26:46] <liwakura> more safety
[11:26:46] <julius> i mean safety
[11:29:10] <twnqx> normally they switch to ground, so it's ok
[11:29:30] <twnqx> if not: use reverse dpak, with the heatsink to the top, and three pins :P
[11:30:26] <theBear> remembering they got no boltholes so you gotta be soldering them to something anyway, and that all metal-tab transistors and fets have one pin connected to the tab/casing, safety is kinda irrelevant, no reason to expect any particular voltage, from 0 to v+ to be there without details and context and circuit approach, and with bigger ones that you bolt to heatsinks for heatsinkery, you traditionally use mica washers and little plastic "mushroom" things to
[11:30:27] <theBear> isolate the screw from thehole, and white goop of course, silicone grey washers are shit and never shoulda existed, but are sometimes seen in stuff, and in things like mains-input switchey supplies the heatsink is usually live, but you shouldn't be touchign antyhing not obviously grounded without knowing and having a good reason anyway
[11:31:59] <theBear> even switching to 100v say, you gotta be pretty sweaty to get a decent kick, and connected sweatily/firmly to ground somewhere else on your person... but wiggley 350vdc or chopped up version of the same in a mains switcher, that is FAR from comfortable, and not unlikely to kill
[11:32:05] <theBear> seriously, far from comfortable
[11:33:38] * twnqx never tried
[11:33:55] <twnqx> and you don't solder reverse dpak to anything but their feet :P
[11:34:20] <theBear> yeah, i don't recommend it
[11:34:57] <twnqx> i only replaced a pair once
[11:35:12] <twnqx> spent almost a day figuring out what they are and where to get them
[11:37:16] <julius> theBear, i guess you did that by accident one time?
[11:42:31] <theBear> probly a couple over the years, but my first job involving lots of working on powered valveamps that all got way more voltage than the mains inside 'em suggests i got a not-bad heart, so y aknow, less risk than someone who never touched something and got no idea how theirs is... lotta times people only findout they got a shitty one when they die or get damned close for some reason
[11:46:41] <julius> i doubt that my health insurance would suggest such a test ;)
[11:52:24] <theBear> i'd do a lotta stupid things just to know what it's like, but i sure as hell wouldn't be "testing" anything like that by choice.... things like performing surgery at home on yourself, that's one thing, but choosing to shock yerself onsomething like that, even if it wasn't so likely/able to cause a light case of death, that's just silly, adn i don'tthink massochism is an excuse either, cos yer doing really feel or even kow what's going on (with those
[11:52:24] <theBear> hivoltage AND choppedey kinda shocks) until you somehow been removed from contacting the thing (remebmer big shocks will make muscles contract HARD, so yer quite likely to grab onto something like that, tho either way if yer lucky you might kinda jump yerself backwards across the room and wakeup against the far wall, which don't feel good, but probly saved yer ass) and after is just the residual pains mostly from tearing all the muscles, and as a
[11:52:25] <theBear> massochist i can say that kinda pain just isn't so special
[11:55:51] <twnqx> isn't the contracting more of a problem with DC than AC?
[11:56:31] <twnqx> 'cause then the bigger problem in SMPSs is the high frequency in the PFC stage :P
[11:56:38] <theBear> those switchers are arguably more dc than ac at that point, it's 0 and +350vdc being pulled/chopped to hi/low most times
[11:57:12] <twnqx> at 400khz...
[11:57:26] <theBear> but not really, they both basically make yer muscles lock, and you lucky to relax between SHORT pulses even at about 1hz and MUCH smaller voltages, so no chance at 50/60
[11:57:37] <twnqx> hm
[11:58:20] <theBear> above kinda audio freqs it gets weird, more like a tingley burney sensation than anything, and 400khz probly not high enough, but as you get up there it becomes more a question of rf and skin burns than anything else
[11:58:56] <twnqx> i thought it could also be a problem with your heart muscle not contracting fully any more
[12:02:39] <theBear> mmm, sounds likely
[12:03:14] <theBear> i got mostly observed personally kinda background here, and very little proper medical-pro reference or info
[13:18:30] <cehteh> hops ... ordered some tiny84 few days ago over amazon, already arrived :D
[13:18:32] <RikusW> I wonder if there is an avr inside ? https://www.elektormagazine.com/news/far-out-man-jimi-hendrix-vaporizer-has-a-micro-inside
[13:19:19] <cehteh> 8051 :D
[13:19:45] <cehteh> why? .. because you need something that sucks for a vape
[13:19:59] <RikusW> heh
[13:22:03] <RikusW> lol for the last part -> Sadly the makers could not comment on tech details Elektor readers want so badly. It is said though that chunks of source code, JTAG connectivity and the like should become visible in a purple haze and all along a watchtower after some use of the vaporizer.
[13:22:27] <cehteh> send one to ifixit for dismantling them
[13:25:32] <lorenzo> cehteh: tiny84 is like tiny85 but with moar i/o ?
[13:28:02] <RikusW> yep, 14 pins instead of 8
[13:28:10] <cehteh> yes
[13:28:51] <cehteh> my plan: tiny84 -> uln2003 -> leds
[13:29:03] <cehteh> (on multicopter)
[13:29:40] <cehteh> needs one signal in from the RC receiver, one adc in for battery, rest can be outputs for anything
[13:30:17] <cehteh> maybe bonus points when i can serial TX in for telemetry and parse that as well
[13:30:47] <cehteh> but that might be a bit much for a tiny
[13:31:06] <cehteh> (non trivial telemetry protocols, USI etc)
[13:34:18] <LeoNerd> tiny84 lacks a UART
[13:34:29] <LeoNerd> tin841 has two. I always felt that was somewhat overkill ;)
[13:37:06] <Jartza> but tiny84 can run @20MHz
[13:39:50] <cehteh> and has this insane PLL shit
[13:41:12] <cehteh> i dont really need uartm because 'just UART' wont make this telemetry thing that much simpler, and effort/worth ratio for this project is quite low
[13:41:49] <cehteh> just parse the RC signals and use ADC for watch the battery .. thats good enough
[13:42:17] <cehteh> maybe serial soft/USI serial for configuring the thing itself
[13:46:00] <Jartza> what's insane PLL shit? :)
[13:47:36] <Jartza> IIRC attiny84 doesn't have PLL
[13:48:03] <cehteh> not?
[13:48:14] <cehteh> i thought it has, but i dont need it, didnt checked
[13:48:56] <Jartza> not that I know of
[13:49:36] <cehteh> decided that for this project any avr would do, needed more than 5 i/o .. brought the cheapest 14pin tinys i've found done
[13:50:11] <cehteh> ah yes no pll
[13:50:46] <cehteh> i am going to OSCCAL it with the RC frames ..
[13:51:04] <cehteh> internal OSC ... just default freq
[13:51:26] <cehteh> absolutely no demands on this project :D
[13:53:44] <cehteh> will become a test project for mµOS :D
[14:07:21] <Jartza> cehteh: should've looked at attiny88 ;)
[14:07:25] <Jartza> I love those
[14:09:11] <Jartza> costs about nothing
[14:13:12] <cehteh> i wanted 14 pin dil
[14:13:28] <cehteh> smal and still normal pitch rasterboard
[14:13:38] <cehteh> because quickndirty thing
[14:15:28] <cehteh> possibly building only 2 or 3 of these things
[14:22:30] <Jartza> mkay
[14:29:23] <cehteh> are there some drivers ULN2003 alike in SMD available (likely yes) any recommendations?
[14:30:06] <cehteh> ah fund it
[14:35:46] <Evidlo> Anyone have experience with the CD4046 PLL?
[14:39:23] <Evidlo> Or rather, how hard is it to demodulate FSK at around 2.5KHz with a clock rate of 8MHz? Is it difficult to implement?
[14:44:25] <cehteh> 2.5k carrier or signal?
[14:44:55] <cehteh> arent there any demodulators in hardware already?
[14:45:46] <cehteh> methinks > filters, comparator, done :D
[14:46:06] <cehteh> https://de.wikipedia.org/wiki/Frequenzumtastung#/media/File:Demodulator_cfsk.png
[14:46:12] <cehteh> wikipedia thinks like me
[15:05:43] <Jartza> Evidlo: did you get any scope pics about the ringing you had?
[15:50:37] <Evidlo> Jartza: http://imgur.com/a/NIW06
[15:50:48] <Evidlo> That's with heavy lowpass filtering, too
[15:51:20] <Evidlo> That was a 4th order filter with fc set somewhere around 400Hz
[15:53:45] <Evidlo> cehteh: I spent some time trying to get a PLL working right, but the whole thing seems imprecise. I had to look at these tiny logarithmic graphs that were scanned in the 80s or 90s to determine values for my passives
[15:54:39] <cehteh> passive filter?
[15:54:54] <Evidlo> No, active
[15:54:58] <Evidlo> two sallenkeys
[15:55:07] <cehteh> well possibly pita to calibrate
[15:55:17] <cehteh> but i dont know better, not my thing
[15:55:49] <cehteh> digital filters may do, but that stretches the limit on avrs a bit
[15:56:09] <cehteh> some people implemented that, depends on the signal/usage
[15:56:30] <Evidlo> I don't know what you're talking about now. Is this in regards to the PLL?
[15:56:32] <cehteh> tiny ram and no hw multiplier is really pita
[15:56:59] <cehteh> no doing the whole signal processing DSP alike
[15:57:53] <cehteh> some time ago someone asked here, i thought its completely impossible on AVR's .. but some showed code which can do that in some cases
[15:58:17] <Evidlo> I was going to use Goertzel's algorithm
[15:58:28] <Evidlo> It operates only on a single frequency
[15:58:47] <cehteh> do you need a PLL?
[15:59:57] <Jartza> oh
[16:01:08] <Evidlo> What I need is to implement some form of modulation. That may or may not use a PLL
[16:01:50] <Evidlo> I wass trying to use a PLL, but I couldn't get it to demodulate properly
[16:01:55] <cehteh> i've never done such things
[16:03:01] <cehteh> just 2 simple filters rectified the signals feed both into the analog comparator, interrupts on edge changes
[16:03:07] <cehteh> thats what i thought may do
[16:03:17] <cehteh> but, maybe i am thinking too simple
[16:03:29] <cehteh> tuning the filters and making it robust might be a pita
[16:03:39] <Evidlo> Yeah, I've done that before. I wanted to do something digitally
[16:04:13] <Evidlo> I basically want to do what this guy did, but with an attiny85 https://sites.google.com/site/wayneholder/attiny-4-5-9-10-assembly-ide-and-programmer/bell-202-1200-baud-demodulator-in-an-attiny10
[16:04:23] <cehteh> digital would sample the signal and run a digital filters over it
[16:04:45] <cehteh> yes
[16:05:11] <cehteh> free running ADC can sample at about 15khz iirc
[16:05:37] <cehteh> actually you want it slower, your carrier is 2.5khz?
[16:05:52] <Evidlo> I"m actually using bell202, so 1200 and 2200
[16:06:09] <cehteh> the carrier frequency
[16:06:42] <Evidlo> those are the carriers for bell202
[16:06:58] <cehteh> ah
[16:07:20] <cehteh> i thought they are closer together
[16:07:28] <cehteh> should be doable
[16:11:13] <cehteh> hey another idea for fun and profit (aka, dunno if it works, but maybe worth a try):
[16:11:35] <cehteh> schmitt-trigger your signal, use that as external clock for one of the timers
[16:12:07] <cehteh> compare that against another timer .. voila you can calculate at what free it runs
[16:12:48] <Evidlo> I thought all timers were prescaled from the master clock
[16:14:36] <cehteh> normally yes, but some (all?) avrs can use one io pin as external clock for one (or more) timers
[16:15:22] <cehteh> that timer runs then asynchronously from the master clock
[16:16:12] <grafi_> Does the AVR have any other volatile memories than RAM?
[16:16:37] <cehteh> registers? .. well technically they are SRAM as well
[16:18:21] <grafi_> Yepp, SRAM. Haven't found anything and can't think of what a second volatile memory could be. (question from an assignment)
[16:20:19] <Evidlo> has anyone ever written an avr program directly in hex?
[16:21:07] <cehteh> lol
[16:21:55] <Evidlo> or better yet, has anyone wired up some buttons to the ISP pins and directly entered their program as a sequence of pulses?
[16:22:31] <cehteh> i was thinking about doing that with mechanical switches and punched tape one day
[16:22:43] <cehteh> needs some debouncing
[16:22:52] <cehteh> but caps should do
[16:23:01] <cehteh> bbl
[16:27:50] <Jartza> grafi_: depends how wide you define AVR
[16:28:44] <grafi_> I'm working with an old AVR32, but still can't find anything else than SRAM in the datasheets
[16:28:57] <Jartza> there are AVRs which can have external SDRAM :)
[16:28:59] <Jartza> at least xmegas
[16:29:42] <grafi_> I'm starting to suspect that the question may be a typo of some sort
[16:30:54] <Jartza> or just stupid question
[16:31:01] <Jartza> of course there are CPU registers
[16:31:07] <grafi_> that could also be the case :)
[16:31:12] <Jartza> and IO registers (which as stated earlier, are just SRAM)
[16:40:34] <lorenzo> every memory is volatile given enough time :p
[16:40:53] <lorenzo> i think AVR have the lowest retention time
[16:40:53] <julius> TWI.MASTER.DATA = *(Data_p + Counter_u8); <- if Data_p is a unsigned integer and counter_u8 can be 0 or 1. if counter_u8 is 1 does the pointer point to a different place in the same variable?
[16:42:03] <grafi_> lorenzo: hehe
[16:42:24] <julius> if data_p would be a array i would assume that count_u8=1 is like data_p[1]
[16:49:20] <julius> if data_p points to a variable containing the value xyz that looks like this in binary : 10010000 would *(data_p +0) return 1, *(data_p +1) return 0 ?
[17:36:08] <julius> ah got it
[17:36:22] <julius> counter does not go up for that case, so its just one byte sent
[18:09:15] <julius> i wonder why "pointers" did not survive into newer programming languages
[18:09:21] <julius> what a shame
[18:09:37] <cehteh> haha
[18:09:49] <cehteh> they are better hidden under the carpet
[18:10:13] <cehteh> most problems and bugs come from the wrong use of pointers
[18:12:03] <Evidlo> How long might the average 8bit multiplication take?
[18:13:03] <Evidlo> I'm thinking about implementing this guy's code in C for the attiny85, which means about 32 different multiplications per sample at a rate of 9600 times per second https://sites.google.com/site/wayneholder/attiny-4-5-9-10-assembly-ide-and-programmer/bell-202-1200-baud-demodulator-in-an-attiny10
[18:13:06] <cehteh> for what definition of 'average'?
[18:13:58] <cehteh> multiplication by some constant can be optimized
[18:14:04] <Evidlo> I'm just wondering if I need to go through the level of optimization that he did in order to get it functional at that speed. He wrote it in assembly and did all his multiplication through bitshifts and adds
[18:14:37] <julius> you can also shoot yourself in the foot before going for a walk
[18:14:47] <julius> get bigger hardware and play the saved time
[18:14:53] <Evidlo> Or would it be easier to just modify his asm for the tiny85
[18:15:01] <cehteh> possibly
[18:15:22] <cehteh> or try my idea, using the signal as clock source for one timer
[18:15:30] <cehteh> that could be made very efficient
[18:16:12] <Evidlo> How is that different from a hardware interrupt triggering some routine?
[18:16:22] <Evidlo> There's going to be some amount of noise on the signal, too
[18:16:24] <cehteh> isnt his asm already tiny85 compatible?
[18:16:57] <Evidlo> No, the attiny10 has different registers and at least one difference in hardware
[18:17:23] <cehteh> filter that noise (just aprobiate cap) .. maybe you can use the analog comparator to massage it
[18:17:42] <cehteh> cap and external schmitt-trigger will do too
[18:18:42] <cehteh> you already used active filter .. you can use these again to get rid of the noise
[18:19:29] <cehteh> and porting asm from a smaller to a biggier/newer avr is usually simple enough
[18:21:49] <cehteh> eh see picture below on his page he already only using a simple RC Filter
[18:22:40] <Evidlo> That's just to filter his output square wave
[18:22:42] <cehteh> i's maybe also add a highpass to get rid of any DC component
[18:23:25] <cehteh> yes, but should work against noise too
[18:23:43] <Evidlo> His code shouln't be hard to directly port, but I need to turn the attiny85 into a modem instead of a modulator/demodulator. ie, I need a UART and direction control pin
[18:23:44] <cehteh> you can use a LC instead RC
[18:24:03] <cehteh> just do :D
[18:24:42] <Evidlo> I just don't want to get multiple days into this only to find out that it's impossible
[18:24:43] <cehteh> you have a scope, what kind of noise is there?
[18:25:08] <cehteh> i'd expect it to be on a very different band than your signal (much higher frequencies)
[18:25:25] <cehteh> so even a modest bandpass may get something suitable
[18:25:45] <Evidlo> I'm not worried about the hardware part
[18:25:45] <cehteh> you already thinking about this multiple weeks
[18:25:59] <cehteh> you only find out if it works when you try
[18:26:12] <Evidlo> I spent a long time trying to get Jartza's scheme working, but my radio doesn't like edges
[18:26:21] <cehteh> and the UART thing is likely more tricky
[18:26:38] <cehteh> i dont know Jartzas scheme
[18:26:47] <Evidlo> why is the UART more tricky?
[18:26:49] <cehteh> modulator?
[18:26:57] <cehteh> tiny85 has no uart
[18:27:10] <Evidlo> yeah, I found a software library to do it
[18:27:52] <cehteh> yes but it will spend already timing critical stuff in your signal demodulation, i hope that works
[18:28:06] <Evidlo> apparently the attiny85 has some kind of general purpose buffer than can be adapted to be a UART
[18:28:09] <cehteh> as i saied, just try
[18:28:14] <cehteh> i know
[18:28:22] <cehteh> just the wrong bitorder :D
[18:28:35] <cehteh> and needs some cooking for start/stop bits etc
[18:28:56] <cehteh> some here saied complete softserial is actually simpler
[18:29:03] <cehteh> i dont know, i am not convinced yet
[18:29:18] <cehteh> but its not *that* trivial
[18:29:24] <Evidlo> what's the next smallest chip that has UART?
[18:29:37] <cehteh> see atmel webpage
[18:29:44] <cehteh> there are some tinys with UART
[18:30:03] <cehteh> 841 saied Jartza earlier
[18:31:04] <cehteh> 2 uarts even
[18:32:19] <Evidlo> Maybe I don't even need UART on the tiny. It's just a modem, so it can send the bits straight through
[18:32:48] <cehteh> http://www.atmel.com/products/microcontrollers/avr/tinyavr.aspx?tab=parameters
[18:33:03] <cehteh> ah yes
[18:33:14] <cehteh> when you dont buffer that becomes really simple
[18:33:45] <Evidlo> I do still need bidirectionality. ie, an interrupt that switches demodulate/modulate
[18:33:48] * cehteh still opts for his idea using the signal as clock source for a timer
[18:34:01] <cehteh> no complicated code, nothing time critical
[18:34:05] <Evidlo> I'm not confident enough to develop something like that yet
[18:36:20] <cehteh> how many carier cycles is one bit?
[18:36:39] <Evidlo> As many as I want. i want it to be as fast as possible though
[18:37:03] <cehteh> i thought you use some fixed bitrate, like 1200 baud
[18:37:22] <Evidlo> I don't think I get get 1200 with 1200Hz and 2200Hz carrier
[18:37:33] <cehteh> i havent done the calculations
[18:38:17] <cehteh> well ok no wont work
[18:38:21] <Evidlo> Well that blogpost well 1200baud
[18:38:29] <Evidlo> blog post says*
[18:38:48] <cehteh> i havent read it all
[18:39:11] <cehteh> you need to sample the input at at least twice your bitrate
[18:39:25] <Evidlo> This samples at 8x
[18:39:36] <cehteh> yes should be no problem
[18:39:53] <cehteh> reconstruct the bits, set output done
[18:40:51] <Evidlo> also listen for changes on the direction pin
[18:41:10] <cehteh> didnt you just say you want to do that later?
[18:41:25] <cehteh> also that doesnt need to be listen .. pinchange interrupt
[18:42:36] <cehteh> mhm there was some webpage for calculating active filters ..
[18:42:55] <Evidlo> yes theres plenty for sallenkey topology
[18:43:01] <Evidlo> guess I'll get started then
[18:44:30] <cehteh> when i played wiith one in a simulator i got what you need some camel hump like filter with 2 peaks
[18:45:16] <cehteh> well what you need if you follow my idea if using the signal as clock source
[18:45:26] <cehteh> then you only need one filter
[18:45:49] <cehteh> otherwise 2 filters, one for each freq, connected to the comparator
[18:46:00] <cehteh> that should work too
[18:46:06] <cehteh> just do
[19:19:24] <Evidlo> Are there multiple assemblers for avrs?
[19:19:37] <Evidlo> I'm having issues even compiling this code
[19:20:39] <PoppaVic> avr-as, avr-gcc, avra
[19:20:45] <Evidlo> ah, so apparently the extension matters
[19:31:02] <Jartza> avra is mostly atmel studio compatible (atmel assembler)
[19:31:15] <Jartza> whereas gnu as has it's own syntax
[19:31:42] <Evidlo> I don't know what assembler this guy used.
[19:32:06] <Evidlo> It's complaining about a .fuses directive. It also says .dseg can't be used because the device has no ram
[19:32:18] <Jartza> umm
[19:32:48] <Evidlo> but I don't even see a flag to specify the device
[19:34:07] <Jartza> usually you first include file for specific device
[19:34:31] <Jartza> like tn85def.inc
[19:34:32] <Jartza> etc
[19:34:35] <Mr_Sheesh> I'd think set the device FIRST...
[19:35:07] <Jartza> well
[19:35:10] <Jartza> for example
[19:35:11] <Jartza> .include "tn85def.inc"
[19:35:17] <Jartza> that's from my octapentaveega
[19:35:44] <Jartza> in that tn85def.inc file there is:
[19:35:45] <Jartza> .device ATtiny85
[19:35:47] <Jartza> and so on
[19:35:53] <Evidlo> there is a .device directive
[19:36:41] <Jartza> so where is that code?
[19:36:51] <Jartza> or is it superduper secret?
[19:38:44] <Evidlo> https://sites.google.com/site/wayneholder/attiny-4-5-9-10-assembly-ide-and-programmer/bell-202-1200-baud-demodulator-in-an-attiny10
[19:40:17] <Jartza> should compile with avra
[19:41:23] <Jartza> hmm
[19:41:26] <Jartza> not exactly
[19:41:37] <Jartza> avra doesn't support .fuses directive, you need to set those manually
[19:42:09] <Evidlo> It also has DDRB3-0, which aren't defined in tn85def.inc
[19:42:18] <Evidlo> I think those are equivalent to PB3-0
[19:42:25] <Jartza> well that code is for attiny10
[19:43:14] <Evidlo> yeah, I know. I'm trying to port it
[19:43:43] <Jartza> DDB0...DDB5
[19:44:38] <Evidlo> Should this be as simple as renaming some registers, or significantly more than that?
[19:45:12] <Jartza> more than that
[19:45:20] <Jartza> attiny10 and 85 are quite different chips
[19:45:33] <Jartza> attiny10 has 16-bit timer, whereas t85 has two 8-bit ones
[19:46:22] <Jartza> attiny10 has no LPM instruction, instead flash is read like ram, but only with offset
[19:46:40] <Jartza> on attiny85 if you want to store that sine table on flash, you need to use LPM (load program memory) instead
[19:47:33] <Evidlo> well I do have some attiny10s with me
[19:48:34] <Jartza> it did compile when I added .include "tn10def.inc"
[19:48:56] <Evidlo> does that ship with avra?
[19:48:59] <Jartza> and removed the .fuse -section and renamed those DDRB? -> DDB?
[19:49:02] <Jartza> no it doesn't
[19:49:08] <Evidlo> just online?
[19:49:14] <Jartza> those files ship with atmel studio :)
[19:49:18] <Jartza> but I've extracted them myself
[19:49:20] <Jartza> just a sec
[19:49:40] <Evidlo> https://github.com/DarkSector/AVR/blob/master/asm/include/tn10def.inc
[19:51:00] <Jartza> check your messages
[19:53:01] <Evidlo> thanks
[19:53:10] <Evidlo> Did you change anything else? I'm still getting the no RAM error
[19:53:29] <Jartza> nope, I didn't
[19:54:08] <Evidlo> any special flags on avra?
[19:54:27] <Jartza> nope
[19:54:33] <Jartza> oh
[19:54:36] <Jartza> now I remember
[19:54:45] <Jartza> avra needs a patch to support tiny4/5/9/10
[19:54:52] <Jartza> https://sourceforge.net/p/avra/patches/12/
[19:55:11] <Jartza> git clone git://git.code.sf.net/p/avra/code avra-code
[19:55:13] <Jartza> :)
[19:56:04] <Jartza> https://sourceforge.net/p/avra/patches/
[19:58:11] <julius> ups, i guess i just killed a led, bluetooth module and a avr
[19:58:45] <Evidlo> broken build script!
[19:59:46] <Evidlo> One line 28 they copy a .tar.gz to BUILDIR then try to cd to it...
[19:59:58] <Evidlo> ARCHIVE_DIR
[20:00:40] <Evidlo> maybe it assumes that dir is already there
[20:04:50] <Jartza> dunno, didn't build for linux ever
[20:04:53] <Jartza> I use it with OSX
[20:05:14] <Jartza> just try "mkdir archives" first
[20:05:18] <Jartza> and then rebuild
[20:05:43] <Evidlo> I got past that. I've got compiler errors now
[20:07:46] <Jartza> d'oh
[20:13:23] <Jartza> avra hasn't been updated for a while but it's still the best for command-line
[20:13:25] <cehteh> julius: archivement unlocked. get new equipment and go to the next level
[20:18:38] <Jartza> there's also this http://www.avr-asm-tutorial.net/gavrasm/index_en.html
[20:18:45] <Jartza> but I haven't tried it
[20:23:03] <Jartza> assembler made with pascal sounds a bit scary :)
[20:24:36] <Jartza> but I give it that it's pretty cool because freepascal is even available for msdos still
[20:24:48] <julius> cehteh, hehe
[20:24:54] <Jartza> should work on my mac too
[20:24:55] <julius> that sounds like battlefield
[20:25:35] <Jartza> julius: that sounds like learning. you need to burn some electronics and release the magic smoke to learn :)
[20:25:42] <Jartza> been there, done that.
[20:25:44] <julius> connected plus to minus and minus to plus on a board
[20:26:03] <Jartza> been there, done that :D
[20:26:07] <julius> :)
[20:26:36] <julius> well at least the bluetooth module was from china
[20:55:13] <Evidlo> Does brpl just continue to the next line if the condition fails?
[20:59:52] <Jartza> yes
[21:00:23] <Jartza> like all branch-if-something instructions
[21:01:11] <Jartza> if "something", they branch, if not "something", they continue to next instruction
[21:05:52] <Evidlo> and what about TST? the docs are kind of hard to read on these functions
[21:08:24] <Jartza> it just tests. but doesn't jump anywhere ;)
[21:08:49] <Jartza> it sets sreg flags according to test result
[21:12:16] <Evidlo> Is SREG the 8th bit and MSB is 7th?
[21:20:31] <Evidlo> Jartza: you have octave/matlab?
[21:21:40] <Jartza> no
[21:22:26] <Jartza> Evidlo: SREG contains all kind of flags (bits)
[21:22:34] <Jartza> it's 8 bit registee
[21:22:50] <Evidlo> well anyway, I pulled all the calculation out of the asm and wrote it in octave using bitshifts
[21:23:03] <Evidlo> http://ix.io/sBs
[21:23:38] <Evidlo> I'm hoping that it will stay fast when I implement it in C on the micro
[21:25:40] <Jartza> let's hope so :9
[21:27:58] <cehteh> gcc does sometimes strange things :D
[21:28:15] <Evidlo> also doesnt bitshifting by -8 just result in all 0?
[21:28:41] <cehteh> what is -8?
[21:28:43] <cehteh> left, right?
[21:28:55] <Evidlo> >>
[21:28:55] <cehteh> and is your value signed or unsigned?
[21:29:07] <Evidlo> does it matter?
[21:29:07] <cehteh> right shifts pull the sign
[21:29:09] <cehteh> yes
[21:29:37] <cehteh> better declare anything 'unsigned' unless you know better
[21:29:53] <Evidlo> So if its signed, x >> 8 == 0?
[21:29:57] <cehteh> and the example you posted on the blogpost used rotations too
[21:30:08] <cehteh> yes
[21:30:19] <Evidlo> then what happens if its unsigned?
[21:30:30] <cehteh> 0b10000000 >> 1 in signed is 0b11000000
[21:31:11] <cehteh> in unsigned its 0b01000000
[21:31:19] <cehteh> that way
[21:31:37] <Evidlo> So I think the variables should be signed then
[21:31:48] <cehteh> depends on what you plan to do
[21:32:10] <cehteh> in most cases signed is a bit suprising
[21:32:21] <Evidlo> the last step is to compute abs(a>>8) + abs(b>>8) - abs(c>>8) - abs(d>>8)
[21:32:59] <cehteh> what size have your datatypes?
[21:33:19] <Evidlo> these are just registers, so 8 bits?
[21:33:34] <cehteh> when these are 8 bit bites then >>8 makes little sense
[21:33:51] <cehteh> if its unsinged the result is always zero
[21:34:22] <cehteh> if it is signed the result is 0 when it was positive or zero and -1 when its negative
[21:34:55] <cehteh> so x<0?-1:0 will be more efficient
[21:35:49] <cehteh> note that avrs can only shift by one, when you need to shift multiple steps you need to call the shift multiple times
[21:36:06] <Evidlo> what actually happens in his asm is `tst A; brpl foo; neg A`
[21:36:29] <cehteh> i dont know avr asm very well
[21:36:45] <cehteh> brpl is? branch if positive?
[21:36:50] <Evidlo> yes
[21:37:31] <Evidlo> somehow that snippet is equal to (A >> 8) * (A >> 8)
[21:37:33] <cehteh> where is foo?
[21:37:42] <cehteh> right after that statement?
[21:37:56] <Evidlo> yes, foo: handles B
[21:38:02] <Evidlo> then C, etc...
[21:38:05] <cehteh> then that is the abs() implementation
[21:38:17] <cehteh> A<0?-A:A
[21:39:14] <lorenzo> Evidlo: test A for zero or negative, branch to foo if it's not negative
[21:39:43] <lorenzo> (otherwise, two's complement the value)
[21:40:12] <Evidlo> does TST do the two's complement?
[21:40:18] <lorenzo> no, neg does
[21:41:39] <lorenzo> Evidlo: do you have python installed?
[21:41:42] <Evidlo> yes
[21:41:51] <lorenzo> you can play around with bit shifts easily
[21:41:55] <lorenzo> >>> "{0:b}".format( (0b10000001 >> 8) * (0b10000001 >> 8) ).zfill(8)
[21:41:55] <lorenzo> '00000000'
[21:42:04] <Evidlo> Yea, I've been doing it in Octave so far
[21:43:14] <cehteh> can octave do 8bit integers?
[21:44:05] <Evidlo> I don't know. The result from bitshifts vs the result from direct calculation are slightly different, so I'm starting to think no
[21:45:53] <Evidlo> I guess I'll write it in C now
[21:46:22] <lorenzo> Evidlo: or if you use avr-studio, you can probably debug on a emulator
[21:46:42] <lorenzo> and check the "real" behaviour
[21:46:52] <lorenzo> (no hardware required :-)
[21:47:07] <Evidlo> I'm on Linux
[21:47:25] <cehteh> there is simulavr and simavr
[21:47:28] <lorenzo> me too, but I keep a windows VM available for these kind of things
[21:47:33] <cehteh> *but* i just test on hardware
[21:47:58] <cehteh> abusing some arduino nano for that
[21:50:16] <Evidlo> cehteh: are the registers sort of similar?
[21:50:31] <lorenzo> it's an atmega328p
[21:51:17] <cehteh> Evidlo: yeah
[21:51:32] <Evidlo> I ask because the mega328 and tiny85 dont sound like they would be similar
[21:51:34] <cehteh> there are different instructions sets on biggier AVR's and some differences
[21:51:43] <cehteh> but to test algorihms its just ok
[21:52:06] <cehteh> hey in C i just write algorihms portably and compile them unter linux running from commandline
[21:52:24] <Evidlo> well I already know the algorithm works and I have a tiny85 wired up in front of me
[21:52:33] <cehteh> i dont do asm on the avrs except where really necessary (naked interrupts etc)
[21:52:56] <julius> who wants to win the first price and bulletproof my code before its even tried?
[21:53:28] <Evidlo> can I expect my code to perform similarly to the asm, then?
[21:59:35] <cehteh> similary to what?
[22:04:48] <Evidlo> this: https://sites.google.com/site/wayneholder/attiny-4-5-9-10-assembly-ide-and-programmer/bell-202-1200-baud-demodulator-in-an-attiny10
[22:05:22] <Evidlo> This is where I'm stealing all this from. I'm rewriting a demodulator written in asm for the attiny10 in C for the attiny85
[22:08:18] <cehteh> just copy the asm code over *as is* .. assemble .. fix errors
[22:08:50] <cehteh> for such an algorithm there should be only small adjustments necessary
[22:10:12] <cehteh> btw did you already implemented the modulator?
[22:10:26] <Evidlo> No, but that should be fairly easy
[22:10:35] <cehteh> would make debugging easier
[22:10:45] <Evidlo> I have a function generator
[22:10:47] <cehteh> yes thats why i would start with the modulator
[22:10:52] <cehteh> ok
[22:11:23] <cehteh> how does the real signal (including noise) look like btw?
[22:11:23] <Evidlo> I'm writing it in C because I need to modify the code to make it modulate and demodulate
[22:12:51] <Evidlo> I didn't capture a plot of it, but it looks OK. there is some high frequency noise I will need to filter out
[22:13:41] <cehteh> i still think my approach with a analog to digital input would work better
[22:14:01] <cehteh> doing it all in the avr is a bit stressy
[22:20:30] <julius> gn8
[22:21:33] <cehteh> n8