#avr | Logs for 2014-03-04

Back
[03:56:51] <phinxy> i opened up a ipod clip 2G and it contains a nand which is 16GB according to datasheet
[03:56:54] <phinxy> could it be possible
[04:07:37] <hjohnson> phinxy: that's probably 16 gigabit
[04:07:43] <hjohnson> so divide by 8 for gigabytes
[04:08:11] <hjohnson> flash is generally spec'd in bits not bytes
[04:08:51] <phinxy> hjohnson, that might be it. 16Gb Mono
[04:08:55] <phinxy> does that mean gigabit
[04:09:24] <hjohnson> yeah
[05:13:48] <Casper> I never understood why memory are specced in bits...
[05:30:12] <hackvana> Casper: That's what people say when memory is only useful to them as bytes
[05:33:03] <hackvana> You might have a use for memory that is a bitstream (for example, SD), or in 16-, 32- or greater bitwidths
[05:40:21] <phinxy> oh. why isnt everything in bits then?
[05:44:39] <hackvana> It is after I've finished with it
[07:07:58] <phinxy> http://pastebin.com/3NwJx3xg
[07:08:14] <phinxy> its a wireless transmitter test. how can i recieve data after it just sent it?
[07:08:44] <phinxy> and whats the point of knowing the data to be recieved in the first place?
[07:10:46] <jacekowski> no
[07:10:48] <jacekowski> it sends data
[07:11:06] <jacekowski> then waits until some data is recieved
[07:11:17] <jacekowski> and then it just reuses the buffer to store recieved data
[11:37:54] <wip> is it possible to output a float frequency with PWM? meaning not 440, but 440.5
[11:45:57] <blathijs> wip: PWM is usually implemented using a fraction: You configure a timer to count up to some value (typically 256, but other values are possible) and then reset to 0. Separately, you use a compare register to turn the pin on while the timer is less than the compare register and of afterwards
[11:46:24] <dunz0r> Depending on which MCU you use you can get a higher resolution, but not a float. Iirc
[11:46:34] <wip> yes that is working
[11:46:44] <blathijs> wip: In other words, you can't control the frequence directly, so you can't write "440" somewhere and have it work
[11:46:56] <wip> blathijs: i know
[11:47:18] <wip> dunz0r: so in between frequency of int is not possible...
[11:47:21] <blathijs> so 440 and 440.5 aren't too different, you'll have to convert them into a TOP and COMPA value anyway (which you can do offline for a fixed frequency)
[11:47:38] <wip> 440 is not 440.5 :)
[11:47:43] <dunz0r> wip: Not that I know, no. Are you sure you need a float?
[11:47:51] <dunz0r> This sounds a bit more like an X/Y-problem :)
[11:48:09] <dunz0r> You want to do X, but you've decided that Y is the only solution, although it's probably not even possib.e
[11:48:13] <dunz0r> *possible
[11:48:26] <wip> ie: guitar tuning is 329.63 not 329
[11:48:37] <wip> or 330
[11:49:16] <dunz0r> wip: But if you've got a higher resolution on your pwm...
[11:49:38] <wip> dunz0r: yes i have 3 16bit timer
[11:49:58] <dunz0r> Like say you've got a 12-bit resolution.
[11:50:07] <wip> dunz0r: but still not able to have a float frequency. please share how
[11:50:08] <blathijs> If your CPU is 16Mhz and you count to 256, you'll get a frequence of 1/(16000000/256) == 0.000016 <-- tada! float
[11:50:09] <dunz0r> That way you can get 3296 :]
[11:50:19] <dunz0r> wip: Multiplication! :)
[11:50:45] <dunz0r> wip: Yeah. Don't forget that you get frequency as well.
[11:50:51] <dunz0r> PWM is just "percent on"
[11:51:06] <dunz0r> Then you've got the frequency at which it toggles between on/off
[11:51:57] <wip> my formala is: top = (clock/(prescaler*frequency))-1
[11:52:31] <wip> so if i want 329.63, then 16000000/(1024*329.63)-1
[11:52:44] <blathijs> wip: Yes
[11:52:52] <wip> == 46.40
[11:53:01] <wip> cannot put that is the register
[11:53:07] <wip> in the
[11:53:51] <blathijs> wip: I think the point I'm making is that you cannot have every exact frequency, as you already found out, but if you use 329 (e.g. int, not float), then you'll likely _also_ get a result that you'll have to round (i.e., you can't get 329Hz exactly either)
[11:54:40] <wip> not even when using a 16bit timer?
[11:54:43] <blathijs> wip: However, note that you're only using 46 or 47 of the 65536 values that your timer has. If you lower the prescaler, then you'll be able to use more of the timer and you'll get closer
[11:56:05] <wip> so let's say prescaler = 1 then == 48538.27
[11:56:36] <blathijs> wip: Yes
[11:57:04] <blathijs> Reverse your formula to get the actual frequence, so you can see the effect of rounding
[11:57:43] <wip> blathijs / dunz0r: THX!
[11:58:06] <wip> i now get it, just needed a brainstorming
[11:58:08] <wip> :)
[11:58:58] <blathijs> wip: yw :-)
[11:59:12] <dunz0r> No problems, now I know how to solve this as well if the need should ever arise :)
[12:34:18] <hotch> Is anyone else using a Mac / AVR ISP? Just having some issues that I found referenced online trying to communicate with my ATtiny85 ...
[12:37:23] <hotch> Also, what is the best place to buy AVRs price-wise?
[13:45:10] <wip> hotch: sorry to say that here, but AVR (atmega/attiny) are so expensive...
[13:45:39] <hjohnson> eh?
[13:45:41] <wip> hotch: i buy them at digikey, but not sure if it's the cheapest place
[13:45:51] <wip> atmega640 is like 13$
[13:46:00] <wip> a rasberrypi is 35$
[13:46:30] <hotch> Yeah nah it's OK, I saw them quoted in a book as ATtiny85 being like .85. I had been getting them at spark fun then switched to digikey - which is much better :)
[13:46:33] <hotch> thanks wip
[13:46:50] <hjohnson> hrmm.. it's amusing... an atxmega128a1u is cheaper than an atmega162
[13:52:09] <megal0maniac_afk> The xmegas are great
[13:55:29] <hjohnson> yeah, I want to get goign on my project :)
[15:07:52] <hotch> Hi everyone, I am using an avrisp mkii. For example, when I "ls /dev/cu.*" in OSX, I get my USB connected Arduino. However, after plugging in my ISP, I don't see any new items in /dev/cu.*. Any ideas? Is this "normal??
[15:10:26] <vsync_> don't use osx i hear osx is for batty bois
[15:18:57] <hotch> getting away from Arduino, the only ISP that seems to work with OSX is Arduino :/
[15:19:06] <hotch> (on OSX)
[15:19:35] <synic> does os x have a dmesg
[15:19:45] <synic> heh. nevermind, I don't know what I'm talking about
[15:20:17] <synic> hotch: it's a genuine mkii?
[15:20:39] <hotch> this one: http://tom-itx.dyndns.org:81/~webpage/boards/USBTiny_Mkii/USBTiny_Mkii_index.php
[15:21:43] <synic> what's this stuff about crosspack
[15:21:43] <hotch> It's totally fine though, just stoked on spending several days on this finally getting it working so I can code now :)
[15:22:23] <hotch> synic: yeah for development the one thing that os x fails at is hardware :/, cross pack is the osx bundle for the avr toolchain
[15:25:59] <hotch> make
[19:42:18] <naquad> are there any AVR best practices? or some patterns? i don't want to reinvent my own bike
[19:42:48] <Casper> avoid _BV()
[19:42:52] <Fleck> :D
[19:42:58] <naquad> Casper, why? 0o
[19:43:22] <Casper> that was added as a temporrary patch due to a bug in gcc optimisation
[19:43:38] <naquad> k, thanks, will make my own macro
[19:43:49] <naquad> i've got a small own macromess :)
[19:43:50] <Casper> it got deprecated, but due to popular it got dedeprecated
[19:43:53] <naquad> for bits and stuff
[19:44:04] <Casper> just use bitshift
[19:44:39] <naquad> i'll use a macro, BV(X) much more readable and clear than (1 << X)
[19:44:47] <naquad> and less typing :)
[19:45:01] <Casper> actually, 1<<x is more readable
[19:45:26] <naquad> also i have my own set_bits(where, bit1, bit2, bit3) => where = _BV(bit1) | _BV(bit2) | _BV(bit3)
[19:45:33] <naquad> Casper, fo whom? 0_0
[19:45:40] <naquad> i bet that you love assembler
[19:45:56] <Casper> naquad: anyone that is more than novice
[19:46:28] <Casper> another trick... use proper names for the register and bits
[19:46:42] <Casper> it simplify the conversion to another device
[19:46:55] <naquad> Casper, sincerely doubt that. of course my C practice was replaced with scripting languages (and i don't mean perl:)), but things like those don't seem to be more readable
[19:47:10] <naquad> Casper, i'm always using #defines instead of direct values
[19:49:19] <Casper> I've seen some that wrote to the register directly instead of using UBR for example...
[19:49:38] <Casper> I forgot the syntax... but man... the code was just impossible to read
[19:50:18] <naquad> i've seen several examples like those too, 0xef instead of explicit port list or some flags
[19:50:37] <naquad> i've been looking at it and thinking: "and wtf is 0xef?"
[19:51:34] <naquad> Casper, what do you say about that: https://gist.github.com/9359520 ?
[19:51:44] <naquad> imho they made code to look even better
[19:52:27] <Casper> look stupid to me
[19:52:34] <naquad> why?
[19:52:59] <Casper> more layers, do not make the code easier to read
[19:53:24] <Casper> and may prevent some optimisation
[19:53:41] <naquad> Casper, such as? that expands back to usual C syntax
[19:53:45] <naquad> thats a preprocessor after all
[19:53:51] <naquad> compiler will work with resulting code
[19:54:32] <Casper> I've hear of some case where it do not, I forgot which one however
[19:58:40] <naquad> well, it doesn't look like
[19:59:16] <naquad> well, looks like gcc figures out those exprs fine. i see in constant in assembler output
[20:00:22] <naquad> i'm not using there a function with constant argument which could lead to inability of compiler to substitute it with computed value, but just basic operators w/o any vars
[20:21:25] <naquad> Casper, do you write in C or in ASM?
[20:22:02] <Casper> C
[20:22:15] <Casper> I'm not masochist enought to write in asm :D
[20:23:13] <naquad> Casper, could you please show some piece of your code? just want to see how do you people write for microcontrollers
[20:24:12] <Casper> don't have some on hand right now
[20:41:20] <N2TOH> @ 5MHz the sine looks like crap
[20:44:09] <N2TOH> seems to 450 to 460KHz nice enough
[21:19:01] <dj_pi> is there a channel for atmel arm series uC's?
[21:53:07] <hotch> not sure, I haven't seen any ARM talk here though (yet?)
[22:10:44] <dj_pi> having a problem getting a custom board up and running with sam4l
[22:10:57] <dj_pi> i can jtag in and break on main
[22:11:17] <dj_pi> but if i add sysclk_init to main...just goes off into the weeds after i flash
[22:11:29] <dj_pi> anyways....its late....i guess time for bed