#avr | Logs for 2013-04-28

Back
[01:23:30] <xelion> Q: Does anybody have or know of a site with an example on printing ADC value to an LCD (assembly language, please)?? Regards
[01:24:57] <xelion> Thermistor >> MCU >> ADC >> Binary value >> *some conversion* >> LCD
[01:26:49] <Casper> that's multiple stuff there
[01:27:08] <Casper> your lcd is probably an hd44780 compatible one
[01:27:16] <xelion> yes
[01:27:25] <xelion> configured in 8-bit mode
[01:27:27] <Casper> so you probably want to take a look at that first
[01:28:19] <Casper> and you might want to move to 4 bits later on to save on pin count, but 8 bits is fine if you can afford the wasting io pins
[01:28:43] <Casper> the ADC is covered in the avr datasheet
[01:28:55] <Casper> the rest is basic math and glue
[01:29:01] <xelion> I'm in 8-bit mode because of code simplicity at the moment.. trying to keep things as simple as possible
[01:29:04] <xelion> :)
[01:29:18] <xelion> I know how to setup the ADC
[01:29:28] <xelion> The LCD is also configured correctly
[01:30:04] <xelion> I only need to see how the conversion is done from binary value to a readable output on my screen
[01:30:58] <xelion> it's the math and glue I'm having difficulties with:(
[01:32:02] <Casper> one simple way, but not optimised is: if x >= 100 then x/100, display, x=x-(number of 100 * 100) and so on
[01:32:32] <Casper> but there is probably some code example for integer to ascii in asm on the web
[01:32:36] * Casper don't do asm
[01:32:55] * xelion ...
[01:33:41] <xelion> I've been searching for asm directives on this for days and weeks on end now...
[01:35:22] <Casper> http://www.avr-asm-tutorial.net/avr_en/calc/CONVERT.html look promising
[01:36:45] <xelion> Casper: thx.. I'll look into that;)
[01:53:08] <Casper> xelion: was it good? or you didn't checked it much? (I'm just curious, going to bed soon)
[01:54:29] <rue_house> Casper, why are my routines so much smaller?
[01:54:56] <Casper> rue_house: because your is broken? :D
[01:55:06] * Casper hides behind the steel pole
[01:55:07] <rue_house> no they work fine
[01:55:37] <rue_house> heh, well I had a minor correction about a year ago
[01:55:39] <rue_house> but yea
[01:56:28] <Casper> but well, that was the first link on my first google query, so don't blame me if they ain't the best one
[02:09:16] <xelion> Casper: easy now, I need to translate this stuff on-the-fly ;)
[02:16:40] <xelion> Casper: I'm not sure if this is what I'm looking for though. When I read the ADC (ADCL into register 16, ADCH into register 17) I do first some right-shifting of R17, then right-rotation through carry on R16, and repeat these steps once again. That way, I use the carry flag to shift the LSB of R17 into MSB of R16, being left with some arbitrary binary number.
[02:18:13] <xelion> I need a way to convert this binary value to a number corresponding to the voltage on the ADC0 pin in the range 0-1023 (10-bit)
[02:20:46] * xelion time difference is a b*****
[02:38:59] <OndraSter_> well
[02:39:03] <OndraSter_> how about simple math?
[02:39:15] <OndraSter_> if 1024 = 5V
[02:39:22] <OndraSter_> how much is 256? :P
[02:40:00] <jacekowski> 1.25
[02:40:12] <OndraSter_> and how do you compute it?
[02:40:21] <jacekowski> magic
[02:40:28] <OndraSter_> (I wanted xelion to answer)
[02:40:59] <jacekowski> then you should have added xelion:
[02:41:30] <OndraSter_> well you weren't talking here recently, he was :P
[02:41:34] <OndraSter_> and he is the one who wants help
[02:41:47] <jacekowski> well, he's one of the examples why math is important
[02:42:12] <OndraSter_> this is simple math
[02:42:18] <OndraSter_> no linear algebra required
[02:42:20] <xelion> sorry
[02:42:25] <xelion> back
[02:42:30] <jacekowski> yeah i know
[02:43:11] <xelion> 512 would be 1/2 of 1024
[02:43:11] <jacekowski> although, saying that, implementation of that in limited range of integer math is bit more interesting
[02:43:31] <xelion> 64 = 1/4 and so on
[02:43:42] <jacekowski> AGAIN?
[02:44:08] <OndraSter_> 64 is not 1/4
[02:44:15] <xelion> no: 128
[02:44:19] <xelion> sorry
[02:44:20] <jacekowski> and you get F for your math
[02:44:24] <jacekowski> another F
[02:44:24] <OndraSter_> still no
[02:44:46] <xelion> ahhh!
[02:44:48] <jacekowski> well, let's start with easy math
[02:44:50] <jacekowski> 2+2=?
[02:45:07] <xelion> jacekowski: would you mind?
[02:45:30] <jacekowski> sorry, but you have no idea how much is 1/4th of 1024
[02:45:33] <xelion> I'm here to seek help, not to be ridiculed
[02:45:40] <xelion> of course i do
[02:45:47] <OndraSter_> well you said 64
[02:45:49] <OndraSter_> then 128
[02:45:50] <jacekowski> you gave TWO wrong answers
[02:45:52] <xelion> I know
[02:45:53] <OndraSter_> none of them is right
[02:46:06] <xelion> i was just tapping on the keyboard
[02:46:09] <xelion> anyway
[02:46:20] <xelion> none of this makes me understand my question
[02:46:52] <OndraSter_> in... 5th? year at school we learned magic thing called "trojčlenka" -- no idea how you call it in english. Basically it means "if left side goes up, right side goes up too"
[02:47:01] <OndraSter_> with the same multiplier
[02:47:03] <OndraSter_> (?)
[02:47:05] <jacekowski> i was going there
[02:47:12] <jacekowski> a/b=x/z
[02:47:24] <OndraSter_> yes, that :)
[02:47:50] <jacekowski> so, 1024/256=5/z
[02:47:55] <jacekowski> so
[02:48:03] <jacekowski> 1024*5/256=z
[02:48:27] <OndraSter_> hah, translator says that "trojčlenka" can be translated as "golden rule", "simple proportion" or "rule of three" :P
[02:48:39] <jacekowski> so, 5120/256=z
[02:48:48] <jacekowski> so, z=1.25
[02:48:50] <xelion> you simply multiply 1024 with the fraction you need ie. 1024/4 = 256
[02:49:04] <xelion> look
[02:49:20] <xelion> I don't need help on simple math
[02:49:30] <xelion> Ï don't have time for this
[02:49:41] <OndraSter_> <xelion> I need a way to convert this binary value to a number
[02:49:48] <OndraSter_> LOL
[02:50:56] <jacekowski> basically, your ADC has 10 bit resolution, and your reference voltage is 5V
[02:51:29] <OndraSter_> he is gone
[02:51:32] <jacekowski> so, 1 LSB = 5/2^10
[02:51:42] <hackvana> OndraSter_: Possibly he means an ASCII string representing the number
[02:51:55] <OndraSter_> possibly... he didn't say :)
[02:52:09] <jacekowski> and he can't tell multiplication from division
[03:18:21] <rue_shop2> /usr/lib/avr/include/avr/io.h
[03:20:49] <OndraSter_> /works/only/on/linux/and/mac.h
[03:21:40] <rue_shop2> it seems every install I do of gcc_avr, the libraries land in a different place
[03:21:49] <OndraSter_> rjh
[03:21:50] <rue_shop2> makes it freaking hard to keep makefiles working
[03:21:50] <OndraSter_> eh
[03:21:54] <OndraSter_> what distro?
[03:22:00] <rue_shop2> debian
[03:22:19] <rue_shop2> my old code dosn't work, but there are no compile errors
[03:23:11] <OndraSter_> ;)
[03:25:05] <rue_shop2> C sports portability, I can run the code on an avr or an X86, but if I try to compile yesterdays code today, I'm doomed
[03:32:35] <Vutral> hi OndraSter_
[03:37:31] <OndraSter_> hi Vutral
[03:37:46] <rue_shop2> who can help me confirm registers for pwm on port B3 and D7...
[03:39:00] <rue_shop2> B3 is OC0
[03:39:14] <rue_shop2> D7 is OC2
[03:39:24] <OndraSter_> you forgot to tell us the chip
[03:39:33] <rue_shop2> :P
[03:40:22] <rue_shop2> void SetPWM( uint8_t channel, uint8_t value) {
[03:40:23] <rue_shop2> if (!stop) {
[03:40:23] <rue_shop2> if (channel & RIGHT) { OCR0 = value; }
[03:40:23] <rue_shop2> if (channel & LEFT) { OCR2 = value; }
[03:40:28] <rue_shop2> k
[03:40:44] <rue_shop2> OUTPUT << PB3
[03:40:50] <rue_shop2> OUTPUT << PD7
[03:40:56] <rue_shop2> I'm confused
[03:41:06] <rue_shop2> I really dont udnerstand why this dosn't work
[03:41:47] <OndraSter_> I don't understand the channel & RIGHT
[03:42:02] <rue_shop2> its a bitmask
[03:42:11] <OndraSter_> ah ok
[03:42:17] <rue_shop2> I can set one, the other or neither :)
[03:49:36] <OndraSter_> http://cz.mouser.com/ProductDetail/Lattice/LCMXO2-7000HE-B-EVN/?qs=DBbQ3l7BldNJuSVNFnSpPw==
[03:49:36] <OndraSter_> wow
[03:49:37] <OndraSter_> cheap
[04:24:30] <nevdull> like RIGHT could be 0x00FF and LEFT could be 0xFF00 or some such
[04:29:08] <Vutral> i wonder if rue_shop2 is worried we steal his intellectual property ^^
[04:29:09] <Vutral> not telling us the chip
[04:32:30] <specing> AtGiga8?
[04:33:09] <OndraSter_> damnit, I hate videos which have got sound only on the left or only on the right speaker
[04:33:18] <OndraSter_> my whole head hurts after few seconds
[04:46:24] <skroon> hi
[04:46:29] <OndraSter_> hihi
[04:46:34] <nevdull> heyas
[04:46:42] <skroon> anyone that can recommend a book, that talks about libavr ?
[04:48:30] <nevdull> what is that? like avr-libc or ?
[04:49:41] <skroon> sorry that's what I meant indeed :-) avr-libc
[04:49:56] <skroon> most books talk about avr studio, but i'm not on a windows platform
[04:50:00] <nevdull> ah no worries :)
[04:50:12] <nevdull> well i found the best info in the manuals and tool chain articles
[04:50:26] <nevdull> http://www.nongnu.org/avr-libc/user-manual/index.html
[04:50:34] <nevdull> http://www.nongnu.org/avr-libc/user-manual/install_tools.html
[04:50:42] <nevdull> http://www.stderr.org/doc/avr-libc/avr-libc-user-manual/group__avr__boot.html
[04:50:54] <nevdull> http://www.nongnu.org/avr-libc/
[04:51:20] <nevdull> i have those at least on a quick bookmark search in my browswer. something there might be helpful.
[04:51:51] <skroon> nevdull: right
[04:51:57] <skroon> you also develop on non-windows platform?
[04:52:23] <nevdull> i mostly develop in Linux and some in Windows.
[04:54:36] <skroon> are there like resources where you can download existing avr-libc libraries?
[04:54:54] <nevdull> what distro?
[04:55:15] <skroon> I mean, libraries for the AVR it self
[04:55:39] <nevdull> you mean compiled binaries for like debian linux or ?
[04:57:59] <skroon> nevdull: yeah perhaps, like a library that I could link against
[04:59:59] <nevdull> ubuntu: sudo apt-get install gcc-avr
[05:00:25] <specing> I think me means add-on libraries
[05:00:29] <skroon> nevdull: no I mean, like someone that perhaps has written a library to do SPI on a arduino, so I could reuse that library in my AVR code
[05:00:34] <skroon> specing: yes :-)
[05:00:35] <nevdull> there are also binary archives for windows and maybe debian .deb pkg but I don't really remember rihg now
[05:01:10] <nevdull> skroon: ah, i see. i have some spi code in c++ for ATmega|tiny and some for xmega, too
[05:02:32] <nevdull> https://libavrstdcpp.codeplex.com/
[05:04:47] <skroon> cool
[05:05:26] <skroon> that's yours?
[05:05:37] <nevdull> yah one of 'em
[05:08:12] <skroon> nice
[05:08:29] <skroon> I would like to interface with a cheap ethernet chip, like the ENC28J60
[05:08:57] <skroon> it has a SPI interface, so I was wondering how much extra code you need to write in order to really be able to talk to the network
[05:09:00] <nevdull> skroon: yeah, ther are micro tcp/ip stacks that go well with ENC28J60 and a Pulse/MagJack that has integrated magnetics
[05:09:28] <skroon> nevdull: ah cool, didn't know about those Pulse/MagJac with integrated magnetics
[05:09:52] <nevdull> skroon: yes, they're handy and cheap enough
[05:10:08] <skroon> nevdull: so that means the data that comes of the SPI interface, is pure data, and you need to wrap that up into IP, TCP, etc packets your self?
[05:10:25] <skroon> nevdull: do you perhaps have one that you always use?
[05:10:30] <OndraSter_> yes
[05:10:38] <nevdull> you can interface directly from the magjack to the ENC28J, light up the rx/tx LEDs, etc
[05:10:53] <OndraSter_> no idea how the ENC28J60, but the bigger J424 can pack TCP/IP stuff around it... but what about nonTCP packets? :)
[05:11:37] <skroon> J424 ?
[05:11:41] <nevdull> skroon: yes, you'll be using SPI commands from master to slave enc28j, filling up rx/tx buffers, and the tcp/ip layer will wrap it for you in TCP then IP or whatever
[05:11:49] <OndraSter_> ENCxxJ424, I forgot the number, skroon
[05:12:01] <OndraSter_> it is 100Mbit full duplex, with three times as big buffers
[05:12:04] <skroon> OndraSter_: right, well I would like to understand UDP as well, and perhaps mutlicasting/broadcasting :)
[05:12:10] <OndraSter_> indeed
[05:12:21] <OndraSter_> that was reply to the
[05:12:21] <OndraSter_> <skroon> nevdull: so that means the data that comes of the SPI interface, is pure data, and you need to wrap that up into IP, TCP, etc packets your self?
[05:12:24] <skroon> OndraSter_: ah right, well I would like to be able to make the cheapest possible at this time :)
[05:13:51] <OndraSter_> :)
[05:14:31] <skroon> so for example when you would like to get ip address from DHCP server, you also need to write it your own right? it's not like the ENC28J60 will provide those functionalities?
[05:15:09] <nevdull> skroon: go to the makers of the enc28j (microchip.com) and pull down their reference designs and they have some software downloads
[05:15:19] <nevdull> written by them for the enc28j
[05:16:05] <skroon> nevdull: ok
[05:17:08] <skroon> nevdull: which Pulse/MagJack do you use/recommend?
[05:17:27] <nevdull> lemme check which ones i use
[05:18:29] <skroon> looking at the reference design and enc28j60-avr, that's some pretty complicated stuff :-)
[05:19:34] <nevdull> skroon: the one i've used on my last coupel of projects with internet i used a J0011D01B
[05:20:52] <nevdull> skroon: i just exported an image from one of my projects that shows how to connect the enc28j preciesely to one of those magjacks if you want to see it
[05:21:08] <skroon> nevdull: yeah I would love to see
[05:23:30] <nevdull> http://www.munixos.net/images/enc28j.png
[05:23:32] <nevdull> there you go
[05:24:10] <skroon> thanks!
[05:24:19] <nevdull> sure thing!
[05:24:36] <nevdull> good luck on your project :)
[05:25:41] <skroon> I love these network embedded stuff :-)
[05:25:52] <nevdull> yeah, it's a lot of fun :)
[05:26:43] <skroon> may I ask which networking stack you used?
[05:27:47] <OndraSter_> you are not k3wl enough until you write your own
[05:27:48] <OndraSter_> in asm
[05:27:50] <OndraSter_> :D
[05:28:14] <skroon> hehehe :-)
[05:28:15] <Roklobsta> yes we need another broken and badly written IPv4 stack
[05:28:29] <skroon> right :-) it seems like a *really* hard task to get it right
[05:28:37] <nevdull> i used lwip and uclib tcp/ip microstack
[05:30:19] <Roklobsta> what did you do with it?
[05:30:37] <skroon> nevdull: bookmarked :-)
[05:31:19] <nevdull> a retro 8-bit workstation supporting quad xmega mcus. the enc28j and magjack was my inet connection besides the 2.4GHz ISM
[05:31:29] <nevdull> skroon: good, you have lots to read! :)
[05:31:59] rue_shop2 changed topic of #avr to: Start here: http://www.avrbeginners.net http://tom-itx.dyndns.org:81/~webpage/ http://www.avrfreaks.net ENCOURAGE PEOPLE OR WE WILL SQUASH YOU.
[05:33:20] <skroon> nevdull: yeah I have indeed :-) uclib is like different alternative to gcc-avr library?
[05:33:40] <twnqx> no
[05:33:47] <twnqx> uclibc is still a kernel interface
[05:33:57] <twnqx> there is no kernel on avr
[05:34:06] <nevdull> skroon: well, the one i'm familiar with is uclibc++ and it is just mostly a big bloated port straight over from the STL
[05:35:28] <skroon> twnqx: a "kernel interface", aha... a Kernel would be way to much I guess right? Would it even be possible to do multitasking? like backgrounding a process, or is this what interrupts are fore partially?
[05:35:50] <skroon> nevdull: ah so you can write C++ code for the AVR you mean?
[05:36:08] <twnqx> yeah, you'd need a full operating system
[05:36:11] <twnqx> afaik.
[05:36:18] <nevdull> skroon: certainly.
[05:36:24] <twnqx> at least that's how i understood µclibc
[05:36:37] <twnqx> and of course you can do multitasking on the avr...
[05:36:50] <rue_shop2> anyone who understands the point of an avr is not running an operating system on one
[05:36:54] <twnqx> it's just not readily available like in other environments
[05:37:20] <twnqx> rue_shop2: i'd really like to have threading and blocking i/o abilities in mine :P
[05:37:24] <nevdull> there are plenty of cool reference OSs in the 8bit space
[05:37:41] <rue_shop2> twnqx, you dont understand the point of a single pupose application then
[05:37:57] <twnqx> no, i do very well
[05:38:11] <twnqx> but for multiple communication streams at the same time it would simplify things
[05:38:36] <twnqx> not like i didn't manage without, it's just overly complicated
[05:38:42] <skroon> rue_shop2: I see what you mean :-) But I was thinking about writing some network stuff, and would be nice if I could background certain tasks, so they don't block :)
[05:39:15] <rue_shop2> so you just write the code like that
[05:39:37] <skroon> rue_shop2: Yes I hope I would be able todo that soon, now i'm just dreaming :-)
[05:39:40] <rue_shop2> hmm I dont get it
[05:39:59] <rue_shop2> all the test code works on this bot, but the origional working code dosn't
[05:40:15] <Roklobsta> rue_shop2: i am messing with getting Bertos working on AVR.
[05:40:18] <Roklobsta> it's pretty nice
[05:40:18] <skroon> rue_shop2: test code? as in unit testing?
[05:40:32] <rue_shop2> its line following code
[05:40:45] <rue_shop2> when I compile it on this machine, the motors wont run
[05:40:51] <rue_shop2> I have no idea why
[05:41:42] <skroon> Roklobsta: and running Bertos is pure for fun, or really need it on your project?
[05:41:50] <Roklobsta> both
[05:43:00] <Roklobsta> even on an AVR I don't see what the prohibition is with an OS
[05:45:19] <rue_shop2> hmm has to be the motor drivers
[05:45:28] <twnqx> context switch time and storage space
[05:45:52] <Roklobsta> true
[05:45:56] <Roklobsta> ish
[05:47:22] <rue_shop2> nope, if I plug in the batteries thats fine
[05:50:35] <rue_shop2> hey, ,.... this code is missing thepart that runs the motors...
[05:53:03] <rue_shop2> so fora day I been trying to run the wrong code?
[06:00:55] <john_f> w/ an icsp programmer on a atmega32u2, how do I tell avrdude to write a hex in the applications $0000 page vs the bootloaders $7000 page?
[06:01:39] <john_f> or is that set somewhere else?
[06:02:00] <OndraSter_> in the hex
[06:03:44] <john_f> hmm ok
[06:06:11] <CapnKernel> john_f: There are some linker options. I have a blog page, hang on
[06:07:03] <OndraSter_> --sect-start=.text=0x7000
[06:07:05] <OndraSter_> or something like that
[06:07:32] <hackvana> Ok, here's the page: http://capnstech.blogspot.com/2011/02/usb-doodad-6-bootloader.html
[06:07:44] <hackvana> Search for "BOOTLOADER_ADDRESS"
[06:11:07] <rue_shop2> hahah I think I found it
[06:11:41] <john_f> oh, the linker does it
[06:11:42] <john_f> thanks
[06:12:13] <rue_shop2> hahah at some point gcc-avr changed the way an int rolls over
[06:12:35] <rue_shop2> 'int' used to roll over at 65535, now it rolls over at 32k
[06:12:47] <rue_shop2> as soon as I changed to unsigned int, its all ok
[06:13:18] <OndraSter_> it has always rolled over at 32k
[06:13:20] <OndraSter_> signed int
[06:14:24] <rue_shop2> no it hasn't
[06:14:42] <rue_shop2> I have a delay function thats copied and pasted thru a LOT of my avr software
[06:14:49] <OndraSter_> ugh
[06:14:54] <rue_shop2> and it uses an unsigned int
[06:14:57] <OndraSter_> IIRC by specs "int" means "signed int"
[06:14:59] <OndraSter_> oh ok
[06:15:08] <rue_shop2> I'm gradually having to change it all
[06:15:24] <rue_shop2> cause all my programs that used to run delays of 65535 dont work ANYMORE
[06:16:40] <OndraSter_> werew you using unsigned int or just int?
[06:16:46] <OndraSter_> *were
[06:18:02] <rue_shop2> void Delay(int delay) {
[06:18:02] <rue_shop2> int x;
[06:18:02] <rue_shop2> for (x = delay; x != 0; x--) {
[06:18:02] <rue_shop2> asm volatile ("nop"::);
[06:18:02] <rue_shop2> }
[06:18:03] <rue_shop2> }
[06:18:13] <rue_shop2> that USED to work when passed 65535
[06:18:19] <rue_shop2> now, ofcourse, it just locks up
[06:18:45] <rue_shop2> tho, looking at it I'm not sure why it would lock...
[06:19:06] <rue_shop2> (yes, I optimized my delay loop)
[06:21:32] <jacekowski> why don't you use builtin delay functions?
[06:21:39] <jacekowski> _delay_ms and friends
[06:21:50] <jacekowski> http://www.nongnu.org/avr-libc/user-manual/group__util__delay.html
[06:21:55] <rue_shop2> I dont subscribe to them
[06:22:05] <rue_shop2> I want to use my own code that I know isn't using timers
[06:22:15] <jacekowski> it's not using timers
[06:22:21] <jacekowski> it's proven working delay loop
[06:22:27] <jacekowski> use it
[06:22:27] <rue_shop2> its a quick and dirty delay
[06:22:34] <jacekowski> USE THAT FUNCTION
[06:22:35] <rue_shop2> point is, gcc-avr changed at some point
[06:22:41] <jacekowski> it's the same function, and it works
[06:22:58] <jacekowski> http://www.nongnu.org/avr-libc/user-manual/delay_8h_source.html
[06:23:18] <jacekowski> and if you really feel like debugging it
[06:23:23] <jacekowski> objdump it after compilation
[06:23:27] <jacekowski> and check what happens
[06:23:34] <jacekowski> and run it on emulator/jtag/something
[06:23:36] <rue_shop2> I cant even follow that code there are so many ifdefs in it
[06:23:47] <skroon> would it be possible for a AVR to firmware upgrade it self perhaps?
[06:23:56] <rue_shop2> they cna flash themself yes
[06:24:04] <jacekowski> skroon: yes
[06:24:06] <rue_shop2> its called a bootloader
[06:24:56] <jacekowski> rue_shop2: well, then if you want, you can objdump your function and check what goes wrong
[06:25:00] <rue_shop2> yay, my line follower works again
[06:25:14] <jacekowski> rue_shop2: and i know what is wrong with it
[06:25:19] <rue_shop2> I dont care, coding it properly works ;)
[06:25:34] <rue_shop2> Its not the first time I'v had a problem with it
[06:25:54] <jacekowski> by default, on avr int is 16 bit signed
[06:26:14] <rue_shop2> along with everyting else
[06:26:15] <jacekowski> so 65535 is invalid number to be stored as signed int
[06:26:27] <rue_shop2> I wonder what they changed abotu avr-gcc tho
[06:26:43] <jacekowski> that code was relying on undefined behaviour
[06:26:51] <jacekowski> 32768 is the maximum you can use in there
[06:26:57] <rue_shop2> yes, it was an old error
[06:27:04] <OndraSter_> 32768..
[06:27:09] <OndraSter_> shouldn't it be 32767?
[06:27:16] <jacekowski> yes
[06:27:31] <jacekowski> 2^15
[06:27:34] <jacekowski> -1
[06:27:36] <OndraSter_> I never remember whether it is -32767 - 32768 or -32768 - 32767
[06:27:58] <OndraSter_> but then I remember how much is 0x8000 :)
[06:28:05] <rue_shop2> ^^ note I said "32k"
[06:28:07] <jacekowski> so your delay loop is broken by design
[06:28:25] <jacekowski> use builtin avrlibc functions that work
[06:28:27] <rue_shop2> it was an old coding error that got copied and pasted a stupid number of times
[06:28:54] <jacekowski> because you've not used tested functions that were provided
[06:29:02] <jacekowski> it's a very bad coding practice
[06:29:10] <rue_shop2> I'd have just as many problems with their code as mine
[06:29:26] <rue_shop2> I dont make that many errors and I know what to look for when I do
[06:29:29] <jacekowski> nope, that code works
[06:29:35] <rue_shop2> :)
[06:29:54] <rue_shop2> I also cant follow it worth a damn because of the ifdefs
[06:29:58] <jacekowski> and if it doesn't, you can blame someone else
[06:30:08] <jacekowski> it's a win win situation
[06:30:12] <jacekowski> esspecialy at work
[06:30:12] <skroon> so the bootloader makes it possible to have it firmware upgrade it self?
[06:30:14] <rue_shop2> I dont want to blame, I want to play
[06:30:22] <jacekowski> skroon: yes
[06:30:39] <skroon> jacekowski: that's really cool, I never really understood what a bootloaders task is :-)
[06:30:49] <rue_shop2> in my test code, I just fixed it by reflex
[06:30:53] <rue_shop2> so it all worked
[06:30:54] <jacekowski> skroon: well, that's part of the functionality
[06:30:55] <skroon> jacekowski: Like I read that Arduino uses some kind of bootloader
[06:31:11] <skroon> jacekowski: is the bootloader in some special place in memory ?
[06:31:16] <jacekowski> yes
[06:31:32] <rue_shop2> !time
[06:31:40] <jacekowski> you have to enable bootloader with fuses and then you set location of it as well
[06:31:46] <rue_shop2> !time
[06:31:47] <jacekowski> but it's generally towards the end of the flash
[06:31:48] <rue_shop2> hmm
[06:31:49] <skroon> jacekowski: so would that code be readonly perhaps to make sure it doesn't get overwritten?
[06:31:53] <rue_shop2> ah right
[06:32:02] <twnqx> skroon: a chip erase will wipe it
[06:32:17] <skroon> twnqx: but that has to be done via programmer right?
[06:32:17] <jacekowski> skroon: it's writable as well
[06:32:23] <twnqx> yes
[06:32:23] <OndraSter_> you can lock it
[06:32:25] <jacekowski> skroon: it's up to you not to mess it up
[06:32:29] <OndraSter_> to prevent random overwrites
[06:32:37] <OndraSter_> but not on my chips - on my chips it will be self-updatable ;)
[06:32:39] <OndraSter_> quite dangerous..
[06:32:40] <twnqx> or even against reading it :P
[06:32:43] <OndraSter_> yep
[06:32:56] <skroon> jacekowski: so the code that's running could mess up (or perhaps upgrade) the bootloader as well
[06:33:38] <twnqx> depending on the chip you can put some protection
[06:33:52] <OndraSter_> no, the code can not mess up bootloader
[06:33:57] <OndraSter_> you cannot run SPM from application area
[06:34:15] <skroon> OndraSter_: SPM = self programming?
[06:34:18] <OndraSter_> yes
[06:34:42] <twnqx> again, if you set the fuses right
[06:34:50] <OndraSter_> no, always
[06:35:10] <twnqx> if you don't set a bootloader the whole chip is selfprogrammable, afaik
[06:35:17] <OndraSter_> hmm
[06:35:24] <OndraSter_> but you always set a bootloader :)
[06:35:36] <twnqx> i never used a bootloader so far
[06:36:05] <rue_shop2> I'v never bothered
[06:41:34] <skroon> so for which other reasons would someone use a bootloader?
[06:45:20] <OndraSter_> so you can field upgrade your firmware
[06:45:24] <OndraSter_> or you know, you do not need a programmer
[06:45:31] <OndraSter_> just hook it to USB/serial port and update the firmware
[06:45:32] <OndraSter_> aka arduino
[06:45:53] <Amadiro> It'se useful for USB devices to be easily updateable via USB with something like FLIP
[06:46:19] <Amadiro> that way you can just provide a small firmware updater tool to the users of your programmable USB keyboard (or whatever it is you are making), they run it, and done
[06:48:06] <skroon> so by default a empty AVR chip (without a bootloader) you can't easily firmware upgrade?
[06:48:10] <OndraSter_> no
[06:48:13] <OndraSter_> you need a programmer
[06:48:35] <skroon> so whenever ICP is used, there is a bootloader involved?
[06:48:42] <Amadiro> ICP?
[06:48:47] <skroon> there are 4 letters ...
[06:48:49] <skroon> ICSP ?
[06:48:57] <skroon> sorry :) mixing up names
[06:49:08] <Amadiro> no, you don't need to have a programmer for ICSP
[06:49:13] <skroon> ISP ?
[06:49:15] <OndraSter_> ISP or ICSP
[06:49:16] <Amadiro> err
[06:49:22] <Amadiro> you don't need to have a bootloader for ICSP
[06:50:01] <skroon> ICSP is like "hardware based" functionality?
[06:50:13] <Amadiro> skroon, it depends on the chip, but typically a blank chip expects you to write a program into its flash by using something like PDI, SPI or w/e. That requires no code to be on the chip beforehand.
[06:50:30] <Amadiro> skroon, yes, basically
[06:50:45] <jacekowski> well, you have jtag, debugwire, ISP
[06:50:47] <Amadiro> skroon, if you put a bootloader onto the chip, you can program the bootloader to receive data from anywhere, and once the program is received, overwrite the old one.
[06:50:54] <jacekowski> and high voltage programming
[06:51:45] <Amadiro> skroon, most chips also have "hardware based" functionality to debug the chip while it's running and such, so you can see what is going on.
[06:53:49] <skroon> really cool stuff :-)
[06:53:56] <skroon> things startign to make sense, thanks all
[07:01:30] <Horologium> one of the guys here made a usb-printer-emulator bootloader....shows up as a usb-printer and you just print your firmware update to it.
[07:06:48] <OndraSter_> do not say "one of the guys", credit abcminiuser, the USB g33k :P
[07:09:34] <Horologium> sorry..couldn't remember who it was.
[07:10:17] <OndraSter_> how can you not remember abcminiuser.. :D
[07:10:26] <Horologium> I'm bad with names.
[07:10:35] <Horologium> and wasn't sure if it was him or Tom_itx
[07:13:26] <RikusW> print the .hex ? :)
[07:13:33] <Horologium> yup
[07:13:39] <RikusW> nice idea
[07:14:01] <Horologium> yeah.
[07:14:03] <twnqx> can the avrs run code from ram, btw?
[07:14:10] <Horologium> twnqx, no
[07:14:14] <twnqx> :/
[07:14:17] <Horologium> that's the biggest issue I have with them.
[07:14:21] <twnqx> there goes an idea i had :(
[07:14:36] <Horologium> that's why I use both avr and 8052 chips.
[07:14:41] <RikusW> AVR32 can run from ram
[07:14:51] <twnqx> before i use avr32
[07:14:51] <Horologium> RikusW, true...but,,,
[07:14:56] <twnqx> i'd just switch to arm
[07:14:59] <Horologium> yeah.
[07:15:06] <RikusW> its a pity AVR8 can't run from ram
[07:15:12] <Horologium> arm seems to be much more actively advanced and developed than avr32.
[07:15:45] <Roklobsta> do you mean parts and stuff or the ISA is more advanced?
[07:15:46] <Horologium> if I had an avr8 in dip that had usb and another that could execute from external memory then I would be a super happy clam.
[07:16:07] <twnqx> Roklobsta: all of it :X
[07:16:29] <twnqx> arm ranges from the small 100mhz single cores up to ghz audcores
[07:16:37] <Horologium> Roklobsta, I think I mistyped there....there is a lot more code out there for them...and the core is being more actively advanced.
[07:16:38] <twnqx> any IO you can imagine
[07:16:54] <Horologium> twnqx, I've seen them even slower than that...many of them.
[07:17:12] <twnqx> true
[07:17:23] <OndraSter_> I still like AVR8 <3
[07:17:23] <Roklobsta> UC3 seems OK for some stuff
[07:17:48] <Horologium> of the small microcontrollers, I find the architecture and usability of the avr8 chips to be bestest.
[07:17:59] <Horologium> with some 8052 chips next on the list.
[07:18:00] <twnqx> OndraSter_: i was... disappointed when i noticed the can128 costs roughly the same as the cortex m3
[07:18:05] <twnqx> with two can ports
[07:18:05] <Horologium> then pic8 and pic32
[07:18:10] <twnqx> more flash, more ram, everything
[07:18:23] <OndraSter_> can..
[07:18:32] <kobsu> btw. i'm working with a software framework for uc3a1, see https://github.com/aery32/aery32
[07:18:45] <twnqx> i paid roughly 50€ for the parts on my 8bit avr dual can board
[07:19:01] <OndraSter_> yay http://clip2net.com/s/4Zj5gl
[07:19:17] <twnqx> that includes a wide range sepic power converter since i need guaranteed 5V even if USB is below that
[07:19:34] <twnqx> (not for the avr, but the sja1000)
[07:19:39] <OndraSter_> and bottom: http://clip2net.com/s/4Zj5ZC
[07:20:24] <twnqx> the atmel chip is 10€ (roughly the same as the at90can), has all of that, an runs on 3.3V
[07:20:55] <twnqx> i really need to get into arm programming
[07:21:19] <twnqx> (not writing code, but getting the code on the device)
[07:21:49] <Horologium> jtag.
[07:21:54] <twnqx> yeah
[07:22:01] <twnqx> but dedicated programmers
[07:22:02] <Horologium> or, depending on the chip and dev board, just an sd card.
[07:22:08] <twnqx> and vendor lock in programming software
[07:22:13] <twnqx> that mostly only runs on winblows
[07:22:32] <Horologium> thinking really hard about getting one of those olimex A13 boards.
[07:22:48] <OndraSter_> those CPUs run in some tablets as well
[07:22:50] <twnqx> the day i'll figure out how to get the things programmed from linux command line i'll change
[07:22:51] <OndraSter_> those cheap android tablets :D
[07:22:57] <kobsu> dfu would be more convenient to use than jtag i think
[07:23:20] <OndraSter_> but DFU is simple firmware upload
[07:23:22] <OndraSter_> jtag is debug
[07:23:50] <kobsu> yeah for in-system debugging
[07:24:53] <kobsu> printf() works like 99% of the time... at least for me
[07:28:44] <RikusW> Horologium: seen the cubieboard or the beaglebone black yet ?
[07:39:27] <Horologium> no
[07:39:58] <twnqx> hm cool
[07:40:10] <twnqx> apparently someone did something from my todo: list
[07:40:49] <OndraSter_> hehe
[07:41:41] <twnqx> and moved xilinx' impact from the stupid proprietary always-obsolete windriver universal usb drivers to something purely userspace
[07:42:12] <twnqx> if that means i can use my platform usb cable without windows VM i'll be happier
[07:44:26] <twnqx> and i went so far and build my own xc3sprog compatible ft2232h jtag programmer for my fpgas :P
[07:52:26] <Horologium> beablebone black won't work for me.
[07:52:35] <Horologium> no hdmi devices other than tv.
[07:52:44] <twnqx> hdmi is the same as dvi
[07:52:50] <twnqx> unless you want the audio
[07:53:20] <twnqx> get a cable with hdmi on one end and dvi on the other :P
[07:55:32] <Horologium> https://www.olimex.com/Products/OLinuXino/A13/A13-OLinuXino-WIFI/ that's the board I'm looking at.
[07:58:43] <Horologium> little pricier but it has built in wifi.
[08:10:01] <r00t|home> where "builtin" = wifi usb stick (<10eur?) mounted onto the board and connected to usb...
[08:11:28] <Horologium> yeah, basically.
[08:11:41] <Horologium> but it has vga output on the board.
[08:12:24] <Horologium> not hdmi or some strange vgaish connector where I have to screw with an adapter cable.
[08:12:34] <r00t|home> you don't have a monitor wih dvi input?
[08:12:38] <Horologium> one
[08:12:44] <Horologium> this one I use for this computer.
[08:13:02] <r00t|home> might be a worthwile investment to get another ;)
[08:13:04] <Horologium> but I have several 14inch touchscreen monitors with vga only.
[08:13:31] <r00t|home> or a digital to vga converter
[08:13:47] <Horologium> again, extra expense and crap to deal with.
[08:14:26] <Horologium> that olimex board also has a nice little interface for direct to LCD connection.
[08:14:35] <Horologium> and they sell 7 inch touchscreen LCDs to play with too.
[09:44:14] <Horologium> yanno, with a little creative thinking you can make the entire 26 letter alphabet on an 8 segment display...some of the characters aren't quite right but close enough that it could be read.
[09:57:05] <dpy> hi guys
[09:57:43] <dpy> question about crystals... Can a crystal be rated for different voltages? Or is a crystal just a crystal?
[09:58:21] <dpy> I'm asking, because I'm operating at 5V and I'm looking for SMD crystals... but I don't know if that is going to work...
[09:58:29] <Tom_itx> a crystal is typically wired to a crystal circuit
[09:58:30] <Tom_itx> why not?
[09:58:40] <Tom_itx> you want a good small smd crystal?
[09:58:45] <dpy> http://www.ebay.nl/itm/10-PCS-16-000MHz-SMD-4-Pin-3225-16MHZ-16-000M-16M-Crystal-/121100144802?pt=LH_DefaultDomain_0&hash=item1c322190a2#ht_1059wt_1115
[09:58:50] <dpy> something like those perhaps
[09:59:06] <twnqx> those look like resonators
[09:59:29] <Tom_itx> you want some good smt resonators?
[09:59:43] <twnqx> lol
[09:59:54] <Tom_itx> those look like the crystals i started with
[10:00:01] <twnqx> fun
[10:00:16] <dpy> I want small mostly
[10:00:24] <twnqx> never saw crystals like that, only the ones with straight cmos out and inhibit
[10:00:28] <dpy> I don't care if it's going to be super accurate
[10:00:39] <Tom_itx> http://tom-itx.dyndns.org:81/~webpage/boards/atmega32u4/atmega32u4_1.jpg
[10:00:39] <Tom_itx> see
[10:00:53] <twnqx> permission denied :)
[10:01:01] <Tom_itx> port 81
[10:01:12] <Tom_itx> you weren't asking anyway :)
[10:01:36] <dpy> your uplink is kinda slow, so I'm waiting
[10:01:52] <Tom_itx> i'll go reset the router then it will be speedy quick
[10:02:21] <twnqx> Tom_itx i am always curious :P