#avr Logs

Aug 30 2017

#avr Calendar

12:13 AM enh: 01:41 here. Back to the computer. I wonder if I will ever be capable of understanding the output of avr-objdump -A -S
01:03 AM rue_house: you shouldn't go over 19200 if your running at 16Mhz
01:03 AM rue_house: if your running at,,,, 14.27? you can go as high as you want
06:32 AM danst: Lambda_Aurigae: how do I view bit pattern of serial input
06:33 AM Lambda_Aurigae: well, you have the data
06:33 AM Lambda_Aurigae: NAK is decima 21
06:33 AM Lambda_Aurigae: convert that to binary
06:35 AM danst: that doesn't bring me anywhere further unfortunately
06:36 AM danst: I guess those NAKs are just same as "?"
06:36 AM Lambda_Aurigae: no
06:36 AM kvik_: do you run Linux?
06:36 AM Lambda_Aurigae: they are 010101 pattern just like the U
06:36 AM danst: I'm sending "1234567890" and get NAK NAK NAK and NAK NAK NAK NAK NAK
06:36 AM Lambda_Aurigae: sounds like it's stretched out...have you tried adjusting and testing several times?
06:36 AM Lambda_Aurigae: that's not what you said last night.
06:37 AM danst: I've tested combinations with single letter as well
06:37 AM kvik_: if you do, you can run `man ascii` which will give you a table of ASCII codes from which you can get a hex value and convert it to binary either manualy or in python with bin(0x55)
06:37 AM Lambda_Aurigae: sounds like your serial receiver is just giving you NAK as a failure then.
06:37 AM Lambda_Aurigae: not actually showing you exactly what it is getting.
06:38 AM danst: it also was giving quesionmark sign
06:38 AM danst: and a questionmark inside of an ellipse
06:38 AM Lambda_Aurigae: again, your serial monitor or something is not giving you the exact data.
06:39 AM danst: maybe I'm wiring it wrong?
06:39 AM Lambda_Aurigae: it's giving you "I dunno what this is" messages.
06:39 AM noHitW_work: danst did you get that DFPlayer/attiny working?
06:39 AM danst: noHitW_work: unfortunately I'm unable to find correct baud rate for UBRRL to match 9600
06:40 AM Lambda_Aurigae: automate i.
06:40 AM Lambda_Aurigae: it
06:40 AM noHitW_work: what is your clock frequency?
06:40 AM danst: I was printing 1234567890 and looking at characters count but never got exact 10 characters. It's 9 or more than 10
06:40 AM Lambda_Aurigae: send UUUUUUUU then change the UBRR a little then send again and change then send again.
06:40 AM danst: 8Mhz internal
06:40 AM kvik_: have you looked at the UBBR tables at the end of USART section in your datasheet? try one of those? maybe your UART is badly configured, hard to tell when you are using hardcoded constants in your code
06:40 AM Lambda_Aurigae: also, send the number you are using after the UUUUUUUU
06:41 AM Lambda_Aurigae: or, just send the number.
06:42 AM Lambda_Aurigae: set rate, send number you set, change rate, send new number, and cycle through until you see the correct number displayed correctly.
06:43 AM Lambda_Aurigae: ok...off to work.
06:44 AM noHitW_work: last time i used avr uart i took the values straight out of the datasheet and it worked ok
06:45 AM noHitW_work: but you can use a function that calculates the values
06:45 AM noHitW_work: i think that's in the data sheet too
07:11 AM danst: Lambda_Aurigae: I went through baud rates 1000 -> 11000 and it doesn't seem to be any different except rendered symbols count
07:11 AM danst: https://pastebin.com/eDdzSPcc
07:11 AM danst: here's my terrible attempt
07:13 AM danst: it all looks like this https://i.imgur.com/CfD9qdI.png
07:20 AM noHitW_work: have you tried that function that calculates the UBRR values?
07:21 AM noHitW_work: whats your chip?
07:32 AM noHitW_work: it should work with UBRRH=0x00;
07:32 AM noHitW_work: UBRRL=0x33;
07:33 AM noHitW_work: what's in the other end of that serial connection? how are you testing this?
08:05 AM Lambda_Aurigae: I use wormfood's baudrate calculator.
08:06 AM kvik: danst, we wish to help you but you are making it difficult for us by providing code that is very hard to look at, with hardcoded configuration values, commented out sections, ifdefs, code not related to your specific problem. I suggest you start from scratch, forget about your dfplayer project for a while and make a simple program that sends out a single character over UART. when you get the basics working, then you can build up.
08:09 AM Lambda_Aurigae: also, you need a known good way to accept and view the data.
08:09 AM Lambda_Aurigae: it seems to me the ardweeny may be part of the problem.
08:10 AM Lambda_Aurigae: ttl level usb-serial adapter would be best.
08:10 AM Lambda_Aurigae: or a serial port with a level converter.
08:11 AM Lambda_Aurigae: which, people keep telling me modern computers don't have but I bought an i7 laptop last year that has a serial port on it.
08:11 AM noHitW_work: kvik: word
08:15 AM Lambda_Aurigae: noHitW_work, lots of words.
08:20 AM noHitW_work: ftdi has these cables that have ft232 inside, they are pretty handy
08:22 AM noHitW_work: and i would buy a some sort of logic analyzer, its handy for debugging stuff like this
08:22 AM noHitW_work: you could see what actually comes out of the uart
08:24 AM noHitW_work: i would recommend this, it has many things like scope, logic analyzer, variable power supply etc. http://store.digilentinc.com/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply/
08:25 AM noHitW_work: and if it hasnt, you can make your own front-end since it comes with a C SDK
08:26 AM noHitW_work: and if youre a student you can get it for -40% discount
08:28 AM polprog: it doesnt even have to be Discovery, i have a $5 saelae clone that works with original software. for things like debugging UART it's great
08:28 AM polprog: (if you dont have a scope which is the most basic of advanced electronic tools)
08:36 AM noHitW_work: this might be cool too http://store.digilentinc.com/openscope-mz-open-source-all-in-one-instrumentation/
08:38 AM noHitW_work: works with phones too since it has web interface, unlike discovery
08:40 AM polprog: sensible price
08:40 AM noHitW_work: yeah
08:40 AM noHitW_work: it was a kickstarter project
08:42 AM polprog: wow, 32 channels
08:42 AM polprog: I like that soldermask color
09:54 AM HighInBC: oshpark purple
09:54 AM HighInBC: the colour of innovation
09:55 AM polprog: i just wrote a short message in a txt file on a floppy,
09:55 AM polprog: wonder if anybody will ever read it
09:55 AM polprog: it's in the drawer now,
09:56 AM HighInBC: depend on if some nostalgia youtube guy finds it
09:56 AM polprog: it actually is written on the floppy "IMPORTANT: READ ME"
09:56 AM HighInBC: "I have sent this message into the future from the year 2017!"
09:57 AM polprog: something like that
10:31 AM Emil__ is now known as Emil
11:40 AM Emil: Hmm
11:40 AM Emil: Anyone run into problems with using 3.3v uart on rx?
11:43 AM enh: which ic?
11:45 AM Emil: enh: avr
11:45 AM Emil: of course
11:45 AM Emil: https://emil.fi/jako/kuvat/2017-08-30_19-14-29_qUZ2OUjt.png
11:45 AM enh: I use 3.3V on UART without problems
11:46 AM Emil: Making a super fucking quick, dirty and simple raspberry pi hat for this course
11:46 AM Emil: It's an IOT Led controller ":D"
11:57 AM polprog: iirc raspi uses 3v3 uart too
11:57 AM polprog: check on the scope i guess
12:11 PM Emil: yeah everything on raspi is 3.3v
12:11 PM Emil: That's why I don't have a voltage shifter from raspi to avr
12:12 PM Emil: Hmm
12:12 PM Emil: I need a footprint for SPDT
12:14 PM cehteh: usb is 5V :D
12:14 PM cehteh: (vcc, not signals)
12:18 PM Lambda_Aurigae: usb power is 4.25 to 5.25 V
12:19 PM Lambda_Aurigae: nominally 5V but not always that high.
12:20 PM Emil: 4.75 I believe but not 4.25
12:21 PM cehteh: 4.75
12:22 PM Lambda_Aurigae: sorry... 4.40V according to the spec.
12:23 PM Emil: now that's pretty damn low
12:23 PM cehteh: oh ok
12:23 PM Emil: still
12:24 PM Lambda_Aurigae: hence the need for LDO regulator for 3.3V from the minimum 4.4V
12:25 PM Lambda_Aurigae: or a good switching regulator.
12:26 PM Emil: eh?
12:27 PM Lambda_Aurigae: voltage difference is too small for non-ldo regulator if it drops to 4.4V
12:29 PM Casper: Thing to remember for USB power: the psu itself is +/-5%, which give the 4.75V figure, add the cabling and connector loss and you can lose easilly another 5-10% or more
12:31 PM Emil: Well, it seems you are stuck on usb now :D
12:31 PM Emil: Whatever
12:31 PM Lambda_Aurigae: also, unless it is a charging port, normal usb ports only provide 100mA unless you request more via usb comms...then up to 500mA by spec...although some go to 1A or 2A...2A is usually charging ports.
12:31 PM Lambda_Aurigae: always!
12:32 PM Lambda_Aurigae: as for footprint for SPDT, depends on the switch.
12:34 PM Casper: >500mA is out of usb (data) specs and fall in the usb charging specs (which is constantly violated)
12:37 PM Lambda_Aurigae: yup
12:37 PM Lambda_Aurigae: I haven't read the usb-c spec yet.
12:37 PM Casper: seems scary
12:37 PM Lambda_Aurigae: and I hear there's another in the pipes too.
12:37 PM Casper: I hope there is double and triple redundancy on the voltage selection part...
12:38 PM Casper: seriously, usb 1 was a real botched job
12:38 PM Casper: should really have been 12V 1A
12:38 PM Lambda_Aurigae: rushed out.
12:38 PM Casper: not just rushed out, botched and ear plugging while singing lalalalalalala
12:39 PM Casper: the usb wasn't out yet and everyone was complaining about the lack of power
12:39 PM Lambda_Aurigae: kinda like our latest line of xerox copiers
12:39 PM Lambda_Aurigae: 29 new models.
12:39 PM Lambda_Aurigae: every one shipping with software that can physically damage the device.
12:39 PM Casper: seriously, a good chuck asked to boost the voltage to 12V, they said it was too late for that... ok fine, but then boost the current to 1A
12:39 PM Lambda_Aurigae: so, every one has to be updated before we can send them to the customer.
12:39 PM Casper: they claimed it was too complicated to change it... BS!
12:40 PM Casper: LOL
12:40 PM Lambda_Aurigae: I can see 5V....would rather have 9V....12V might be a bit high for anything I am doing.
12:40 PM Casper: how can that happend?!?
12:40 PM Lambda_Aurigae: but 5V regulated and stable would be better.
12:40 PM Lambda_Aurigae: it happened because they told everybody the machines were ready and shipped them.
12:40 PM Lambda_Aurigae: after the first round shipped, engineering came out and said, by the way, upgrade those or they will break themselves.
12:41 PM Lambda_Aurigae: a not uncommon state the machine can get in with a copy job and print job in the queue at the same time can cause it to try to run one of the motors backwards at the wrong time.
12:42 PM Lambda_Aurigae: xerox software testing is CRAP.
12:42 PM Casper: well, the idea was that 5V devices was common, and they wanted low power hence the 500mA... but really, the engineers wasn't thinking right... Firewire was already running out of power and is 12V 7W
12:43 PM Lambda_Aurigae: machine I'm standing in front of right now, since its release in 2013, has had 30 major software updates.
12:43 PM Casper: printers are so junk now...
12:44 PM Lambda_Aurigae: yup.
12:44 PM Casper: seriously, the hp we have here at work... ok, it's a customer grade one, but still, I find it crashed every month
12:44 PM Casper: power cycle mandatory
12:44 PM Lambda_Aurigae: this is a 45page per minute multi function device...fax, copy, scan, print
12:44 PM Casper: Another issue it have: a port scan freeze the printer
12:44 PM Lambda_Aurigae: and software upgrade takes an hour, minimum.
12:44 PM Lambda_Aurigae: yup
12:44 PM Casper: WHAT?
12:45 PM Lambda_Aurigae: this thing runs a full linux distro...
12:45 PM Casper: 1 hour to flash what? 2MB?
12:45 PM Casper: oh
12:45 PM Lambda_Aurigae: 485MB
12:45 PM Casper: ok then, 100MB
12:45 PM Lambda_Aurigae: iso file.
12:45 PM Casper: what?!?
12:45 PM Casper: what have they put in that?????
12:45 PM Casper: let me guess...
12:45 PM Lambda_Aurigae: part of that process is to encrypt 14 partitions on a 250GB harddrive.
12:45 PM Lambda_Aurigae: that 485MB includes images for at least 10 different FPGAs in the machine too.
12:45 PM Casper: it have a graphical touch screen
12:46 PM Lambda_Aurigae: yup.
12:46 PM Casper: so run Xfree
12:46 PM Lambda_Aurigae: the new ones have an android interface!
12:46 PM Casper: nice, can you install candy crush on it? :D
12:46 PM Casper: could be funny
12:47 PM Casper: "To print, win this level"
12:47 PM Lambda_Aurigae: hehe
12:47 PM Lambda_Aurigae: I have cracked it and gotten in.
12:48 PM Lambda_Aurigae: the thing boots and runs the os off of a 4GB sd card.
12:48 PM Casper: and let me guess, the encryption key is saved on that sd card
12:48 PM Lambda_Aurigae: which makes the boot process horridly slow..because they run it in SPI mode, not fast mode.
12:49 PM Lambda_Aurigae: better...I just put a user and password in the passwd file.
12:49 PM Lambda_Aurigae: then booted it up and connected to the diag serial port and logged in.
12:49 PM Lambda_Aurigae: the sd card isn't encrypted at all.
12:51 PM Casper: I mean, the hard disk that contain what I assume the print job and the history of the print jobs... the encryption key have to be stored or generated somehow
12:51 PM Casper: I bet that key is in the sd card, in plain text
12:52 PM Casper: meaning that anyone that get the hd and the sdcard can see what got printed
12:52 PM Casper: at worse, undelete/recover the print jobs
12:52 PM Lambda_Aurigae: part of the encryption comes from processor serial number.
12:53 PM Lambda_Aurigae: you change the processor board and the harddrive has to be wiped and reformatted and re-encrypted.
12:54 PM Casper: so a mathematical formula, so if you have access to the working unit you get confidential data out
12:56 PM Lambda_Aurigae: yup.
12:56 PM Lambda_Aurigae: physical security is needed.
12:57 PM Lambda_Aurigae: just like any computer really....although most computers that are properly secured require a password to access things...but even so, if a drive is encrypted on a server, if you have physical access you can get much the same kind of access because that encryption is based on something stored on the computer.
12:57 PM Lambda_Aurigae: ok...time to go on to the next job.
01:07 PM Casper: I want to go home and finish that patch panel
01:07 PM Casper: and install the chair rack...
01:14 PM danst: here's a cleaned up version of what I'm using to test serial https://pastebin.com/Bzfsej9w
01:15 PM danst: I have PD1 connected to Uno rx http://www.fibidi.com/wp-content/uploads/2012/06/attiny2313-pinout.jpg
01:19 PM danst: Uno is programmed as TinyISP and for flashing I use this connection uno[10,11,12,13] -> attiny[PA2, PB5, PB6, PB7]
01:19 PM NoHitWonder: why do you have UCSRB 2 times
01:20 PM NoHitWonder: UCSRB = _BV(RXEN) | _BV(TXEN); UCSRB = 0x08;
01:20 PM danst: I've commented out 0x08 but it's giving same result
01:20 PM NoHitWonder: ok
01:21 PM danst: for USART_Transmit("UUUUUUUUUU"); it outputs on serial [NAK]
01:21 PM danst: single nak
01:21 PM danst: on computer baud rate is set to 9600
01:26 PM NoHitWonder: and 8N1?
01:26 PM NoHitWonder: this is UCSRC = 0x86; 8N1?
01:27 PM danst: excuse me, what does 8N1 stand for?
01:28 PM NoHitWonder: 8 databits, No parity, 1 stop bit
01:29 PM Casper: for testing, 8n2 can help sometime, it add a second stop bit and help the receiver to resync
01:29 PM Casper: my fridge thermostat actually do 8n2, I don't have rx and I don't need much speed so I'm fine with the slightly slower speed
01:30 PM danst: how do you set it in code? It should be someregister = value I guess?
01:30 PM Casper: yes it's somewhere in the mode set
01:30 PM NoHitWonder: UCSRC is the register
01:31 PM NoHitWonder: UCSRC = (1 << UCSZ0)|(1 << UCSZ1);
01:31 PM NoHitWonder: but check your datasheet
01:36 PM danst: I flipped 3rd bit (USBS: Stop Bit Select) and got UCSRC = 0xA6; but it didn't affect the output
01:37 PM danst: and I'm sure program has been uploaded, I unplug rx wire from uno each time I upload
01:46 PM NoHitWonder: 0xA6 is 10100110 , are you sure that's right
01:47 PM NoHitWonder: and dont do it like that, use (1 << BIT) , its much more clear
02:38 PM polprog: heh
02:38 PM polprog: we did twi today
02:39 PM polprog: and it wasn't working (oddly receiving 0x00 all the time and ACKing) at the befinning
02:39 PM polprog: but it worked eventually, literally fixed itself when nobody was looking
02:40 PM polprog: we had no idea why it worked in the end
02:40 PM polprog: :o
02:41 PM remkooo1 is now known as remkooo
02:56 PM kvik: danst, that's better. and yes, use named bit shift and OR to set bits in registers, unless you enjoy pain. bit names should match those in the datasheet. as for your problem. you are passing a string of chars "UUUUUU" to a function that accepts a single (unsigned) char. your compiler should have warned you about it and you should never ignore those warnings, they almost always point to a hidden problem in your code.
04:56 PM Emil: https://emil.fi/jako/kuvat/2017-08-31_00-25-55_7GHM1jHk.png
04:56 PM Emil: BEHOLD
04:57 PM Emil: Shite has newer been shinier
04:57 PM polprog: i'd refuse to sign it with my name
04:58 PM Emil: Lol
04:59 PM Emil: polprog: I challenge thee
04:59 PM polprog: in other news, i had used this old cool meter
04:59 PM polprog: https://puu.sh/xnxJX/225bd0f207.jpg
04:59 PM Emil: Design a super quick Raspberry Pi IoT project
04:59 PM Emil: In a few hours
05:00 PM polprog: it has auto-ranging, logic probe, and the guy said the software came on a 5 ich floppy
05:00 PM Emil: How does that make it better than currently manufactured?
05:00 PM polprog: super quick raspi project?
05:00 PM polprog: tomorrow
05:00 PM Emil: polprog: IoT
05:00 PM polprog: i like the design
05:00 PM polprog: it looks solid
05:00 PM Emil: Of mine?
05:00 PM polprog: of the meter
05:00 PM Emil: Ah
05:01 PM polprog: yours not that bad, it can be seen it was done in a hurry
05:02 PM Emil: The schematic side is fine and the routing is now half bad. It's designed so that I can DIY it
05:02 PM Emil: If I could have had it fabbed come on :D
05:02 PM Emil: It would have been pretty damn kawaii
05:03 PM Emil: s/now/not
05:03 PM Emil: I actually took time to route the necessary components quite carefully
05:03 PM Emil: They are not just randomly placed
05:03 PM Emil: But here https://emil.fi/jako/kuvat/2017-08-31_00-32-44_bVFXZpU5.png you can see when I ran out of fucks to give :D
05:04 PM Emil: Like I could have used two 0 ohms to who has time for that :D
05:05 PM Emil: It also only uses a single type of resistor
05:05 PM Emil: And a single type of capacitor (without taking into account the crystal and led caps)
05:06 PM Emil: So DESIGNED FOR MANUFACTURABILITY
05:06 PM Emil: I also avoided drilling like there's no tomorrow
05:06 PM polprog: isnt raspi itself IoT
05:07 PM Emil: It can be
05:07 PM Emil: but I wanted to make my life easier and have the right to call it a project
05:07 PM Emil: Because now the software side can be super simply
05:07 PM Emil: And it features "embedded programming"
05:07 PM Emil: Which is what the course also suggested
05:07 PM polprog: what am i looking at in the last pic, some via
05:08 PM Emil: Bigger pic https://emil.fi/jako/kuvat/2017-08-31_00-37-13_KJKxcNlu.png
05:08 PM Emil: I ran out of fucks routing it out of there
05:08 PM Emil: It's not physically possible
05:08 PM polprog: lol
05:08 PM polprog: you now have to put a bodgewire
05:09 PM Emil: I mean, I could have used one of the unused pins and disconnected one of the power traces and and and :D
05:09 PM Emil: polprog: I know
05:09 PM polprog: are you doing this 2 sided i think not
05:09 PM Emil: polprog: I care but not enough :D
05:09 PM polprog: lol
05:09 PM polprog: well
05:09 PM Emil: polprog: one sided
05:09 PM polprog: gotta be setting up the audio gear tomorrow
05:09 PM Emil: Making it double side is easy
05:09 PM Emil: but I can't be bothered with aligning the layeres
05:09 PM Emil: layers*
05:09 PM polprog: so goodnight
05:09 PM Emil: Night
05:10 PM polprog: never did homemade 2 sided
05:10 PM Emil: It's easy, just takes a bit more time
05:27 PM Emil: And then I didn't run out of fucks
05:27 PM Emil: https://emil.fi/jako/kuvat/2017-08-31_00-56-39_aj2WXZb1.png
05:27 PM Emil: Took two 0 ohms but eh
05:27 PM Emil: whatever
07:45 PM enh: hi
09:48 PM enh: Everybody all right? Did it stop raining over TX?
09:49 PM enh: No more missiles over Japan?
11:49 PM day_ is now known as daey