#avr | Logs for 2012-07-14

Back
[03:33:34] <age> can't get USBaspLoader working on atmega8535. fuses are set for 2kb boot section, BOOTRST programmed, bootloader address is 0x1800, bootloder code replaced with setting PD0 high; still no lifesigns. any ideas on what else to try/check?
[03:58:56] <Roklobsta> hey hey hoho is commodore krunch still with us?
[08:04:57] <Sefid_Par> Would you mind tell me a good documentation which helped you when you were beginner?
[08:05:37] <theos> who
[08:05:47] <Sefid_Par> about AVR
[08:05:52] <theos> http://www.avrbeginners.net
[08:06:03] <theos> RTFT
[08:06:21] <theos> its a good website
[08:06:46] <Sefid_Par> Thank you :)
[08:07:15] <theos> :)
[08:37:30] <age> mwahahahah
[08:37:52] <age> I've been struggling with non-working usb bootloader for some 4 hours now
[08:38:04] <age> turns out I swapped D+ and D- on the pcb :|
[08:38:19] * age goes to make a reversed cable
[08:40:31] <OndraSter> still on the 8535?
[08:40:33] <OndraSter> 8515
[08:42:08] <OndraSter> heh
[08:48:38] <age> 8535, yes
[09:00:24] <age> yeeey
[09:00:27] <age> it works.
[09:09:07] <OndraSter> fail :D
[09:09:13] <OndraSter> switching wires is a bi.ch
[09:09:36] <OndraSter> too bad you can't invert it in software
[09:13:05] <age> nope, the 1.5k pullup has to be on D-
[09:27:56] <specing> http://imgur.com/gallery/qleuW
[10:20:45] <age> the duck :<
[10:22:27] <age> so, I have mega8535 programmed for 2k bootsect and with BOOTRST. take a sample program which lights up a LED and has v-usb running -- works, even though is flashed at 0, not at bootloader start. take a bootloader -- does not work, both in boot sect and at 0. wtf? :(
[10:37:09] <grummund> age: what "does not work" ?
[11:04:33] <chiques> Hello
[11:04:51] <OndraSter> eloo
[11:05:50] <chiques> AtTiny13A
[11:06:51] <OndraSter> AtMega1280
[11:06:57] <OndraSter> are we playing some game? :D
[11:07:21] <grummund> we?
[11:07:47] <OndraSter> game "name some Atmel AVR device"
[11:08:51] <cehteh> attiny13-20 .. i win \o/
[11:09:28] <OndraSter> attiny-7? :o
[11:09:58] <chiques> lol
[11:10:19] <chiques> Just checking to see if there is a function which will show me options for my controller
[11:10:31] <OndraSter> options as in..?
[11:11:26] <grummund> with or without fries
[11:11:46] <Corwin> i want fries, please
[11:11:55] <Corwin> fried AVRs are good too
[11:12:14] <OndraSter> mmm crispy
[11:14:42] <cehteh> brown or browned out? :)
[11:14:43] <chiques> I've been making them smoked lately.
[11:15:24] <OndraSter> I prefer with watch dog on
[11:16:20] <cehteh> hot dog you mean :)
[11:18:15] <OndraSter> no
[11:18:17] <OndraSter> watch dog :D
[11:18:24] <OndraSter> where is hotdog on an AVR?
[11:18:48] <cehteh> just draw 700mAh from it and you have a hot watch dog :)
[11:18:48] <age> grummund, the bootloader does not appear to execute
[11:21:20] <OndraSter> this is killing me
[11:21:22] <OndraSter> INTERNET, Y U NO WORK
[11:21:30] <grummund> age: what happens instead?
[11:23:15] <age> grummund, I have added code to set PD0 up in an initialization function, PD0 is always low
[11:24:30] <grummund> how do you know PD0 is low?
[11:24:40] <age> similarly compiled sample program strangely works when written both at beginning of memory and at bootloader address
[11:24:48] <age> grummund, I have a led on it
[11:24:59] <grummund> it could be configured as input
[11:25:09] <age> I configure it as output.
[11:26:04] <grummund> but if it is not working hoe do you know that?
[11:26:09] <grummund> it could still be input
[11:26:41] <age> and even if so, the sample program I mentioned gets v-usb running, so the device gets detected. same configuration with the bootloader -- no detection.
[11:27:10] <age> grummund, I have also tried other pins on other ports.
[11:29:16] <grummund> does the bootloader contain v-usb code?
[11:29:20] <age> yes.
[11:29:25] <age> usbasploader
[11:29:44] <grummund> and the sample program?
[11:30:20] <elektrinis> um
[11:30:21] <elektrinis> https://dl.dropbox.com/u/68288580/usart.png
[11:30:48] <elektrinis> INT0_vect does work
[11:31:05] <elektrinis> but just cant find any name that would work for usart rx
[11:31:23] <grummund> elektrinis: http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html
[11:31:24] <elektrinis> where are these listed?
[11:31:59] <elektrinis> ok
[11:34:40] <elektrinis> thanks
[11:38:04] <Corwin> um... any ideas where to look for rfid 134.2khz tag reader modules? all i can find is 125khz which i cant use :(
[11:40:11] <GuShH> move to 125 and quit tasting time
[11:40:16] <Corwin> cant
[11:40:22] <GuShH> modify a 125 one
[11:42:48] <GuShH> if the RF side is simply an LC tank you could try making it resonant to the desired frequency and see if that's all it takes.
[11:43:14] <GuShH> finding the datasheets for the used ICs will give you a hint also
[11:43:52] <GuShH> example http://www.goodluckbuy.com/125khz-em4100-rfid-card-reader-module-rdm630-uart.html
[11:45:29] <GuShH> theBear: finished the cv draft?
[11:45:47] <GuShH> only one right answer!
[11:47:37] <age> grummund, too.
[11:48:30] <grummund> age: i can't visualise what you are soing so i'm not much help, sorry?
[11:48:37] <grummund> s/?/./
[11:49:26] <age> not a problem, I will eventually do this myself.
[11:52:50] <age> grummund, maybe you can explain. with BOOTRST programmer, why does a program not in boot sector work?
[11:52:53] <age> *programmed
[11:53:43] <grummund> BOOTRST only affects the reset vector
[11:55:03] <age> that could explain things.
[11:55:22] <age> so the MCU has to be reset after it is powered up?
[11:55:25] <grummund> the program itself must be compiled to have that start address, or all the jump instructions will be wrong
[11:55:47] <grummund> the MCU will inherently reset at power up
[11:55:56] <age> strange.
[11:56:25] <age> the sample program starts up on power up, being outside of boot sector
[11:57:11] <grummund> sample program is at 0x0000 ?
[11:57:33] <age> yes
[11:57:54] <age> I have tried both cases, it starts both when written at 0x1800, and 0x0
[11:58:08] <grummund> so either the device resets to 0x0000, or it resets to the boot vector and then the bootloader jumps to 0x0000.
[11:58:45] <age> I see
[11:58:53] <grummund> what do you mean "written at 0x1800"? how did you accomplish that?
[11:59:54] <age> grummund, setting the start of .text section to that address. LD flag
[12:00:29] <grummund> age: OK. btw, you can verify that in the hex file before flashing also.
[12:00:56] <age> I do
[12:01:32] <grummund> age: i think you will see for that test it does not matter state of BOOTRST
[12:02:04] <age> yes, I have also tried unprogramming BOOTRST
[12:02:26] <grummund> age: because the main application area (from 0x0000 to boot start) will be erased
[12:02:36] <grummund> erased memory = NOP.
[12:02:54] <age> so it will eventually get to boot section.
[12:03:02] <grummund> yep
[12:03:05] <age> hmm
[12:04:14] <grummund> and vice versa, if boot sector is erased and you jump to boot vector it will eventually wrap around to 0x0000.
[12:04:36] <age> aha.
[12:04:42] <grummund> BOOTRST only matters once you have both bootloader *and* application installed.
[12:04:56] <age> I see
[12:05:07] <age> will now re-test
[12:09:46] <chiques> Can someone help me understand "Sometimes, a programmer wants to specify the bit NUMBER that they want to change and not the bit MASK"?
[12:10:07] <chiques> The example code shows "(0x01 << 2)"
[12:13:16] <age> grummund, is the power-on reset considered internal?
[12:14:27] <grummund> age: all types of reset will jump to same address
[12:15:06] <grummund> age: only exception is if HWB pin is asserted, but you probably don't have that
[12:15:27] <age> grummund, there is some code in the bootloader that is supposed to check for external reset
[12:15:53] <grummund> age: it is possible to test for what caused the reset
[12:16:11] <grummund> age: but the avr will always jump to the same address
[12:16:16] <age> I have removed that code and will now test.
[12:17:59] <age> no change.
[12:18:15] <vorsorken> chiques: It's a convenient and readable way to specify which bit of the mask you want high. The operation is called a bit-shift and you should probably look it up for a more in-depth explanation. In this case, you shift two to the left so you get 0b00000100. As you can see it's more readable than 0x04 and more convenient than typing out 0b00000100.
[12:18:27] <age> ooh
[12:18:37] <age> grummund, the bootloader seems to work
[12:18:56] <chiques> Thanks vorsorken
[12:19:03] <age> yeeeeah :P
[12:19:22] <age> finally. not sure what I did.
[12:20:02] <age> any USBaspLoader users here?
[12:24:48] <age> have to go offline. thanks for the help, grummund :)
[12:25:26] <grummund> np
[13:09:14] <elektrinis> #define pin_hall_C (1&&(PINB&(1<<5)))
[13:09:23] <elektrinis> what result will I get?
[13:09:45] <elektrinis> I expect it to be equal to pinb5
[13:10:18] <elektrinis> and this one:
[13:10:19] <elektrinis> #define rawSectorNumber ((pin_hall_C<<2)|(pin_hall_B<<1)|(pin_hall_A))
[13:10:20] <specing> headache.
[13:10:43] <elektrinis> will I get a byte with three LSB?
[13:19:46] <OndraSter> duh
[13:19:55] <OndraSter> yes, headache
[13:22:00] <elektrinis> ?
[13:22:17] <elektrinis> && is a logic AND, right?
[13:49:28] <OndraSter> no
[13:49:30] <OndraSter> & is logic and
[13:49:43] <OndraSter> && is for joining two conditions
[14:02:50] <elektrinis> OndraSter, well, yea, to join booleans, right?
[14:03:05] <elektrinis> so what is the boolean for PINB&(1<<5) ?
[14:03:15] <elektrinis> will it be a valit true/false?
[14:03:16] <OndraSter> it is not boolean
[14:03:18] <elektrinis> valid*
[14:03:26] <OndraSter> it is char
[14:03:29] <elektrinis> yea
[14:03:32] <OndraSter> or byte or whatever you want to call it
[14:03:48] <elektrinis> but... if it is used in if(PINB&(1<<5)), ir will be treated as boolean
[14:03:52] <OndraSter> yes
[14:04:01] <elektrinis> so in my case it is not?
[14:05:22] <OndraSter> it will be retyped, yes
[14:09:53] <RikusW> elektrinis: in C 0 == false, all other values are true
[14:10:51] <elektrinis> ok
[14:10:53] <elektrinis> good
[14:11:12] <elektrinis> just wanted to make sure my statement will work the same as in if()
[14:12:16] <RikusW> yourbool = PINB&(1<<5) ? true : false;
[14:12:25] <RikusW> if you want to be sure ;)
[15:53:24] <slide23> Can you download a the firmware from an avr for backup purposes?
[15:53:28] <slide23> -the
[15:54:19] <OndraSter> unless it is locked - yes
[17:14:28] <rue_mohr> #define SetBit(BIT, PORT) PORT |= (1<<BIT)
[17:14:29] <rue_mohr> #define ClearBit(BIT, PORT) PORT &= ~(1<<BIT)
[17:14:29] <rue_mohr> #define IsSet(BIT, PORT) (PORT & (1<<BIT)) != 0
[17:14:29] <rue_mohr> #define IsLow(BIT, PORT) (PORT & (1<<BIT)) == 0
[17:15:11] <Casper> why pasting those macro?
[17:15:22] <rue_mohr> looks like its needed again
[17:15:38] <Casper> look like not
[17:15:53] <rue_mohr> <RikusW> yourbool = PINB&(1<<5) ? true : false;
[17:16:05] <specing> they are provided in standard includes
[17:16:08] <rue_mohr> IsSet(5, PINB)
[17:16:08] <Casper> unrelated
[17:16:47] <rue_mohr> hows that unrelated?
[17:17:21] <rue_mohr> specing, what are the names of them
[17:17:43] <specing> sbi, cbi afaik
[17:18:01] <rue_mohr> and for testing?
[17:18:57] <specing> loop_until_bit_is_set
[17:19:17] <specing> is one of them
[17:19:34] <rue_mohr> that just sounds dangerous
[17:19:40] <specing> include/avr/sfr_defs.h:#define bit_is_set(sfr, bit) (_SFR_BYTE(sfr) & _BV(bit))
[17:19:59] <specing> include/avr/sfr_defs.h:#define loop_until_bit_is_set(sfr, bit) do { } while (bit_is_clear(sfr, bit))
[17:20:23] <rue_mohr> its marocs like that, that lock up windows
[17:20:26] <rue_mohr> :)
[17:20:33] <OndraSter> lol
[17:20:33] <specing> heh
[17:21:10] <specing> It doesent matter for me bacause I have to have my own header for [us]{8,16,32,64} definitions
[17:31:21] <Serisium> How could I use a 555 timer to generate a 1MHz clock to use to recover the fuses on an atmega?
[17:32:59] <Casper> you do not
[17:33:05] <Serisium> aww
[17:33:11] <Casper> 1M is too fast for a 555
[17:33:12] <Casper> but
[17:33:16] <Casper> you do not need to go that fast
[17:33:26] <Casper> do you have another avr?
[17:33:29] <Serisium> Yeah
[17:33:40] <Casper> then make an insane led blinker :D
[17:34:11] <OndraSter> heh
[17:34:11] <Serisium> I'm using a bit of Arduino code on it, but I'm not sure how fast its going.
[17:34:16] <OndraSter> something like while(1) { PORTB++; }
[17:34:23] <OndraSter> err
[17:34:25] <Serisium> PORTB ^= 0xFF;
[17:34:27] <OndraSter> DDRB = 0xFF;
[17:34:31] <OndraSter> or that
[17:34:36] <OndraSter> with PORTB++ you get different speeds
[17:34:42] <Serisium> ah
[17:34:56] <OndraSter> PB0 = maximum
[17:34:57] <Serisium> Should I just let it run as fast as possible?
[17:34:58] <OndraSter> PB1 = half of PB0
[17:34:59] <OndraSter> etc
[17:35:12] <Serisium> oh, that's cool
[17:35:14] <Serisium> binary
[17:35:15] <OndraSter> Serisium, as long as it looks at least remotely as square
[17:35:25] <OndraSter> and as long as the target chip can run at that speed :)
[17:35:39] <Steffanx> PINB = 0xFF;
[17:35:48] <OndraSter> duh?
[17:35:53] <OndraSter> PINB = for input
[17:35:56] <OndraSter> you ment DDRB?
[17:36:02] <Steffanx> Read your datasheets OndraSter
[17:36:16] <Steffanx> atmega168 for example
[17:36:18] <OndraSter> oh
[17:36:19] <OndraSter> for TOGGLING
[17:36:21] <OndraSter> I see
[17:36:24] <OndraSter> yes, that works as well
[17:36:28] <Steffanx> :P
[17:36:28] <Serisium> I have DDRB = 0xFF; in setup and am looping PORTB ^= 0xFF;
[17:37:00] <OndraSter> let's see if plugging phone to computer to sync kills wifi hotspot... brb
[17:37:23] <Steffanx> Still on 2kbps OndraSter ?
[17:37:29] <OndraSter> Steffanx, 2kBps!
[17:37:31] <OndraSter> and yes
[17:37:32] <Steffanx> Yes yes
[17:37:35] <OndraSter> and it didn'T kill my connection
[17:37:41] <OndraSter> didn't
[17:38:12] <Steffanx> Not yet
[17:38:39] <OndraSter> it already started syncing, it won't kill
[17:39:01] <Steffanx> Until Android doesn't like it anymore
[17:39:18] <OndraSter> I don't have android
[17:39:34] <Steffanx> windows phone?
[17:39:42] <OndraSter> yes
[17:40:02] <Steffanx> /android/windows
[17:40:22] <OndraSter> I wouldn't be able to use android
[17:40:40] <Steffanx> Android doesn't like you?
[17:40:52] <OndraSter> no
[17:40:55] <OndraSter> I don't like android
[17:40:58] <OndraSter> it is just so.... awful :D
[17:41:19] <OndraSter> the only speed match for WP7 is iPhone
[17:41:38] <Steffanx> Ok, i see it's time to sleep
[17:41:41] <Steffanx> :P
[17:41:45] <OndraSter> :D
[17:41:47] <OndraSter> also I am MS guy :D
[17:42:00] <Steffanx> *goto
[17:42:21] <OndraSter> for you?
[17:43:46] <OndraSter> gn then
[17:43:53] <Tom_itx> sleep when you die
[17:44:02] <OndraSter> yeah
[17:44:11] <Tom_itx> it is over rated
[17:44:11] <OndraSter> that's why I ain't sleepin tonight
[17:44:26] <Tom_itx> i had to rewire some logic on my cnc
[17:44:36] <OndraSter> mmm rewiring cnc
[17:44:41] <OndraSter> may I help you with that?
[17:44:45] <OndraSter> and can I keep the CNC after that?
[17:44:45] <Tom_itx> for the pendant
[17:44:48] <OndraSter> thanks!
[17:44:49] <Tom_itx> no
[17:44:58] <Tom_itx> i am really happy with the upgrades though
[17:44:59] <OndraSter> oh
[17:45:01] <OndraSter> :(
[17:45:26] <Tom_itx> did the wires, not i gotta do the software
[17:46:09] <OndraSter> some opensource?
[17:46:27] <Tom_itx> mesa hostmot2 drivers
[17:46:33] <Tom_itx> xilinx stuff
[17:46:51] <OndraSter> ah
[17:47:00] <OndraSter> how do you pronounce xilinx? "zajlynks"?
[17:47:05] <OndraSter> it has always drilled my head
[17:47:58] <rue_mohr> I always thing X linux
[17:48:19] <Tom_itx> zilinx
[17:48:19] <Tom_itx> beats me
[17:48:33] <Tom_itx> xi is z isn't it?
[17:48:47] <OndraSter> ye
[17:48:56] <OndraSter> that's why I dislike English - you write something and read something else
[17:49:05] <Tom_itx> z linx like the animal
[17:49:15] <Tom_itx> :)
[17:49:32] <OndraSter> isn't the animal lynx?
[17:49:40] <Tom_itx> and the same word could be spelled several ways or could be spelled the same and mean something different
[17:49:45] <Tom_itx> maybe
[17:49:49] <Tom_itx> you get the idea though
[17:50:00] <Tom_itx> z i lynx
[17:50:14] <OndraSter> yeah
[17:50:26] <OndraSter> yeah, like I said, "zajlynks"
[17:50:36] * Tom_itx nods suspiciously
[17:51:30] <OndraSter> oh well, enjoy fixing the software
[17:51:44] <atom1> yup
[17:51:50] <OndraSter> I shall enjoy my 2kB/s internet
[17:56:06] <Serisium> I set my atmegs328's fuses to use an external oscillator, but now it isn't responding to my programmer, or an external clock.
[17:56:27] <Serisium> Is there anything I can do to reset it?
[17:57:39] <OndraSter> HVPP
[17:57:55] <cehteh> external oscillator or external crystal
[17:58:48] <Serisium> I already have a 16MHz 3pin ceramic resonator in the circuit, but I can't tell if it's doing anything.
[17:58:57] <Serisium> I tried 2 different resonators.
[17:59:22] <cehteh> fucked up the fuses?
[17:59:32] <OndraSter> well external clock should work even when you set xtal/resonator
[18:00:09] <OndraSter> did you connect it to the right XTAL pin?
[18:00:19] <Serisium> yeah
[18:01:21] * cehteh wonders if there is some test program around which one can use to check if there is some reasonable external clock before setting the fuses
[18:01:22] <Serisium> XTAL1/PB6
[18:03:16] <OndraSter> sorry, can't check, I don't have working internet :)
[18:03:53] <Serisium> ah, damn
[18:04:10] <Serisium> I've been working on this for a few days, still no luck
[18:11:33] <jacekowski> have you got another avr
[18:11:36] <jacekowski> you could use that to generate clock
[18:29:43] <cehteh> is there some way to tell if at a power up the device comes straight from power up, or from a delay by holding reset low?
[18:33:19] <OndraSter> yes
[18:33:22] <OndraSter> check datasheet
[18:33:23] <OndraSter> MCUCR
[18:33:25] <OndraSter> MCUCSR*
[18:33:43] <cehteh> are there 2 bits set then?
[18:33:43] <OndraSter> PORF (Power On Reset Flag)
[18:33:49] <cehteh> yes i know that
[18:34:24] <OndraSter> what else then?
[18:34:45] <cehteh> PORF and EXTRF are then set the same time? just asking, i didnt checked :)
[18:35:13] <OndraSter> EXTRF is what? (sorry, I don't have any datasheet by my hand)
[18:35:32] <cehteh> external reset
[18:35:41] <cehteh> pulled the reset down
[18:35:49] <OndraSter> ah
[18:35:58] <OndraSter> well try it and tell us :)
[18:36:12] <cehteh> ok .. i thought someone may know
[18:36:38] * cehteh tries to implement some "reset to default when button hold at power up" thingy
[18:37:24] <OndraSter> well on power up the EXTRF is NOT set for sure
[18:37:44] <cehteh> another question: do you usually debounce reset or are the buildin (set to the slowest startup) delays sufficient?
[18:38:14] <OndraSter> I don't debounce reset myself..
[18:39:33] * cehteh thinks instead fusing RSTDSBL and using reset as normal io he first tries to work around and handling normal resets
[18:48:21] <cehteh> eh ... EXTRF is set on powerup (even without holding reset) ... contary to the datasheet
[18:51:01] <cehteh> ..oh .. doh ... note to self .. remove buffering caps from breadboard before doing such tests
[18:53:18] <cehteh> ok fyi .... yes PORF and EXTRF are set the same time when one holds the reset button while powering up
[18:53:45] <OndraSter> while powering up - yes
[18:53:50] <OndraSter> and while powering up without the button?
[18:54:24] <cehteh> then only PORF ... unless you forgot to remove the buffering cap, which prolly gave only a brownout here
[18:55:22] <cehteh> anyway, works exactly like i need it :)
[18:55:38] <OndraSter> I will be doing something similar
[18:55:40] <OndraSter> either stay in bootloader (USB)
[18:55:44] <OndraSter> or jump to application
[18:56:55] <cehteh> i have a 1-button user interface called "Punish" button :) ... the device (sensor) has 2 states, if it does the wrong thing you punish it and it rememebers the correct value :)
[18:57:42] <OndraSter> lol
[18:57:44] <OndraSter> addicting game?
[18:58:23] <cehteh> moisture sensor for plants .. you only need to train it when its too dry and when wet enough
[18:59:01] <OndraSter> oh
[18:59:02] <OndraSter> cool :)
[18:59:50] <cehteh> prolly i dont even need this reset-to defaults with this ui
[19:01:09] <cehteh> some years ago i read an funny/satircal article about a 2 button computer named "Punish"/"Reward" ... still made me think, not that bad idea
[19:01:53] <OndraSter> :D
[19:03:29] <cehteh> (iirc that was about a desktop computer with a writer app where you write documents with this 2 buttons)
[19:15:40] <cehteh> mhm .. with the brownout detector enabled, every startup is a brownout :D
[19:17:29] <OndraSter> :D