#avr | Logs for 2013-10-20

Back
[02:11:39] <codyps> juri_: one can build a binary with the app + bootloader, build 1 and include it as a binary in the other
[02:11:47] <codyps> http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_binarydata describes this method
[02:12:12] <juri_> i've got it booting my code, i think...
[02:12:28] <juri_> i still don't have my code spitting anything out the serial, but...
[02:13:03] <codyps> juri_: the key problem is the bootloader isn't using any of the stuff we have set up in avrlibc for generating vector tables, and is making assumptions about object ordering
[02:14:00] <codyps> juri_: If you want to keep the very funky "start()" function, put it in an ASM file and place it in the right section so it gets moved to the beginning of .text
[02:14:44] <juri_> i'm keeping it in a seperate .c file. its not much other than C wrapped assembly.
[02:14:53] <codyps> specifically the .vectors section
[02:14:57] <juri_> i just have to supply it as the first argument to ld...
[02:15:54] <codyps> juri_: I expect the compiler will emit some extra function handling code in addition to your volatile asm
[02:16:24] <codyps> juri_: switch to using a .S file (or manually encode the asm in an array) if you want it to work reliably
[02:17:05] <codyps> juri_: either way, put it in the .vectors section so it is placed properly (via __attribute__(section(".vectors")) or whatever the ASM is for that)
[07:45:32] <megal0maniac_afk> Is there a simple way to take a 0-5V square wave, and average it around 0V? (-2.5V - 2.5V)
[07:45:46] <megal0maniac_afk> Frequency dependent, of course
[07:46:31] <Fornaxian> transformer and a few extra components.
[07:46:32] <Fornaxian> or
[07:46:35] <Fornaxian> an opamp.
[07:46:50] <Fornaxian> opamp would probably be best way.
[07:47:35] <megal0maniac_afk> You can't do it without having a negative supply voltage though, right?
[07:48:37] <megal0maniac_afk> I'm thinking in terms of, for example, connecting a PWM output directly to a speaker. You want it to swing both ways, not just above 0V
[07:52:40] <Fornaxian> well, yeah.
[07:53:27] <Fornaxian> you can make a charge pump to generate the negative voltage for the opamp source.
[07:55:02] <Fornaxian> you could use a transformer to generate the pulses..
[07:55:18] <Fornaxian> then some circuitry to cut the output sin wave to square.
[07:55:51] <Fornaxian> but the output isn't going to exactly match the square wave input.
[07:56:19] <megal0maniac_afk> Now it's sounding too complicated
[07:56:30] <megal0maniac_afk> I was sure that there might be a simpler, passive way
[07:56:37] <megal0maniac_afk> Probably not :)
[07:56:53] <Fornaxian> hmmm...looks like you still need an opamp for that as well.
[07:56:58] <theBear> i'd use a capacitor probly
[07:57:12] <megal0maniac_afk> theBear: That's what I had in mind, but would it work?
[07:57:18] <Fornaxian> theBear, little charge pump method?
[07:57:23] <theBear> depends on freq and how square you want it
[07:57:29] <theBear> nah, ac-coupling method
[07:57:49] <theBear> what you wanna feed the squarewave to ?
[08:00:11] <megal0maniac_afk> Speaker, in theory
[08:13:44] <megal0maniac_afk> This seems to achieve what I'm talking about. Obviously the values would change, but you get the idea http://i.imgur.com/IpGJ4co.png
[08:14:16] <megal0maniac_afk> Oh duh. Nevermind
[08:17:19] <megal0maniac_afk> Okay, it does actually work
[08:17:49] <megal0maniac_afk> The image is wrong because the input signal is a sine wave, so it's +- anyway
[08:17:57] <megal0maniac_afk> But the circuit does work with square
[08:18:18] <Fornaxian> looks like a single stage charge pump to me.
[08:18:19] <Fornaxian> hehe
[08:19:07] <megal0maniac_afk> Cool :)
[08:19:26] <megal0maniac_afk> I don't know how a charge pump works, so that was accidental :P
[08:24:43] <Fornaxian> turn power on, cap charges....turn power off, cap discharges...in this case, back through the resistor and the output device.
[08:57:49] <The_Ball> I'm new to atmels, I used avrdude to dump the flash of a 328p like so: "avrdude -c usbtiny -p m328p -Uflash:r:flash.bin:r", this resulted in a file 10198 bytes long. The 328p has a 32KB flash though. Why wasn't the whole 32KB dumped?
[09:47:04] <specing> The_Ball: because its all 0xFF
[09:51:48] <Tom_itx> The_Ball, it only saved the length of the actual binary file
[10:13:00] <Tom_itx> afk already!
[10:13:04] <Tom_itx> i just got here
[10:42:27] <MarkX> !seen abcminiuser
[10:42:43] <MarkX> hmm
[10:42:47] <MarkX> no bot here i guess
[10:42:50] <MarkX> XD
[10:48:18] <Casper> but there is always the nickserv info
[10:54:45] <antto> that's if he identified last time ;P~
[10:56:35] <antto> i see: [06:37:20] <-- abcminiuser (~abcminius@94.246.33.171) has quit. (Ping timeout: 265 seconds)
[11:06:15] <MarkX> bleh
[11:06:29] <MarkX> hes super helpful
[11:06:43] <MarkX> just the timezones that suck
[13:08:08] <inkjetunito> bleh. i need a PSU
[13:39:51] <vsync_> blehhhhhhhhhhhhhhhhh
[13:45:17] <bss36504> problems vsync_?
[13:52:32] <inkjetunito> is it okay to connect a programmer through an usb hub?
[13:52:48] <bss36504> Should be just fine. I use mine like that all the time
[13:52:59] <inkjetunito> ok :)
[13:53:17] <Tom_itx> yep
[13:53:18] <Tom_itx> i do
[13:53:18] <bss36504> I have an AVRISP mkII and a JTAGICE3 along with a bunch of other stuff happily performing on a 7 port hub
[13:54:16] <vsync_> bss36504: figuring out FAT32... But i'm getting there, sure
[13:54:33] <vsync_> this M$ fat bible is a-okay
[13:56:03] <bss36504> vsync_: I know you only need read functions and you prefer to do it yourself, but look at PetitFS. Youve already done the work of making the media access functions, so you can just use that lib to do the FAT32 stuff. It works with only partial reads/writes so you wont use much memory, and it provides all the usual C file operator functions
[14:02:41] <vsync_> yeah. The part I'm not getting here is why on earth it seems like this card has the boot sector at LBA=0, sure, then follows some sectors with apparent randomness, and then a copy of the boot sector...
[14:03:07] <bss36504> vsync_: What are you using as a reference for the SD stuff?
[14:03:18] <vsync_> the FAT stuff?
[14:03:34] <bss36504> No for the SD commands and such
[14:03:44] <vsync_> the sd spec whitepaper
[14:04:23] <vsync_> however, that part is down with me... At the moment i'm fiddling with a hex editor on a pc, with an sd reader
[14:04:36] <vsync_> to just read the card
[14:05:11] <bss36504> No I was just curious for my own usage. I have the simplified spec documents, is the info I need to initialize, read and write in there?
[14:05:21] <vsync_> yeah
[14:05:31] <vsync_> I struggled a moment with the init of SDHC though
[14:06:01] <vsync_> because, here's the correct order of the init, for HC's
[14:06:30] <bss36504> I'll probably avoid SDHC for now. The SD card is going to be used simply for internal storage. It's hard (if not impossible) to find storage class serial memory, so SD is nice.
[14:06:47] <vsync_> yeah but i can't get my hands on pretty much anything than HC now
[14:06:54] <vsync_> cause everything above 2G is HC afaik
[14:07:05] <vsync_> apparently this place is too modern x)
[14:07:06] <bss36504> oh ok, well thats good to know.
[14:07:18] <bss36504> haha yeah, I honestly dont know what I bought the other day...
[14:08:10] <vsync_> first you wait for 80 spi dummy clocks
[14:08:20] <vsync_> so you can write 8 x 0xFF
[14:08:35] <bss36504> right, I've noticed that in various libs
[14:08:47] <vsync_> after that you send cmd0 (0x40, arg=0, crc=0x95), wait til you get 0x01 which means the card entered idle
[14:08:53] <vsync_> it's the reset
[14:09:33] <vsync_> then, you have to send cmd8
[14:10:07] <vsync_> it's a check if the card can work within a specified voltage range
[14:11:07] <vsync_> so 0x48, 0x00 0x00 0x01 (2.7-3.6V) and then a test pattern 0xAA, crc=0x87
[14:11:45] <vsync_> after this, you send cmd55, to tell that the next cmd is ACMD, and then you send ACMD41 to pull the card out of idle, and also specify in the arg that the master supports SDHC, otherwise it will not init
[14:12:24] <vsync_> the cmd8 should mimic your test pattern in the response, and on acmd41 you should get a 0x00 response, that the card is now active
[14:12:27] <vsync_> and that's about it
[14:13:21] <bss36504> awesome. Heres a quick-answer question: What is the smallest memory block size that SDs support during a read or write? Single byte?
[14:13:37] <bss36504> and thanks for the tips, I'll keep this transcript handy
[14:13:51] <vsync_> I'm not sure of SD's, but i believe SDHC's were set to 512
[14:14:47] <bss36504> hmm alright. I may need to revise my application a tad...
[14:16:51] <vsync_> i'm going to do a full format on this sd card and see what's up with it...
[14:17:09] <vsync_> None of the things I've looked at specify a double boot sector...
[14:33:54] <jacob_> Hello everybody
[14:34:26] <jacob_> I am looking for people working for me on an automation project at the hardware side
[14:34:37] <jacob_> for me = with me
[14:38:37] <bss36504> vsync_: Basically for my application I have 2 modes of operation: 1)LUFA -> write to SD which can be done in 512 byte blocks w/out using too much ram 2) read small chunks at a time by ignoring sections of data from the SD (thus reducing ram usage). I think I can manage this with PetitFS.
[14:40:34] <vsync_> most likely
[14:40:48] <vsync_> I think dharmanitech's sd thingy is even more compact
[14:40:55] <vsync_> you could check it out too
[14:41:07] <bss36504> Im mostly concerned with memory usage since I have a bunch of other code to write.
[14:42:02] <vsync_> yeah. What I read was that it should be quite efficient
[14:42:14] <vsync_> http://www.dharmanitech.com/2009/01/sd-card-interfacing-with-atmega8-fat32.html this one
[14:42:50] <bss36504> I looked at dharmanitech's code, but it was very poorly constructed for library usage. I may utilize some of the SD accessing code, but it was too interdependant on features I dont have/want to use (I dont have a USI, since I'm not using a tiny, I dont want to use a RTC right now_
[14:43:19] <bss36504> Dont get me wrong, it probably works great, but to adapt it to my application would be a lot of trouble
[14:44:25] <vsync_> mmmyeah
[14:51:22] <jacob_> does anyone of you know an IO module that can talk to ethernet and switches I/O ports?
[14:51:47] <bss36504> Do you mean talk via ethernet?
[14:52:01] <bss36504> or to a particular switch device?
[14:52:13] <vsync_> there's probably a ton of "arduino" stuff like that
[14:52:29] <bss36504> They do make an arduino ethernet shield
[14:53:02] <jacob_> well, I want to build up an automation system with AVR endpoints
[14:53:17] <megal0maniac> ENC28J60 is a cheap alternative
[14:53:30] <jacob_> so I have a powerful mini itx control unit for calculations
[14:53:51] <jacob_> then an ethernet switch and a handful of "cheap" avr IO modules
[14:54:05] <jacob_> for actually switching signals
[14:54:43] <bss36504> Well that should be fairly straight forward from a hardware point of view, but the software on the avr will be a bit tricky I bet.
[14:55:01] <jacob_> well, that's not a problem for me ;)
[14:55:08] <jacob_> as I am a software engineer
[14:55:19] <bss36504> Well I'm just saying it's not trivial, but I get what you mean.
[14:55:44] <jacob_> probably there is an all-on-a-single-chip avr that can do what I want?
[14:55:53] <jacob_> with ethernet included
[14:56:00] <bss36504> idk, check the part searching thing on atmel.com
[14:56:23] <bss36504> certainly none of the cheap 8 bit parts.
[14:57:00] <bss36504> If you want small and cheap, go with something like the ENC28J60 for the physical layer, then focus on making the software ethernet stack to run on the mcu
[14:57:18] <megal0maniac> jacob_: You're looking at AVR32UC3A1128 to begin with, they aren't cheap
[14:57:28] <megal0maniac> You still need magnetics and stuff
[14:57:45] <bss36504> Fortunately magnetics can be integrated with the RJ45 plugs.
[14:57:46] <megal0maniac> So like bss36504 said, get a cheap uC and something else for the physical layer.
[14:57:52] <megal0maniac> Ture
[14:57:53] <megal0maniac> True
[14:58:11] <jacob_> I have seen the AVR Net IO board
[14:59:12] <jacob_> probably I could take a similar design, just leave out a lot of components
[14:59:16] <megal0maniac> jacob_: There are two common options for ethernet. ENC28J60 and Wiznet. Wiznet is more expensive, but I suggest you do your homework on the differences
[14:59:23] <megal0maniac> ENC comes in a DIP package even
[15:00:26] <jacob_> probably it would be a good idea to complete a project plan first and post it online
[15:00:32] <megal0maniac> My bad, it's AT32, not AVR32
[15:00:32] <bss36504> I'm assuming some simple socket programming would be fine for this
[15:00:46] <jacob_> I plan on using JavaScript as the automation language
[15:00:52] <jacob_> ie. ECMA script
[15:01:06] <bss36504> on the control machine I assume
[15:01:09] <jacob_> yes
[15:01:36] <jacob_> there are full-featured ECMA script engines available as free software
[15:02:48] <jacob_> currently the autmation sector is dominated by proprietary technologies like profibus and profinet
[15:02:59] <bss36504> That part should be fairly trivial.
[15:03:12] <bss36504> The embedded software design and hardware design will be the biggest challenges
[15:08:42] <jacob_> ok thank u
[15:08:45] <jacob_> cu
[16:20:00] <jaj> hi, I want to retrieve adc values at slow speed, about 1 kHz. How would you do that? Set a timer to read the values?
[16:20:51] <specing> set a timer to trigger ADC runs
[16:23:16] <juri_> ony my 8535, no matter what i do, i end up in the bootloader. if my application space is blank, the bootloader kicks out a message to reflect that. no matter what i do, i cannot get application space to run.
[16:23:17] <jaj> specing: thanks, that's what I thought
[16:23:57] <juri_> i've tried playing with the boot reset fuse, i've tried enabling the watchdog timer, and triggering an interrupt to jump to userspace. i've tried jumping directly to address 000...
[16:24:00] <specing> and dont do something stupid like having another interrupt for reading it
[16:28:35] <hetii> Hi:)
[16:29:21] <hetii> I consider to use atmega128 with V-USB library, should i keep care on some point or it will work without trouble ?
[16:32:52] <Tom_itx> at90usb1287 with LUFA
[16:34:50] <w|zzy> talk usb ftw
[16:36:34] <megal0maniac_afk> hetii: You should consider a chip with hardware USB, because v-usb might not work at all on your computer, and there's nothing you can do about it
[16:38:46] <hetii> megal0maniac_afk: Well many project work with atmega8 and this library. The point is that i have already some prototype board with atmega128 and now i consider to add there usb header and use v-usb as a bootloader and sometimes as a hid interface, just for simple testing
[16:39:35] <hetii> but i don`t see any project on google that use atmega128 and V-USB so i wonder what could be the reason
[16:41:10] <megal0maniac_afk> hetii: I'm sure it will work on the 128. My last project used a 12mhz clock which the 128 can do fine. My suggestions are: Run the board at 5V and use the 3.6V zener method for pulling the data lines down to 3V. It seems to be the easiest, and more reliable option
[16:42:45] <megal0maniac_afk> See http://vusb.wikidot.com/hardware
[16:45:48] <hetii> As i see on the board i used 12MHz crystal. The zener i have so with voltage level should be not trouble, so i will add header and try compile some software to see if it works
[16:45:50] <hetii> :)
[16:45:57] <hetii> thx for tips :)
[16:49:27] <megal0maniac_afk> Sure
[18:57:12] <juri_> you know, i'm starting to suspect this controller just hates me.
[19:00:30] <hetii> Hmm in Makefile i see: BOOTLOADER_ADDRESS is 1800 for 8k devices, 3800 for 16k and 7800 for 32k
[19:00:36] <hetii> What about atmega128?
[19:02:49] <Tom_itx> the data sheet will tell you
[19:10:33] * juri_ pulls her hair out.
[19:58:25] <hetii> Hmm i see that i can have a trouble with v-usb on atmega128
[19:58:46] <hetii> for eg i try compile usbasp for it and i got:
[19:58:52] <hetii> usbdrv/usbdrvasm12.inc:56: Error: number must be positive and less than 8
[19:59:29] <hetii> Its about port number that is used in my board for usb connection. In my case 25 and 26
[20:02:25] <hetii> When i define other pins(lower) i have other issue, like main.c:330:2: error: ‘TCCR0B’ undeclared (first use in this function)
[20:04:24] <hetii> So general tomorrow i need check what is wrong there
[20:04:37] <hetii> meantime have a nice night and see you soon:)