#avr | Logs for 2016-02-03

Back
[01:14:23] <WormFood> I'm learning about the 8051, and I remember why I didn't learn Intel systems so many years ago. This is just as wacky as I expected it to be. Have to clear the carry bit, before doing a subtraction, because it doesn't support a normal subtract instruction. What are you guy's objective opinions on the 8051, as compared to a basic AVR?
[01:16:35] <cehteh> 8051 is CISC or?
[01:16:50] <WormFood> yeah
[01:17:12] <cehteh> everything i seen so far was irky
[01:17:20] <WormFood> It's oooold intel. Was used as the keyboard controller, inside the keyboards
[01:17:20] <cehteh> i dont like it, but never used it
[01:17:24] <cehteh> yes
[01:17:35] <WormFood> I mean, inside the original PC
[01:17:36] <cehteh> stil its in soooooo many product
[01:17:49] <WormFood> And still being actively developed
[01:17:56] <WormFood> I mean, by other companies.
[01:18:05] <cehteh> many usb things, sd cards, someone hinted that ftdi serial/usb chips are also 8051 under the hood
[01:18:31] <WormFood> And I'm not getting why in the fuck are they using this shit, when other, better stuff is out there.
[01:18:38] <cehteh> but only sdcc as fee compiler available which isnt that great
[01:19:28] <WormFood> I really don't understand why people haven't run screaming from Intel.
[01:19:30] <cehteh> the old-fart developers are used to it and they certainly have a lot workflows for that already
[01:19:37] <cehteh> libs, designs
[01:20:11] <WormFood> AVR asm was a breeze for me to learn. Quick and easy.
[01:20:44] <cehteh> even z80 is nice
[01:21:06] <cehteh> but everything intel does is somewhat wtf
[01:21:11] <WormFood> I'm still just trying to undersand the architecture of the 8051. It's got 3 address spaces? It's not clear to me, what exactly is going on with their wacky intel memory space.
[01:21:32] <cehteh> and decades of legacy support and extensions put more wtf on it
[01:21:33] <WormFood> I learned asm on the Motorola 6809
[01:21:45] <WormFood> The 6809 is a really nice CPU
[01:21:52] <cehteh> i never seriously used asm
[01:22:04] <cehteh> learned a bit on 68k back the time
[01:22:13] <cehteh> which was nice too
[01:22:14] <WormFood> I've written quite a bit of 6805/ST7 asm code
[01:22:23] <WormFood> I've written 68k code too
[01:22:30] <cehteh> compared to intel asm 68k is a high level language
[01:23:15] <WormFood> In fact, I wrote a Desktop Animator flicker (.fli) format video viewer, in 1/2 C, and 1/2 68k asm. I remember pushing 2 bytes on the stack, and popping off a word, to do a byte swap (my friend taught me that trick)
[01:23:58] <WormFood> I have a friend, that not only wrote the "bios" for his 68k computer, but he also wrote the whole freakin' OS, and tools, utilities, etc, all in ASM!
[01:26:48] <WormFood> He wrote his own 56 or something digit math libraries, to do precision math for him. And, of course wrote his own software to balance his checkbook. He found a flaw in how they (the banks in the area) were calculating interest.
[03:51:10] <felixphew> This is really starting to annoy me
[03:51:38] <felixphew> I'm trying to use TC2 on an atmega328 to make a real-time (ish) clock
[03:51:43] <felixphew> but it isn't working :(
[03:51:44] <felixphew> https://gist.github.com/felixphew/4c700db4ee36fd218608
[03:52:18] <felixphew> Can you see any obvious issues?
[03:59:55] <Lambda_Aurigae> nothing glaring jumps out at me.
[04:00:10] <Lambda_Aurigae> you do have a crystal on the tc2 inputs, yes?
[04:03:06] <Lambda_Aurigae> WormFood, I still use 8052 chips these days...not 8051 but the more modern 8052 with the high speed single clock core.
[04:03:43] <Lambda_Aurigae> it was the only microcontroller I could find that had an external memory interface for program and data in a dip package.
[06:30:32] <lorenzo> http://cdn.instructables.com/FKP/MAA2/HH2VJNW1/FKPMAA2HH2VJNW1.MEDIUM.jpg
[06:30:37] <lorenzo> just got one of these :D
[06:30:41] <lorenzo> still trying to think of a project
[06:34:15] <nuxil> :)
[06:39:09] <Lambda_Aurigae> voltage regulator but no crystal that I can see there lorenzo
[06:40:04] <nuxil> Does he need that?
[06:41:18] <Lambda_Aurigae> nuxil, depends on what he is going to use it for.
[06:41:25] <nuxil> can you wxplain to me the point with these small usb boards. i dont reaaly get it.
[06:41:31] <nuxil> *explain
[06:41:44] <Lambda_Aurigae> the attiny85 can run v-usb without a crystal by using the clock pll to sync to the usb clock.
[06:42:01] <Lambda_Aurigae> well, you could build a usbasp type programmer from it.
[06:42:09] <Lambda_Aurigae> or a usb data logger
[06:42:11] <nuxil> i mean. if you want to program a 85 or other ships. dont you want a dip socket on it.
[06:42:22] <nuxil> ?
[06:42:36] <Lambda_Aurigae> that's not exactly a programmer board.
[06:42:42] <Lambda_Aurigae> just an attiny85 dev board.
[06:42:49] <nuxil> i see.
[06:42:59] <Lambda_Aurigae> you can power it from usb and do whatever.
[06:43:13] <Lambda_Aurigae> if you want to talk over usb you can use v-usb on the attiny85.
[06:43:14] <nikomo> I made a devboard for attiny85 but I forgot to order it. Should probably do it today.
[06:43:30] <Lambda_Aurigae> it doesn't have hardware usb so you have to use v-usb to bitbang it.
[06:43:41] <Lambda_Aurigae> limited but functional.
[06:43:52] <nuxil> ok.
[06:44:16] <Lambda_Aurigae> depending on the hardware connections to the usb, it may or may not work with different usb hosts.
[10:46:13] <nuxil> http://en.1jux.net/419068 :p
[11:59:14] <Drzacek> Hi. What is the maximum number of buttons I can connect to Attiny85? 6?
[11:59:58] <LeoNerd> The maximum number /you/ can connect?
[12:00:08] <Tom_itx> how many shift registers do you want to use?
[12:00:18] <LeoNerd> I could probably manage to connect about 300, though that would depend on getting some very good resistors
[12:00:37] <LeoNerd> Connect multiple in an R/2R divider chain on each ADC pin
[12:01:03] <LeoNerd> Theoretically you could distinguish 1024 states per ADC pin, so a total of .. er.. just over 6 thousand. But in practice you'll get a bit of noise, and resistors are never that accurate
[12:01:34] <LeoNerd> In practice, I have easily done 4 or 6 buttons on a single ADC pin this way
[12:02:58] <Drzacek> without any shift registers or additional hardware. it's a minimal project
[12:03:13] <LeoNerd> Do you count resistors as "additional hardware" ?
[12:03:53] <Drzacek> LeoNerd, If you mean those resistor values that I don't actually posses, then yes :)
[12:03:55] <Jartza> I'd count buttons as additional hardware if resistors count :D
[12:04:13] <LeoNerd> Yah I'm struggling to see the real question here
[12:04:15] <Drzacek> Jartza, hell, I also need buttons?!
[12:04:44] <LeoNerd> Given -only- buttons and the 'tiny85, you can read a maximum of 9 buttons. 6 GPIO pins, arrange them in a 3x3 grid.
[12:04:56] <LeoNerd> That does not let you do multitouch, and it doesn't give you any *other* IO pins to actually communicate your results ;)
[12:05:59] <Drzacek> LeoNerd, thank you.
[12:06:13] <LeoNerd> Add diodes and you've got multitouch
[12:06:31] <LeoNerd> But that still suffers not being able to talk to the outside world
[12:06:32] <Drzacek> don't need multitouch
[12:06:58] <LeoNerd> But presumably you do need to talk to the outside world.. otherwise what's the point of reading buttons?
[12:08:01] <Jartza> if the question is, how many IO-pins attiny85 has, answer is 6... if you disable reset, which means you need HVSP programmer instead of ISP
[12:08:11] <LeoNerd> Yus
[12:08:56] <Drzacek> Jartza, perhaps I should ask THIS question. So, whats with this reset thing
[12:08:57] <Jartza> and without HVSP, the answer is 5
[12:09:11] <LeoNerd> Mmm?
[12:09:29] <Jartza> Drzacek: one pin acts as reset. it's used to reset the MCU, and also it's used to signal start of chip programming
[12:09:42] <Jartza> if you disable reset, you can use it as IO-pin
[12:09:53] <Jartza> but then the only way to reflash the chip is to use high voltage serial programmer
[12:10:23] <LeoNerd> I still think Atmel only call it "high-voltage" to scare people away
[12:10:27] <LeoNerd> It's only 12V
[12:10:34] <Jartza> yea
[12:10:35] <martinus> I really should revisit the AVRFreaks thread on the "correct" way to reset an AVR.
[12:10:43] <Jartza> but still, it's higher than normal 1.8-5V :)
[12:10:59] * LeoNerd often works on long LED chains with 24V rails
[12:11:15] <Drzacek> Jartza, since I don't have that special programmer, I guess I'll stick with 5 GPIO
[12:11:21] <Jartza> wise choise :)
[12:12:35] <Drzacek> Jartza, and since I need one pin as output, that leaves me 4 gpio. hmm, in that case I think I have to reconsider "additional hardware"
[12:13:02] <LeoNerd> Or your chip choice
[12:13:11] <Jartza> 3 of those pins can act as ADC, yes.
[12:13:13] <LeoNerd> The ATtiny84 is a 14 pin package, so 11 (or 12) GPIO pins
[12:13:33] <Jartza> just connect different buttons via different resistor values and you can use ADC to tell between buttons
[12:13:41] <LeoNerd> tiny84 is usually my tiny of choice, because the tiny85 is just *too* small for almost anything I might do
[12:13:46] <Jartza> yeah, attiny84 is very nice too
[12:14:04] <Jartza> LeoNerd: which is exactly the reason why I like attiny85 :)
[12:14:12] <Jartza> it's too small for anything people "normally" do :)
[12:14:14] <Drzacek> LeoNerd, I think for this project 85 is fine. I want to keep it minimalistic
[12:14:17] <LeoNerd> And if you need anything fancier, the tiny841 is pinwise compatible, much more powerful... has UARTs
[12:14:54] <Jartza> and attiny85 is still quite a powerhouse actually
[12:16:23] <Drzacek> LeoNerd, one can always find "fancier" chip. But smaller == better
[12:16:28] <LeoNerd> Is it?
[12:16:46] <LeoNerd> If you have to then add additional peripheral hardware on a smaller chip, that might not be worth it
[12:16:57] <Drzacek> my tv used to be 20x as thick
[12:17:00] <LeoNerd> One new project of mine I'm using an ATmega128 with its huuuuge 53 IO pins.
[12:17:16] <LeoNerd> I *could* have used a smaller one, like a mega328, along with an LED matrix driver, and some GPIOexpanders, or something
[12:17:18] <Drzacek> LeoNerd, I'm using arduino for other projects
[12:17:27] <LeoNerd> But that would be worse. because now it's 3 chips. This is one chip
[12:18:27] <LeoNerd> Also now I get to drive my LED matrix directly, so I can do fancier things the MAX7219 can't. Like PWM, or bicolour
[12:19:16] <Drzacek> It might have something to do that I got some 85 for cheap
[12:25:56] <Drzacek> Isn't shift registers only for output?
[12:26:46] <LeoNerd> Not necessarily
[12:26:56] <LeoNerd> S-to-P (like 74'595) are useful for output
[12:27:24] <LeoNerd> P-to-S (e.g. 74'165) are useful for input. Though not *that* useful I find as I've still yet to find a *single* P-to-S SR from anyone, anywhere, that is SPI-like
[12:28:29] <LeoNerd> But yeah; why bother with an ATtiny85 + shift register just for reading some IO lines, when you could use a bigger chip like a tiny84, or even a tiny88...?
[12:35:40] <Drzacek> I need at least 5 buttons - AtTINY85 STAYS! What are my options, which one is best?
[12:36:02] <LeoNerd> "best" is subjective
[12:36:19] <LeoNerd> You said you don't need multitouch, so I'd say that sounds like a resistor divider chain on an ADC pin
[12:36:26] <LeoNerd> 5 buttons should be well within tolerance of that
[12:52:10] <Jartza> and selecting the resistor values wisely, multitouch is even possible
[12:52:34] <LeoNerd> Mm... can be. Depends on the arrangement
[12:53:24] <LeoNerd> Usually I make a resistor divider chain of equal values (saving on BOM) between Vcc and ground, use buttons to bridge each point separately to ground, and measure the voltage at the topmost resistor tap
[12:53:42] <LeoNerd> So that won't do multitouch, as the "longest" bridging button takes precedence. Which can be useful
[12:57:40] <Jartza> yea
[13:00:56] <LeoNerd> I haven't yet worked out how to do multitouch with a single resistor value, anyway
[13:01:06] <LeoNerd> Various ideas of mine just seem to have annoying properties
[13:01:41] <Jartza> but using two resistors with each button (voltage divider) it's quite easy to also arrange them so that you can read "any combination" of them
[13:01:45] <LeoNerd> There's *a* good way to do it with an R/2R divider chain like you'd use on a flashDAC, but that requires SPCO buttons that can switch VCC to Ground
[13:02:07] <LeoNerd> How's that work?
[13:02:08] <Jartza> there's a microchip "tips and tricks" document from 80's demostrating that :)
[13:02:22] <LeoNerd> Hm.. linky?
[13:44:55] <Jartza> LeoNerd: I'm currently ircing with my phone, but I'll try to remember it when I get home
[13:45:22] <Jartza> should be googleable with "microchip tips and tricks"
[13:47:04] <Jartza> iirc the tip allowed to read 4x4 matrix with adc
[13:48:34] <LeoNerd> Jartza: Heh; me too. ;) (phone I mean)
[14:10:58] <Alex1992> Hi, I have a question about uploading code to the avr. AVRdude says it has successfully uploaded code to the atmega, but the code itself is not working on the chip. When I probe most outputs, there is no voltage. There are two rapidly blinking status LEDs though.
[14:11:44] <LeoNerd> What kind of ATmega?
[14:12:02] <Alex1992> Unfortunately, I just have the test .hex file, and not the source code so I can't see what these status LEDs are supposed to mean. I was wondering if you guys had any idea why this might happen? I've checked for a hanging RESET, but Idk what else it could be
[14:12:12] <Alex1992> Leo: it's an atmega32
[14:13:33] <sebus> Alex1992 JTAG port used or not?
[14:14:03] <sebus> disable jtag fuse if you have I/O stuff on it.
[14:14:36] <Alex1992> sebus: I'm pretty new to microcontrollers, but I think the answer is no.
[14:14:39] <Alex1992> avrdude -c usbtiny -p m32 -U lfuse:w:0b11101111:m
[14:14:39] <Alex1992> avrdude -c usbtiny -p m32 -U hfuse:w:0b11001001:m
[14:15:05] <Alex1992> I ran these fuse changes a while ago, I think one is JTAG disable and the other is an external clock change
[14:15:45] <Alex1992> I've flashed this atmega to run a 4x4x4 cube, now I'm hoping to use the same chip for the 8x8x8, just with different code of course
[14:16:11] <Alex1992> So it's output stuff before with different code, it's just not workign right now for some reason
[14:16:52] <sebus> tdi, tdo, tms, tck are on port c (pins 24-27); most questions are about why they don't work and jtag fuse is the answer
[14:18:57] <Alex1992> sebus: ok, that's definitely good information to know, thanks. Just so I understand, this would not be an issue for my current output scenario? Since I have done the JTAG disable?
[14:21:16] <sebus> looks like
[14:21:26] <sebus> so you have only .hex?
[14:22:29] <sebus> so I see you got 0xEF and 0xC9 fuses [ -U lfuse:w:0xef:m -U hfuse:w:0xc9:m ]
[14:22:38] <Alex1992> yeah, unfortunately. I'm new with embedded systems, so I wanted to avoid making my own code to test for a bit, so that I am reducing uncertainty of where it's the hardware or my code screwing up
[14:22:40] <sebus> humm nothing special
[14:23:01] <Alex1992> whether it's*
[14:24:29] <sebus> best way to test i/o is just make ports as output and count up 8 bit value to fill every I/O
[14:24:48] <sebus> doing 0..255 will trigger every pin
[14:25:14] <sebus> gimme that hex
[14:25:19] <sebus> lemme disassemble it
[14:26:13] <Alex1992> sure, I downloaded it from here: http://www.instructables.com/id/Led-Cube-8x8x8/step46/Program-the-AVR-with-test-code/
[14:26:23] <Alex1992> thanks for looking at it
[14:29:58] <Alex1992> If you could send me the disassembled version, or point me to a program where I could do that, that'd be great
[14:30:12] <Alex1992> I'd really like to know what condition the two status LEDs blink on
[14:30:16] <sebus> you want listing?
[14:30:19] <sebus> its assembly
[14:31:43] <Alex1992> Oh, shit. I guess I figured you could get it back to the C language format, but I'm realizing that is probably not likely
[14:31:57] <sebus> Alex1992 nope, but here you go http://s7.fmdx.pl/test_hex_disasm.txt
[14:31:58] <sebus> :D
[14:32:55] <Alex1992> oh boy...
[14:33:08] <sebus> go to L32:
[14:33:20] <sebus> LDI R25, $FF = 255
[14:33:33] <sebus> OUT DDRA,R25 = port A is ouptut on every pin
[14:34:11] <sebus> DDRB, DDRC, and DDRD got bitmask 0xEF on output
[14:34:52] <Alex1992> ok, so port A should be all output
[14:34:57] <sebus> ye
[14:35:18] <Alex1992> but when I probe the port A pins with a DMM, I don't get any voltage
[14:35:26] <sebus> low on start
[14:35:48] <sebus> probe PD3
[14:35:59] <sebus> it should be high
[14:36:52] <Alex1992> yup pd2 and pd3 are high
[14:37:04] <Alex1992> they also are the lines connected to the flashing LEDs
[14:37:47] <sebus> geez download schematics in pdf
[14:37:50] <sebus> sign in...
[14:37:51] <sebus> meh
[14:38:18] <Alex1992> pardon?
[14:38:26] <sebus> ah, ok failed
[14:38:41] * sebus running on links browser
[14:39:03] <sebus> lots of latches and decoder
[14:40:45] <Alex1992> yeah, I'm using a 74hc573(state trig) instead of 74hc574 (edge trig), but I figured that I could just change the C code later to accomodate for that. I thought I should be at least seeing the A0-A7 lines changing voltage value
[14:41:48] <sebus> okay
[14:41:54] <sebus> there's source files
[14:42:06] <sebus> ledcube_8x8x8-v0.1.2.tar.gz
[14:42:29] <sebus> get a 7zip if you're using windows
[14:43:41] <Alex1992> ok, I have 7zip, I extracted and now have a folder ledcube.tar
[14:43:50] <sebus> open it again
[14:43:51] <sebus> :D
[14:43:55] <sebus> tarball gzipped
[14:44:00] <Alex1992> my god..
[14:44:01] <sebus> linux way
[14:44:34] <Alex1992> ok, I've got an actual folder with files in it!
[14:44:56] <Alex1992> So i'll upload the main now
[14:45:06] <Alex1992> will i also be flashing eeprom?
[14:47:12] <sebus> no use of eeprom in this code
[14:49:25] <sebus> look in main.c
[14:49:41] <sebus> and read header files
[14:57:25] <sebus> press a button Alex1992 after reset / power up
[14:57:32] <sebus> to set it to serial mode or auto mode
[15:10:05] <felixphew> This is really starting to annoy me
[15:10:05] <felixphew> I'm trying to use TC2 on an atmega328 to make a real-time (ish) clock
[15:10:06] <felixphew> but it isn't working :(
[15:10:06] <felixphew> https://gist.github.com/felixphew/4c700db4ee36fd218608
[15:16:56] <LeoNerd> What timer sources are you using?
[15:17:21] <LeoNerd> If you're hoping to get an RTC by putting a 32kHz xtal on the TOSC1/2 pins, don't forget on an m328 they're shared with the main XTAL1/2 pins
[15:17:27] <LeoNerd> So you need to fuse it appropriately... i.e. internal osc.
[16:02:24] <julius> hi
[18:19:14] <LeoNerd> How is it that you can buy dual or quad or more I²C/SPI ADCs really cheaply, but it seems almost impossible to get more than single-channel DACs?
[18:19:41] <Lambda_Aurigae> LeoNerd, because.
[18:20:56] <Casper> LeoNerd: because usually ADC input have a switch for the different inputs, while the dac can't do that easilly
[18:21:39] <LeoNerd> Hrmmmm
[18:21:54] <LeoNerd> OK that's a fair point.. I guess these "dual" ADCs are really just one ADC with a mux on the input
[18:22:04] <LeoNerd> Harder to find genuinely-dual ADCs
[18:22:06] <Lambda_Aurigae> sure you can...analog 1-of-8 selector.
[18:22:44] <Lambda_Aurigae> but having the DAC output constant on all the outputs...difficulter.
[18:23:01] <LeoNerd> Yah