#avr | Logs for 2014-04-10

Back
[00:50:03] <rue_more> void serialInit() { // 115200 N81 no interrupt
[00:50:03] <rue_more> }
[00:50:09] <rue_more> anyone want to help me code tonight?
[00:50:15] <rue_more> for a mega32
[02:05:07] <Ikarus> silly Q, anyone managed to low component count wire up an AVR such that, if a button is pressed by the user, it is turned on and after running some code, can turn itself completely off
[02:06:00] <Ikarus> was thinking of, button input, causes power to flow via the overvoltage diodes to the voltage rails, so it turns on, then quickly output a signal which turns on a transistor which powers it via the normal VCC pins and can easily be turned off
[02:07:02] <Fleck> "is is turned" << what is? :D
[02:07:09] <Ikarus> oh, lol
[02:07:11] <Fleck> AVR? :P
[02:07:15] <Ikarus> not yet entirely awake
[02:07:25] <Ikarus> Fleck: and it, being an AVR indeed
[02:07:59] <Fleck> yes, you can wake up avr from sleep modes...
[02:08:09] <Ikarus> Fleck: no, not sleep
[02:08:13] <Ikarus> off
[02:08:17] <Ikarus> read my description
[02:08:46] <Fleck> yes you can do that too!
[02:09:24] <Ikarus> \o/
[02:09:32] <Ikarus> long life battery powered switch here we come
[02:10:39] <Ikarus> now to actually figure out a case for it, but oh well
[02:29:39] <Fleck> Ikarus: http://letsmakerobots.com/node/37039
[02:36:49] <Ikarus> Fleck: yeah, but as an AVR can be happily powered from it's I/O pins
[02:37:21] <Fleck> what?
[02:41:46] <Ikarus> Fleck: because of that, the circuit can be even simpler
[02:43:50] <Fleck> ok, no clue what you mean ;D but, share your final design!
[02:49:25] <OndraSter_> Ikarus, why not put it down into sleep mode? Not *as* efficient, but you have more control :P
[02:50:26] <OndraSter_> *-down
[02:52:57] <Ikarus> OndraSter_: becausse it just needs to wake up, check which of two buttons have been pressed and send a single packet over a nRF24L01+ and go back to powerdown
[03:09:50] <OndraSter_> ah k
[09:21:37] <Roklobsta> it's been a while since i last used AVRStudio. is jtag debugging with the mkII still screwy? i can program/verify everything just fine with the Device Programming tool in JTAG model but debugging seems to not work.
[09:28:38] <Roklobsta> ah, still on 6.1sp1, not sp2.
[09:41:31] <hackvana> tzanger: I can do 4/4mil and it's similar in price to 6/6mil.
[09:46:28] <Roklobsta> nup mkii still not working. FML.
[10:28:31] <mog> Tom_itx, thanks for your tip i fixed my avrs that where bricked
[10:43:47] <tzanger> hackvana: I know. Your boards are awesome
[10:44:08] <tzanger> everyone at the assembly house is impresed with your HASL
[11:33:24] <Tom_itx> mog, great!
[13:58:59] <mog> can i flash over icsp my m328p without overwriting the bootloader i installed on it?
[14:00:07] <mog> by changing section start maybe?
[14:03:32] <Casper> mog: afaik, no
[14:03:51] <Casper> before you can flash, you need to do a chip erase
[14:04:04] <mog> oh well
[14:04:06] <Casper> and afaik there is no partial chip erase command
[14:04:13] <mog> thats fine
[14:04:18] <mog> i just wanted to be a little more lazy
[14:04:43] <mog> i guess i could integrate program code into bootloader
[14:09:27] <devilsadvocate> mog: yes you can
[14:09:41] <devilsadvocate> mog: the lock bits and bootsize do that
[14:09:57] <mog> devilsadvocate, ?
[14:10:40] <devilsadvocate> mog: you need to set the correct lock bits and bootsize and make sure the bootloader goes into the correct place
[14:12:42] <devilsadvocate> mog: once you set the lock bits, you need to unlock to remove the bootloader.
[14:12:50] <devilsadvocate> you can continue using isp if you like
[14:13:24] <mog> devilsadvocate, i wanted to install bootloader , but then also drop code on the avr without damaging it or using it
[14:15:08] <devilsadvocate> mog: yes. you instal bootloader, set the fuses of the lock bits, and then icsp can't touch the bootloader afterwards until you go and unlock
[14:16:19] <mog> oh i misunderstood , that works? write bootloader, lock and then flash like normal
[14:16:23] <mog> boot loader stays?
[14:20:17] <vsync_> no. u have to do something called high voltage programming
[14:20:34] <vsync_> basically has to do with 220-230 volts ac
[14:20:41] <vsync_> to flash bootloader
[14:20:44] <vsync_> while you'
[14:21:16] <vsync_> scrap last part was random paste
[14:23:30] <synic> 220 to 230 volts AC eh
[14:52:05] <devilsadvocate> mog: yes, it works
[14:52:38] <devilsadvocate> vsync_: you can also flash bootloader later if you can change the lock bits
[14:52:46] <devilsadvocate> vsync_: not necessarily with hvp
[15:02:06] <joebobjoe> Is the LLVM backend for AVR mature? Is it still being developed?
[15:04:08] <joebobjoe> Wish this channel had logs so I could take the answer offline :(
[15:09:17] <Casper> !thislog
[15:09:35] <Casper> ... the bot is gone...
[15:13:45] <vsync_> devilsadvocate: no you totally need to do it
[15:14:09] <vsync_> 220 V, 230 obv. better, AC to power, TTL to program
[15:15:06] <vsync_> you also need to bypass your computers psu with 230 v ac so that usb/rs232 will settle on proper voltage levels
[17:42:55] <Essobi> Hero,
[17:42:58] <Essobi> Herp.
[17:43:01] <Essobi> what's up
[18:21:57] <PigFlu> how is a float stored on an 8bit avr mcu?
[18:22:23] <PigFlu> i'd like to read the bits and convert it to a float using a calculator like this one http://www.h-schmidt.net/FloatConverter/IEEE754.html
[18:23:10] <antto> you probably can
[18:25:15] <PigFlu> well, i hope so.
[18:28:17] <hotch> hah
[18:28:24] <antto> well, try it, cast a float pointer to an uint32_t pointer and have fun
[18:29:09] <PigFlu> well, i did try, thats why im asking.. it didnt work
[18:29:27] <antto> define "it didn't work"
[18:29:32] <antto> * describe it
[18:29:39] <PigFlu> i didnt get the same float.
[18:29:57] <antto> okay, maybe the bytes aren't in the same order then
[18:30:27] <antto> with 4 bytes, there aren't too many possible combinations
[18:31:36] <PigFlu> holy moly, you're a genius
[18:31:51] <PigFlu> the bytes were in reverse order :-)
[20:39:23] <homeflux> anyone here using vusb?
[20:39:49] <homeflux> can i use 1n4148 diodes instead of proper 3v6 zener diodes for the hardware usb vusb interface?
[20:40:21] <atommann> homeflux, The short answer is no I think.
[20:40:47] <atommann> zener diode is special.
[20:40:51] <homeflux> ah, i see... so ill have to switch to 3.3v i guess
[20:40:53] <homeflux> thank you :)
[20:42:11] <Lambda_Aurigae> zener is used as a reverse breadown
[20:42:13] <Lambda_Aurigae> errr
[20:42:18] <Lambda_Aurigae> used in reverse breakdown mode
[20:42:28] <Lambda_Aurigae> to moderate the voltage from the microcontroller
[20:42:46] <Lambda_Aurigae> keeping it in the range of the requisite voltage for the usb i/o pins.
[20:43:01] <Lambda_Aurigae> basically, voltage regulators.
[20:44:42] <homeflux> ah, i see :) i guess i have to buy a 10pcs pack of them ;)
[20:44:58] <homeflux> just to have them in stock^^
[20:46:24] <Lambda_Aurigae> or run the chip at 3.3V and they are not necessary.
[20:46:30] <Lambda_Aurigae> but then you need a 3.3V regulator.
[20:47:23] <homeflux> i think i have a lm317 laying around^^
[20:47:25] <homeflux> ill try this
[20:53:39] <N2TOH> I bought a variety pack of Zener diodes for this express use
[20:55:04] <N2TOH> I also recall some sort of funky issue where the 3v3 and 5v0 voltage cut offs do not give with the clock speed requirements of most ATMEL AVR chips
[20:55:15] <N2TOH> jive*
[20:55:23] <homeflux> yeah, read about this too
[20:55:52] <Lambda_Aurigae> I find the chips running at 3.3V are more reliable with vUSB than using the zener cutoffs.
[20:55:53] <N2TOH> 3v3 it some plave around 8 to 10 MHz and then you need 5 volts to go faster
[20:56:23] <N2TOH> I will have to try that myself
[20:56:26] <Lambda_Aurigae> but, yeah, AVR chips like more voltage to run at higher speeds in general.
[20:56:42] <N2TOH> are you running the chips with a USB hub, and direct into the device?
[20:56:51] <Lambda_Aurigae> always on a self powered hub.
[20:57:08] <N2TOH> what about a compromise?
[20:57:19] <N2TOH> like 4 volts?
[20:57:27] <Lambda_Aurigae> look at your USB spec.
[20:57:44] <Lambda_Aurigae> pushing too much voltage to the usb data pins can cause damage.
[20:57:49] <N2TOH> I know 3v3 I/O with 5v0 power
[20:58:12] <N2TOH> it's silly how they have it speced
[20:58:42] <N2TOH> if it were me I would have the I/O and power @ the same voltage.
[20:59:13] <homeflux> yeah...confusing why its different -.-
[20:59:14] <Lambda_Aurigae> well, the power on the usb port is meant to run through an LDO regulator.
[20:59:23] <N2TOH> LM317 type parts can be had in T0-92 and SMT packages too
[20:59:45] <homeflux> but i guess the higher voltage is needed to make longer cable length possible
[20:59:53] <Lambda_Aurigae> yup.
[21:00:16] <N2TOH> just should have used current regulation
[21:00:27] <Lambda_Aurigae> more complex at the head end.
[21:00:51] <Lambda_Aurigae> and there is some current regulation built in as it is.
[21:01:01] <Lambda_Aurigae> or, rather, current limiting.
[21:01:09] <N2TOH> not really, I've worked on several projects where current regulation was the proper answer to a dumb question.
[21:07:29] <rue_more> void serialInit() { // m32 @ 16Mhz, 115200 N81 no interrupt
[21:07:30] <rue_more> }
[21:07:35] <rue_more> nobody wrote my function for me
[21:08:27] <rue_more> thats cause 115200 dosn't properly fit into 16Mhz
[21:08:29] <rue_more> oh
[21:08:32] <rue_more> what does?
[21:08:34] <rue_more> check the list
[21:08:44] <Casper> hey rue_more
[21:08:58] <Casper> have you used logarithmic function on avr?
[21:08:58] <rue_more> Casper, why didn't you write my init function?
[21:09:11] <rue_more> I used the most ugly math i could throw at it
[21:09:12] <Casper> rue_more: because you didn't write mine :D
[21:09:48] <rue_more> I had it do exponential functions with values from trig functions
[21:10:00] <rue_more> 4 to 5 layers thick
[21:10:13] <rue_more> and it still spit out the answers faster than the lcd could keep up
[21:10:25] <rue_more> http://www.wormfood.net/avrbaudcalc.php
[21:10:26] <rue_more> 16Mhz
[21:10:33] <Casper> basically I want to make an RGB led fader, that fade from color to color, in a smooth way
[21:10:53] <Casper> I'm debating between a table or calculate it in software
[21:10:57] <rue_more> hahah 2400 is the only 0 error
[21:11:15] <rue_more> use a table
[21:11:19] <rue_more> more direct control
[21:11:39] <rue_more> you have to account for the responce of the humans eye too ya know
[21:11:47] <rue_more> tell me that fits into a math equation
[21:11:50] <Casper> yeah
[21:12:16] <Casper> I wonder if I shall use 8 bits pwm or 16 bits... hmmm
[21:12:24] <rue_more> maybe I'll just go 9600
[21:12:35] <rue_more> 16 bits may cycle too slow
[21:12:35] <Casper> use 18.432
[21:12:57] <rue_more> but then I have to recalculate all my timer values for the hobby servos
[21:14:05] <N2TOH> just over clock it!
[21:15:02] <N2TOH> I found this nice Linear Tech part that has I2C and SPI options, it offers 1KHz to 68MHz in ittibity small tuning steps
[21:15:30] <N2TOH> and it can run on 3v3 to 5v0 supply
[21:33:52] <rue_more> yea
[21:34:01] <rue_more> I think I took a m32 to 20Mhz once
[21:34:21] <rue_more> I found a lib and dont need anyone to write me a function
[21:34:24] <rue_more> :P
[23:33:52] <rue_more> oooooh
[23:34:01] <rue_more> I start timer 1, and wait for an interrupt on timer 0
[23:34:15] <rue_more> that explains it
[23:34:22] * Casper points and laught at rue_more
[23:35:12] <rue_more> I'll have you know this code was written verry carefully
[23:35:29] <rue_more> from pseudo code that was made form genuine chicken scratch
[23:36:12] <rue_more> if it compiles, will it work now?
[23:36:46] <rue_more> http://paste.debian.net/93077/
[23:36:51] <rue_more> see any errors?
[23:37:53] <Casper> I'm sure there is
[23:38:00] <Casper> but too tired to see them
[23:38:21] <Casper> because everyone knows that rue_more can't code!
[23:38:23] * Casper hides
[23:42:55] <rue_more> it mostly works now
[23:43:15] <rue_more> my timer2 calculations are out
[23:43:39] <rue_more> the timer1 calcs are dead on
[23:44:25] <rue_more> timer 2 shoudl fire every 2.5ms
[23:44:31] <rue_more> 16mhz clock
[23:48:50] <rue_more> 6.25e-08 sec/cycle
[23:49:29] <rue_more> zippo:/morfiles/programming/c/avr/atmega32/hobbydriver# calc "(.0025/(1/16000000))"
[23:49:29] <rue_more> (.0025/(1/16000000)) -->> 40000
[23:49:38] <rue_more> 40000 counts in 2.5ms
[23:49:58] <rue_more> zippo:/morfiles/programming/c/avr/atmega32/hobbydriver# calc "(.0025/(1/16000000))/256"
[23:49:58] <rue_more> (.0025/(1/16000000))/256 -->> 156.25
[23:50:21] <rue_more> so, if the clock rate is divided by 256, I should wait for about 156 counts
[23:50:35] <rue_more> / counter 2 to CTC cdiv=256 ocr2 = 156, interrupt enabled, clock source on.
[23:50:36] <rue_more>
[23:50:36] <rue_more> TCCR2 = b00001110;
[23:50:36] <rue_more> OCR2 = 156;
[23:51:03] <rue_more> [FOC2 WGM20 COM21 COM20 WGM21 CS22 CS21 CS20] TCCR2
[23:51:20] <rue_more> so, CS22 and CS21 are set
[23:51:46] <rue_more> 1 1 0 clkT2S/256 (From prescaler)
[23:51:56] <rue_more> ... what prescaler
[23:54:15] <rue_more> The Timer/Counter is inactive when no clock source is selected. The
[23:54:15] <rue_more> output from the Clock Select logic is referred to as the timer clock (clkT2).
[23:54:27] <rue_more> a) this is counting up, right?
[23:54:38] <rue_more> b) where is my clock comming from?
[23:57:50] <rue_more> .. they clearly show a direction control on the counter, but they say nothing about operating it
[23:59:29] <rue_more> oh, its a mode thing
[23:59:52] <rue_more> CTC is always up