#avr Logs

Mar 18 2017

#avr Calendar

01:16 AM daey_ is now known as daey
02:40 AM polprog: Lambda_Aurigae: thanks for that link
03:18 AM JanC_ is now known as JanC
03:22 AM z3t0: how can i do a pulse in and pulse out on avr?
03:22 AM z3t0: for pulse out i was thinking i would use a timer that is high until it hits the top?
03:22 AM z3t0: not too sure about pulse in though
04:38 AM moondeck: hi, got a little problem with my 328p
04:39 AM moondeck: i am not getting anything out on SPI, here is the code i am using for init https://hastebin.com/edasacapif.cpp and the main loop https://hastebin.com/ewemikiqaw.cpp
04:39 AM moondeck: using avr-gcc
04:39 AM moondeck: and the board is an arduino uno
04:40 AM moondeck: i basically get nothing on the output, nothing at all
04:44 AM moondeck: anyone got an idea?
04:48 AM moondeck: hmm, my fuses seem to be all 0x00?
04:48 AM moondeck: oh, nope, its the bootloader that doesnt support it
09:47 AM Shavik` is now known as Shavik
10:38 AM Smidge204: Quick question; Why is it that the .hex file is significantly larger than the written size reported by avrdude on successful write?
10:44 AM mrx1: Smidge204: because it's in intel hex format, which is ascii
10:44 AM mrx1: you can open it in notepad
10:45 AM * Smidge204 opens in notepad
10:45 AM Smidge204: Huh! That's neat.
10:45 AM Smidge204: Never occurred to me to even try that
11:01 AM specing: windows users be like^
11:10 AM Smidge204: Well, back in the day the 8051 assemblers produced hex files that were actual byte-for-byte representations of the device programming, so I didn't think to question it
11:33 AM Chillum: linux users be like "I wonder if I can write a script to modify it to bring out new features"
11:42 AM specing: linux losers be like "linux sucks. Meanwhile look at my cool new android phone!!!"
11:47 AM Chillum: hehe
12:53 PM Emil: Smidge204: not possible
12:54 PM Emil: A hex file is by definition twice the size
12:54 PM specing: more than twice
12:55 PM specing: 2*x + 28% overhead
12:55 PM Emil: specing: eh?
12:55 PM Emil: what's the 28%?
12:55 PM specing: Emil: the thing at the start of line
12:55 PM specing: :XXYYYYZZ
12:55 PM Emil: ah yeah if you format moar then obciously
12:56 PM specing: followed by (usually 16 bytes in hex (32))
12:56 PM julius___: hi
12:56 PM specing: followed by a byte checksum
12:56 PM specing: so 30% overhead
12:56 PM Smidge204: This was about 20 years ago, and I don't remember the assembler that produced them, but they had a .HEX extention and were byte for byte
12:56 PM julius___ is now known as julius_
12:56 PM Emil: Smidge204: extensions mean nothing
12:57 PM Smidge204: Then you were wrong to say I was wrong :D
12:57 PM Emil: wst
12:57 PM Emil: wat
12:57 PM Emil: Smidge204: pls
12:57 PM julius_: found a 10mm led with 3 legs in my stuff basket, the mittle leg is the longest, the left and right ones are different length to each other. any idea how to connect it? looks like this: https://sc01.alicdn.com/kf/HTB1_9JbLXXXXXclXpXXq6xXFXXXr/10mm-white-3-legs-LED-diode.jpg
12:57 PM Smidge204: I said assemblers produced hex files that were byte for byte
12:58 PM Smidge204: You said that's wrong because hex files are aSCII representations (not those exact words ofc)
12:58 PM julius_: probably a 2 color led
12:59 PM Emil: Smidge204: "jokes on you I was only playing retarded". You just dont go and say something that has a distinct meaning means something different
12:59 PM Smidge204: Then you said the extension means nothing, which is true, but that also means you have no grounds for saying I was wrong about the hex files produced by that assembler 20 years ago
12:59 PM Emil: Smidge204: hex is by definition twice the size of binary
12:59 PM Smidge204: Maybe that's the standard now
12:59 PM Emil: Smidge204: stop with the retarded bullshit
12:59 PM Lambda_Aurigae: julius_, probably GND to the center and VCC to the two outer pins depending on the color you want.
12:59 PM julius_: makes sense Lambda_Aurigae
01:00 PM Lambda_Aurigae: julius_, it's two diodes hooked together.
01:00 PM Lambda_Aurigae: probably RED/GREEN
01:00 PM Smidge204: I remember this because this was a high school class and part of the work involved manual assembly of opcodes. The *.HEX file output by the assembler were not ascii format.
01:00 PM Smidge204: Whether or not that's good and proper is immaterial.
01:00 PM julius_: Lambda_Aurigae, yeah let me look up the voltages again
01:00 PM Smidge204: As you said, file extensions mean nothing :D
01:00 PM Lambda_Aurigae: Smidge204, most likely it was not iHex format...simple enough.
01:00 PM Emil: Smidge204: like I said, stop with the retarded bullshit
01:01 PM Smidge204: I'm sorry you failed at trying to put me down.
01:02 PM julius_: i hope this room is not about putting people down....might be just a misunderstanding
01:02 PM Emil: I can say that m328p is now called "best thing, fuck off" or btfo but that doesnt make it any more true than your shit
01:03 PM Emil: Smidge204: accept your loss and move on
01:03 PM Smidge204: Not sure what I lost
01:03 PM julius_: Lambda_Aurigae, youre right..its green and red
01:04 PM Lambda_Aurigae: and turn both on and it should be amber-ish
01:04 PM Lambda_Aurigae: julius_, you're ugly and your mother dresses you funny...if you use arduino.
01:04 PM Lambda_Aurigae: :}
01:04 PM Lambda_Aurigae: aaand, I'm off.
01:05 PM julius_: how did you know, thats a secret...
01:05 PM julius_: witches everywhere
01:05 PM Emil: Lambda_Aurigae: only the coding part for avr, though
01:06 PM Emil: I should also make a hall of fame for the idiotic things I hear on this channel smh
01:06 PM Emil: (learned what smh means today because I googled it)
01:37 PM hetii: Anyone test SE8R01 module ?
01:40 PM hetii: casue when I try to read status register by hardware spi in loop I just get 0xFF from first call and spi hang
01:54 PM Emil: hetii: I recommend using known good code and known good setup snd seeing if it works
01:54 PM Emil: If you then have a scope you can try and see what happens
01:54 PM Emil: Also did you use both cs and ce?
01:56 PM hetii: Emil, well I just found some crappy code for arduino I also test it with library for NRL24L01+ but without success. So now I start from ground and try read status register. When I use bit-banging spi function it return always 00 and when use hardware spi just first call return 0xff then hang
01:57 PM hetii: Emil, also its not clear for me about CE line, everywhere I saw that this line its initialized to low, but in datasheet I see that should be high
01:57 PM hetii: CSN I keep low before sending spi data and after it set to high
02:00 PM Emil: hetii: if it werks with shit arduino code then the module works and its about your coding that doesnt ;)
02:00 PM Emil: csn is active low, ce is avtive high
02:03 PM hetii: Emil, this is my code that should return status register data: http://paste.ubuntu.com/24203218/
02:03 PM Emil: aint got no time to debug code :D also do not fucking use soft spi
02:04 PM hetii: well my example is with hardware spi code :)
02:04 PM Emil: Also try the rf24 lib
02:05 PM Emil: https://github.com/dhog1/RF24L?files=1
02:05 PM Emil: or that one
02:06 PM hetii: ok thx will check it
03:03 PM Emil: The important thing is to make sure the shit werks
03:03 PM Emil: once that is established you can do whatevwr
03:53 PM Smidge204: So the USIDR contains the data I wish to send via two-wire serial. The data sheet (ATtiny25) says that the MSB of this register should be tied to SDA (PortB, 0).
03:54 PM Smidge204: USICS1=0, and the datasheet says the output latch should be constantly open, and that as long as th elatch is open the new MSB should be written as the data is shifted
03:55 PM Smidge204: I've made sure that the SDA pin is not being held low and that the corresponding DDBR bit is set, so this should work... but SDA never changes
04:17 PM Smidge204: The data register seems to shift data IN but not OUT. What the hell am I missing?
04:59 PM z3t0: hey guys
04:59 PM z3t0: im trying to figure out how to use timers for a sonar sensor
05:07 PM Emil: z3t0: alrifhyt
05:07 PM Emil: z3t0: tell us more
05:07 PM z3t0: i am trying to use a parallax ping sensor with an atmega 328p
05:08 PM z3t0: i was thinking that i would set HIGH then delay 5us then read back the signal
05:08 PM z3t0: for reading back the signal I would be using a timer to measure correct?
05:08 PM Emil: Yes use a int0 or input capture interrupt
05:09 PM Emil: (or pcint)
05:09 PM Emil: with a timer
05:09 PM Emil: int0/1*
05:10 PM Emil: Does it work like: give certain length trigger, wait for edge, count time until another edge?
05:10 PM z3t0: yes exactly
05:11 PM Emil: okay
05:13 PM cehteh: input capture ftw
05:15 PM z3t0: what does PCINT mean in the pinout?
05:16 PM Emil: z3t0: pin change interrupt
05:16 PM z3t0: ok
05:16 PM z3t0: and so according to the pinout all pins are pcint?
05:17 PM xentrac: probably not the power and ground pins
05:18 PM z3t0: right
05:25 PM z3t0: is there a reason pins are labelled backwards in the datasheet?
05:25 PM z3t0: for example
05:25 PM z3t0: https://i.imgur.com/Fea6BaT.png
05:25 PM Emil: they are bits
05:26 PM Emil: that' register
05:26 PM xentrac: yeah, it's talking about bits
05:26 PM xentrac: usually we write bits with the most significant bit first
05:27 PM xentrac: like 1101 encodes decimal 13, not decimal 11
05:27 PM xentrac: but then if we are going to number those bits, we probably shouldn't number them 0123 or 1234; that numbers the units bit arbitrarily as 3 or 4
05:28 PM xentrac: so instead we number them 4321 or 3210, so the numbering is consistent if we add mor ebits
05:28 PM xentrac: thus [23:16]
05:31 PM z3t0: oh
05:31 PM z3t0: okay so i am trying to set an interrupt for pcint22 on an atmega328p
05:32 PM z3t0: ISR (PCINT22_vect) {
05:32 PM z3t0: printString("interrupt\n");
05:32 PM z3t0: }
05:32 PM z3t0: but the compiler is warning me that the interrupt vector does not exist
05:32 PM z3t0: according to the data sheet there are only 3 ( 0, 1, 2)
05:32 PM z3t0: does that mean each set of 8 pcints share one interrupt vector?
05:39 PM z3t0: nvm that is true
06:11 PM z3t0: can someone link me to a tutorial on input capture
07:37 PM Lambda_Aurigae: input capture?
07:38 PM Lambda_Aurigae: pcint is done by port by the way.
10:22 PM Jartza: http://i.imgur.com/HaGjOne.png
11:29 PM Chillum: argh
11:29 PM Chillum: it shames me that I laughed
11:29 PM Casper: still a good one
11:30 PM Chillum: I like this one https://xkcd.com/643/
11:34 PM Casper: still debating on the kind of antenna I want to put on the roof...
11:38 PM z3t0: hi guys
11:38 PM z3t0: i need some help
11:38 PM z3t0: so I have been banging my head against the wall for the better part of today trying to get a ping sensor to work with an atmega328p
11:39 PM z3t0: I understand how the sensor works and what I need to do, but am unable to get the code right
11:39 PM z3t0: The sensor is activated by a 5us pulse, which is easy, and then it returns an echo with two edges, the width being the distance of the sensor
11:40 PM z3t0: I cannot for the life of me manage to read the width of the pulse
11:46 PM Chillum: z3t0: have you registered an interrupt on that pin?
11:47 PM z3t0: Yes. I am using Timer1_CAPT_vect
11:47 PM z3t0: I am going to go grab an arduino and have it loop a constant wave to debug
11:48 PM z3t0: Can you refer me to a resource on Input Capture?
11:48 PM Chillum: google I guess hehe
11:48 PM z3t0: haha i have been doing that for hours
11:49 PM Chillum: When the echo edges come is your interrupt service routine running?
11:49 PM z3t0: I have found several code examples but not much with an explanation
11:49 PM Chillum: you just need to record micros() on each pulse and subtract
11:49 PM z3t0: Yes, it runs
11:49 PM z3t0: would i need to be running a timer in the background to use as a wallclock?
11:50 PM Chillum: just read micros()
11:50 PM z3t0: wait thers a function called micros...
11:50 PM Chillum: yup
11:50 PM Chillum: https://www.arduino.cc/en/Reference/Micros
11:50 PM Chillum: microseconds since startup
11:50 PM z3t0: oh yeah
11:50 PM z3t0: I am using an avr chip
11:50 PM z3t0: no arduino firmware
11:50 PM Chillum: just read it on the first echo edge, then again on the next
11:51 PM Chillum: oh, well
11:51 PM Chillum: I think the value is still in there somewhere
11:52 PM Chillum: http://arduino.stackexchange.com/questions/22212/using-millis-and-micros-inside-an-interrupt-routine <-- here you can see how micros works
11:52 PM z3t0: thanks