#avr | Logs for 2016-11-13

Back
[00:06:33] <eszett> hi
[00:06:56] <eszett> I have a question, how can I calculate the amount of milli amps my circuit draws averagely with a Atmega32u4 on it?
[00:19:14] <Casper> pen and paper and lots of datasheets?
[00:19:23] <Casper> easier to mesure
[00:23:35] <eszett> Casper, hmm i thought there are maybe numbers by experience
[00:24:01] <eszett> I estimate a range of 150-250mA
[00:24:27] <Casper> not knowing your circuit, I can't estimate
[00:25:32] <Casper> this circuit I think of consume up to 750W
[00:26:10] <Casper> this project that I may never do would take 60-600mA
[00:32:19] <eszett> ye sure, i have to deliver specifications of my circuit
[03:54:49] <specing> eszett: stick an ammeter in line with the supply
[09:21:54] <moondeck> hello
[09:23:38] <Lambda-Aurigae> olleH
[09:31:19] <moondeck> hey, anyone here?
[09:32:50] <moondeck> got a problem with my 32u4, i can send, but not receive data over UART1
[09:33:26] <moondeck> code here http://hastebin.com/jofuyelefe.c
[09:36:35] <Lambda-Aurigae> nope. nobody here.
[09:38:18] <moondeck> helpful
[09:38:32] <moondeck> could you actually tell me whats wrong with it?
[09:38:49] <moondeck> everywhere i look, i see that code for receiving
[09:38:58] <moondeck> so its not it, i suspect
[09:39:10] <Lambda-Aurigae> I have no clue what's wrong with it.
[09:39:30] <moondeck> it just doesnt echo the characters back
[09:40:13] <Lambda-Aurigae> http://homepage.hispeed.ch/peterfleury/avr-software.html
[09:40:24] <Lambda-Aurigae> I use the usart code from this page myself.
[09:41:29] <moondeck> but i dont want someone's code
[09:41:41] <moondeck> and the library basically does the same
[09:41:58] <Lambda-Aurigae> "basically"
[09:42:03] <Lambda-Aurigae> do you have a typo in there?
[09:42:12] <moondeck> no
[09:42:21] <Lambda-Aurigae> can you display the incoming data on 8 LEDs maybe?
[09:42:55] <Lambda-Aurigae> I just am not in the state of mind to debug other people's code today....maybe someone else here can help you if you wait a bit.
[09:43:11] <moondeck> i could display the state of the receive buffer flag on an LED
[09:43:14] <Lambda-Aurigae> it is a sunday morning and all so probably not a lot of people online at the moment.
[09:43:17] <moondeck> i dont really have any LEDs on hand
[09:43:47] <DKordic> nonasuomy_: Are You clearing the RX Interrupt Flag?
[09:43:55] <moondeck> looks like you live on the other side of the earth, Saturday evning here
[09:44:14] <moondeck> anyway, let me try
[09:46:26] <moondeck> how do i check a pins value in avr-gcc?
[09:46:34] <moondeck> i mean not pins, a register bit
[09:47:29] <moondeck> just _BV(whateverbitinaregister)?
[09:51:24] <DKordic> Load a SFR and mask it.
[09:53:29] <moondeck> will doing UCSR1A & (1 << RXC1) be good enough? returns 0 if its not true, and 1 if true, from what i understand?
[09:56:31] <DKordic> Yes.
[10:00:18] <moondeck> well, the LED lights, meaning the flag doesnt get cleared
[10:00:36] <moondeck> but do i have to set UDRx to 0 after i read from it
[10:00:37] <moondeck> ?
[10:01:08] <moondeck> or the RXC1 flag?
[10:02:59] <Tom_L> what does the data sheet say on that?
[10:03:28] <moondeck> doesnt say anything about clearing anything
[10:03:34] <moondeck> neither does the code in the datasheet
[10:03:59] <moondeck> i cannot even write that bit
[10:04:13] <moondeck> and writing to UDR1 means sending something out
[10:06:26] <moondeck> its like if the board doesnt even receive anything
[10:06:38] <moondeck> or it does, but then locks up
[10:14:09] <moondeck> the USB-UART adapter works, i get characters when i short RX/TX
[10:14:24] <moondeck> so its either the IC, or my program
[10:17:11] <Tom_L> http://tom-itx.no-ip.biz:81/~webpage/avr/rs232_rx_test/
[10:17:16] <Tom_L> should be quite similar to that
[10:18:34] <Tom_L> did you define F_CPU?
[10:18:53] <moondeck> yes, i did, look in the code i posted before
[10:19:01] <moondeck> http://hastebin.com/jofuyelefe.c
[10:23:08] <Tom_L> you aren't using interrupts are you
[10:24:11] <antto> is the "TEST" getting printed?
[10:25:00] <Tom_L> i see no sei() either
[10:26:55] <Tom_L> but i haven't looked at that code in a very long time so what do i know
[10:29:28] <moondeck> nope, not using interrupts
[10:29:42] <moondeck> "TEST" is getting printed
[10:46:33] <Tom_L> i'd consider using interrupts
[10:47:08] <Tom_L> "TEST" isn't waiting for any outside source either
[10:47:24] <Tom_L> you won't know when the bits come from rx
[10:59:32] <moondeck> alright, will try to use interrupts then
[11:00:06] <moondeck> thanks for advice
[12:03:12] <noqnio1> hey, im trying to blink a led (:D) on an attiny2313 and no matter what i put in delay_ms the blinking is always at a steady and too fast rate...
[12:03:26] <noqnio1> i set the fuses and F_CPU correctly (ithink)
[12:03:32] <noqnio1> any ideas what could be wrong?
[12:04:19] <noqnio1> http://pastebin.com/0WThAa0j here is my code and makefile
[12:06:14] <noqnio1> and my fuses.. (E:FF, H:DF, L:FF)
[12:06:18] <noqnio1> -.-
[12:10:50] <Tom_L> default fuses should work
[12:11:18] <noqnio1> the defaults are for the internal clock, im trying to use 20mhz external
[12:11:50] <Tom_L> http://tom-itx.no-ip.biz:81/~webpage/how_to/atmega168/mega168_led_blink_delay_index.php
[12:12:18] <Tom_L> try something like htat
[12:12:48] <noqnio1> but, i need to work with _delay_ms
[12:12:52] <Lambda_Aurigae> noqnio1, you have to set the fuses to read external clock first.
[12:12:58] <Lambda_Aurigae> turn off the div/8 fuse
[12:13:07] <Lambda_Aurigae> and have an external crystal and 2 capacitors connected.
[12:13:35] <noqnio1> div/8 is off, and the crystal is connected
[12:13:40] <noqnio1> and the external clock is selected
[12:13:54] <Tom_L> external clock or external crystal?
[12:13:55] <Lambda_Aurigae> external clock or crystal?
[12:14:00] <Tom_L> duh
[12:14:01] <Lambda_Aurigae> BIG difference.
[12:14:12] <noqnio1> crystal;
[12:14:18] <noqnio1> srry
[12:15:05] <Lambda_Aurigae> you have it set to external oscillator, not external crystal.
[12:15:25] <Lambda_Aurigae> oh.
[12:15:26] <Lambda_Aurigae> wait.
[12:15:28] <Lambda_Aurigae> let me reread that
[12:15:36] <Lambda_Aurigae> you have it set to external 8mhz crystal.
[12:16:04] <noqnio1> 8mhz to 20
[12:16:23] <noqnio1> CKSEL 111 ---> datasheet says frequency range 8 -
[12:16:41] <noqnio1> also, the timing wasn't correct with internal 8mhz either
[12:16:46] <Lambda_Aurigae> yeah.
[12:16:50] <noqnio1> i think there is something wrong with my makefile
[12:16:58] <Lambda_Aurigae> what is F_CPU set to?
[12:17:07] <noqnio1> #define F_CPU 20000000UL
[12:17:17] <cehteh> where do you define that?
[12:17:24] <noqnio1> in main.c, and again in makefile
[12:17:43] <cehteh> -DF_CPU=...?
[12:17:48] <noqnio1> yes
[12:17:56] <cehteh> should do
[12:18:06] <cehteh> but you should set it only in one place
[12:18:20] <noqnio1> i tried removing the definition from the makefile aswell
[12:18:46] <cehteh> i'd prefer makefile and CFLAGS
[12:18:56] <noqnio1> http://pastebin.com/0WThAa0j <- can you please take a look at my makefile, i never understood them
[12:19:01] <Lambda_Aurigae> we might need to see code.
[12:19:05] <cehteh> because it must be defined in all compilation units
[12:19:07] <Lambda_Aurigae> to see if you have a logic issue.
[12:19:19] <noqnio1> everything is in the link i shared with you
[12:19:44] <cehteh> also .. blink with timer and overflow isr, that shoud give a better indication if the mpu runs at the correct clock
[12:20:14] <cehteh> that unrelated to F_CPU then
[12:21:04] <cehteh> but when it runs, then either your external osc/crystal swings correctly or you still run on internal, but there should be no way it swings the external at the wrong clock
[12:21:30] <cehteh> or internal to anytihng else than 8mhz /8 .. except for calibration stuff
[12:21:40] <noqnio1> nothing even happens when i change the value in the delay function, i dont know wth is going on
[12:21:44] <Lambda_Aurigae> as it is running faster, I think maybe an optimization is stripping the delay function down some
[12:21:58] <cehteh> never ever use delay :D
[12:22:02] <cehteh> my saying
[12:22:28] <Lambda_Aurigae> noqnio1, if it doesn't change at all then you have bigger issues...like, the code isn't getting recompiled or reuploaded.
[12:22:56] <cehteh> that too
[12:23:09] <noqnio1> it does, if i remove the portb assignments it doesnt turn on
[12:23:53] <cehteh> welll .. debug-fu .. work towards figuring out whats going wrong step by stel
[12:23:55] <cehteh> p
[12:24:24] <cehteh> delay() shouldbt be optimized out that would be a bug
[12:24:48] <cehteh> but still, you should avoid busy loops
[12:25:49] <Lambda_Aurigae> bugs happen.
[12:25:55] <Lambda_Aurigae> back to making sawdust!