#avr | Logs for 2015-03-04

Back
[00:00:58] <vsync_> let's see how this saleae clone does
[00:01:30] <vsync_> LeoNerd was right, the test clips are absolutely terrible
[00:02:35] <Casper> hmmm I have a bit less speed than expected...
[00:02:43] <Casper> 16MHz instead of 20MHz
[00:03:32] <rue_bed> overclock i
[00:03:34] <rue_bed> t
[00:04:44] <Casper> rue_bed: that's something I'm considering if I need it to be, but I don't think I need more than 16MHz
[00:05:07] <Casper> at 20MHz it give me 1000 cycles to do a few if
[00:05:21] <Casper> that probably complete in like 50 cycles
[00:05:47] * Casper wonders how long a shift take on a 32 bits int...
[00:06:00] <rue_bed> 4 cycles
[00:06:06] <rue_bed> if done right
[00:07:08] <Casper> more than that no? shift 31-24 shift 23-16, add cary to 24, .....
[00:07:51] <Casper> hmm can't you change the clock source in software?
[01:53:30] <vsync_> the clone seems to work alright
[02:49:52] <JoeLlama> moo Tachyon`
[02:49:57] <malinus> Casper: you can't burn the fuses from software, no.
[02:50:08] <Tachyon`> hey ;p
[05:00:07] <Tekkkz> Hello!
[05:00:12] <twnqx> moin
[05:00:47] <Tekkkz> Is my code ( http://ix.io/gIs ) correct to run the timer0 with a frequency of 40kHz (my clk=16MHz) and to auto-toggle PD6 ?
[05:02:22] <Fleck> heh
[05:02:46] <Fleck> you think we are compilators/simulators :D ? btw AVR device?
[05:03:28] <Tekkkz> no
[05:03:32] <Tekkkz> but it doesnt work at me
[05:03:42] <Tekkkz> but i think i setup it right
[05:05:41] <Tekkkz> it compiles
[05:05:58] <Tekkkz> but my oscilloscope doenst get any value
[05:09:09] <Fleck> ok avr device?
[05:09:21] <Tekkkz> atmega328p
[05:09:31] <Fleck> ok, wait
[05:10:07] <Tekkkz> thx for your help
[05:11:18] <Fleck> there is no CS01 in TCCR0A btw...
[05:11:48] <Fleck> its in TCCR0B
[05:11:56] <Tekkkz> oh
[05:11:57] <Fleck> fix that, try again, let me know!
[05:12:23] <Tekkkz> but how do i set up the speed then?
[05:12:45] <Fleck> TCCR0B = _BV(CS01);
[05:12:56] <Fleck> and remove that part from TCCR0A
[05:15:05] <Tekkkz> okay
[05:15:08] <Tekkkz> thx, ill try it
[05:16:10] <Tekkkz> thanks works
[05:16:16] <Tekkkz> was a beginners mistake i think
[05:16:21] <Tekkkz> thank you, bye bye
[05:16:53] <Fleck> take care!
[05:17:00] <Tekkkz> ?
[05:17:06] <Fleck> ?
[05:17:52] <Fleck> "take care" is a way to say goodbye :D
[05:17:52] <Tekkkz> what do you mean with "Take care!" ?
[05:18:58] <Fleck> http://www.urbandictionary.com/define.php?term=Take+care
[05:19:06] <Tekkkz> ahh ok, bye
[05:19:10] <Fleck> ;)
[05:19:19] <Fleck> funny ppl! :)
[05:19:30] <InfiRandia> :P
[05:42:47] * InfiRandia is saying hai to everyone because she's kinda new here ^^
[05:43:01] <Fleck> hello
[05:47:38] <theBear> and i never talk here, in contrast to my usual nonsense, so err, hai everyone ;-]
[05:48:06] <InfiRandia> heh
[07:06:27] <Lambda_Aurigae> morning humanish type beings.
[07:06:39] <Lambda_Aurigae> and rue_more
[07:07:52] <InfiRandia> Morning Lambda_Aurigae, for me it's almost 2pm though xD
[07:08:38] <Lambda_Aurigae> almost 7am here.
[07:14:41] <Lambda_Aurigae> Casper, you can not change clock source but you can change clock prescaler on the fly in software.
[07:15:16] <Lambda_Aurigae> so you could be running from a 16MHz crystal and shift your prescaler up to as much as divide by 256.
[07:15:55] <Lambda_Aurigae> the ckdiv8 fuse actually just sets the prescaler to 8 on bootup.
[07:16:13] <Lambda_Aurigae> once the chip is running you can change that no matter the setting of ckdiv8 fuse.
[07:19:54] <Lambda_Aurigae> I once used that to run an atmega1284p at 20MHz while driving it with a 40MHz crystal so I could have a 40MHz output on the CLK0 pin for driving other things.
[07:20:32] <Lambda_Aurigae> but it didn't work
[07:20:43] <Lambda_Aurigae> as it is the prescaled clock that gets output.
[07:20:55] <Lambda_Aurigae> I was hoping it was the full clock but I didn't read the datasheet completely.
[07:21:27] <Lambda_Aurigae> so had to switch to an external 40MHz oscillator to drive everything.
[07:29:22] <LeoNerd> 40MHz? Wow, such heady heights
[07:29:29] <Lambda_Aurigae> yeah.
[07:29:35] <Lambda_Aurigae> needed that for 800x600 VGA generation.
[07:29:46] <Lambda_Aurigae> the AVR would only run at 20MHz though.
[07:30:10] <Lambda_Aurigae> I did get the atmega1284p to run stable at 25MHz at one point.
[07:30:56] <Lambda_Aurigae> with the older atmega32 I was able to overclock to 20MHz but ADC didn't work for squat.
[07:32:56] <specing> buy a $30 FPGA and load an AVR core on it. It will run at like 200 MHz and you can create your own peripherals
[07:33:06] <specing> problem solved
[07:33:16] <Lambda_Aurigae> must learn vhdl or verilog for that.
[07:33:29] <Lambda_Aurigae> I'm creating my own peripherals with other chips.
[07:33:46] <Lambda_Aurigae> someday I'll get into FPGA work.
[07:33:53] <specing> right now Im doing tetris in VHDL
[07:33:59] <Lambda_Aurigae> lately I've been digging into pic32 chips.
[07:34:25] <Lambda_Aurigae> just got a stack of pic32mx270f256b chips..
[07:34:25] <specing> pls dont
[07:34:32] <specing> get stm32 instead
[07:34:33] <Lambda_Aurigae> mips core...not pic core.
[07:34:38] <specing> oh
[07:34:41] <Lambda_Aurigae> stm32 doesn't come in a dip package.
[07:35:14] <Lambda_Aurigae> this chip is a 28 pin dip package with 256K flash, 64K sram, usb otg/host/device, and runs at 50MHz.
[07:35:57] <Lambda_Aurigae> pushes 83DMIPS
[07:36:13] <Lambda_Aurigae> it's not AVR, but it is a nice little chip.
[07:36:50] <specing> nice
[07:36:56] <specing> MIPS is nice
[07:37:00] <Lambda_Aurigae> and it can run code from it's internal flash and sram.
[07:37:15] <specing> we did MIPS at school (a derivative processor the professor made)
[07:37:33] <Lambda_Aurigae> I can load a mini-os like the c64 into flash.
[07:37:42] <Lambda_Aurigae> and run programs either interpreted or native code from sram.
[07:39:59] <Lambda_Aurigae> and, once I figure out how, I believe I can run the USB full speed connection without a crystal! it has a pll as part of the clock system for syncing to the usb clock.
[07:40:20] <Lambda_Aurigae> kinda like the attiny85 does with vusb software.
[07:42:46] <Lambda_Aurigae> ok..time for to go to worky.
[07:42:47] <Lambda_Aurigae> laters.
[08:28:16] <InfiRandia> I really have to ask, regarding Attiny13a, I'm trying to make a simple PMW on both OCR0A and OCR0B to simulate two dimming eyes. The thing is.. I can set both before loop without issues, but I cannot increase them both at the same time in loop. Doing so with just one of them is working perfectly.
[08:30:47] <InfiRandia> Both pins will just output somewhat flicker
[08:44:49] <InfiRandia> Example on the code I'm using, http://pastebin.com/adtWcGHQ
[08:50:25] <EI24> Hi, im using avrdude in terminal mode. I try to write to flash, but get "error while writing 0x08 at 0x00000 cell=0xff". Though it works fine to write to eeprom
[08:50:28] <EI24> .
[09:18:46] <rue_more> Lambda_Aurigae, morning
[09:36:04] <InfiRandia> Oh, I fixed it xD, OCR0B must always be beneath TOP, in this case beneath OCR0A. So by setting OCR0A one step ahead of OCR0B fixes the problem. :)
[09:37:01] <InfiRandia> Read it on avrfreaks, http://www.avrfreaks.net/forum/ocr0a-influence-ocr0b-atmega48
[09:40:31] <InfiRandia> The strange thing is though that I am using 0xFF as top with WGM01 and WGM00 as 1 only. Well well, it's working now :)
[10:52:30] <Elec_A> Hello , I have connected a LCD to an AVR, I have connected 4 bits of PORTA and 4 bits of PORTB to LCD data bus, is it possible to define a variable to easily put data on data bus ?
[10:53:13] <Elec_A> I mean like (#define LCD_DATA 4bitsof(PORTA) + 4bitsof(PORTB))
[10:53:23] <LeoNerd> Not really. I'd do that with a function
[10:53:34] <LeoNerd> void lcd_putdata(uint8_t d) { ... }
[10:54:05] <LeoNerd> Or try to rewire things so you can use an entire 8bit port
[10:54:15] <Elec_A> how do you separate 4bits of a uint8_t
[10:54:26] <LeoNerd> Surely, bitwise operations?
[10:54:32] <Elec_A> oh yes
[10:54:33] <Elec_A> ok ok
[10:54:40] <LeoNerd> (d & 0x0f) will be the lower four; (d >> 4) & 0x0f will be the upper four
[10:55:40] <Elec_A> LeoNerd: is it PORTA = (d & 0x0f) correct ?
[10:56:06] <Elec_A> or i have to use PORTA |= (d & 0x0f) ?
[10:56:52] <Elec_A> i don't want to change high 4 bit of PORTA
[10:57:42] <LeoNerd> Neither.
[10:57:59] <LeoNerd> The first one will trash the other bits you didn't intend to modify; the latter will not clear any set bits in the lower four
[10:58:10] <LeoNerd> PORTA = (PORTA & 0xf0) | (d & 0x0f);
[10:59:08] <Elec_A> Thank you ! and i think it should be PORTA = (PINA & 0xf0) | (d & 0x0f);
[10:59:10] <Elec_A> ;)
[10:59:27] <LeoNerd> No, because that will read the inputs
[10:59:41] <LeoNerd> Reading from PORTA will remind your program what output values it intends to be sending out
[11:00:08] <LeoNerd> You can always read a PORTx register; that just reads back the value you previously wrote there
[11:00:35] <Elec_A> what PINx will return ?
[11:00:50] <LeoNerd> The values it is reading from the input side of the logic
[11:01:27] <LeoNerd> These bits _might_ match, but only on those pins where you have the output driver enabled (via DDRx)
[11:02:00] <Elec_A> aha , then if DDR is 1 then i have to use PORTx and if DDR is 0 , i must use PINx ?
[11:02:21] <LeoNerd> E.g. if you were intending to output 1 on pin 7, but didn't have the corresponding bit set in DDR, then reading from PORTx will remind you of that 1, but because the output isn't electrically enabled, the pin isn't driven high, so reading PINx won't see that
[11:02:28] <LeoNerd> No; you always want to read PORTx in this case
[11:02:40] <LeoNerd> The reason you're reading it, is to remind you of the other bits you don't want to modify
[11:02:59] <LeoNerd> (PORTA & 0xf0) <== reminds you what the current values are in the top four bits, so that when you write that out later on, you don't trash their current values
[11:03:44] <Elec_A> LeoNerd: thank you , I understand .
[15:15:59] <Fleck> anyone have ever tried to multiplex uart?
[15:16:09] <Jartza> multiplex how?
[15:16:34] <Fleck> like use single uart peripheral to communicate with more thone one device
[15:17:01] <megal0maniac> It's low speed, pretty sure it's easy to do
[15:17:20] <Jartza> Fleck: tx only or tx/rx?
[15:17:27] <Fleck> tx/rx
[15:17:39] <Fleck> but one device at a time
[15:17:44] <Jartza> mmkay
[15:18:09] <Jartza> shouldn't be that hard :)
[15:18:41] <Fleck> I understand principle, and could solder it, but, just wondering, if someone has done it before :D
[15:19:03] <LeoNerd> Should be simple enough... use a few spare GPIO lines to control some tristate buffer chips
[16:37:22] <Fleck> ok, thanks guys, will think about this! :)
[16:51:23] <Lambda_Aurigae> Fleck, look at 9bit addressing modes.
[16:51:43] <Lambda_Aurigae> you have one master and multiple slaves...master tx hooked to all slave rx and master rx hooked to all slave tx.
[16:51:59] <LeoNerd> Vaguely like MIDI
[16:52:02] <Lambda_Aurigae> then you use the 9th bit to identify the transmission as an address.
[16:52:06] <LeoNerd> Except MIDI is 8bit packets with 7bit payloads
[16:52:19] <Lambda_Aurigae> as I recall the AVR has an actual mode on the usart to do just that in fact.
[16:52:22] <Lambda_Aurigae> LeoNerd, yes, similar.
[16:54:27] <Lambda_Aurigae> it is called multi-processor communication mode.
[16:54:27] <Fleck> ok Lambda_Aurigae, thanks, sounds great
[16:54:38] <Lambda_Aurigae> on the atmega1284p chip datasheet it is section 19.10 on page 183
[16:55:13] <Fleck> 328 here or, 2560
[16:56:37] <Lambda_Aurigae> just look for multi-processor or multi processor
[16:56:40] <Lambda_Aurigae> it should be there.
[16:56:49] <Lambda_Aurigae> there is a master and slave mode.
[16:58:48] <Lambda_Aurigae> you basically send an address frame(9bits with the 9th bit high) and the addressed slave goes into receive mode while all others ignore the data.
[16:59:01] <Lambda_Aurigae> then you send data with the 9th bit set low.
[16:59:10] <Lambda_Aurigae> to address a different slave you just send another address frame.
[17:00:36] <Fleck> ok, I'll have to read about it
[17:00:57] <Lambda_Aurigae> sending back, you would tell a slave to send data...the others will not see the command to send so they won't do anything and they won't see the sent data anyhow as they will be listening on the wrong pin.
[17:01:09] <Lambda_Aurigae> not a lot of detail so you will have to play and learn.
[17:01:15] <Fleck> doesn't slaves need to support that?
[17:02:29] <Lambda_Aurigae> they do.
[17:02:45] <Fleck> well, not sure they do then
[17:02:47] <Lambda_Aurigae> either in hardware like the atmega usart or in software somehow.
[17:02:54] <Fleck> cause slaves are not avrs :D
[17:02:57] <Lambda_Aurigae> what are you using for slave chips?
[17:02:58] <Lambda_Aurigae> aahh.
[17:03:08] <Fleck> audio devices
[17:03:09] <Lambda_Aurigae> well, you can still do it,,you just have to code for it.
[17:03:13] <Fleck> like cambridge audio
[17:03:24] <Lambda_Aurigae> so you can't change the coding on them?
[17:03:35] <Fleck> nope
[17:03:38] <Lambda_Aurigae> if that's the case then you are screwed trying to run multiple devices on the same bus.
[17:03:49] <Lambda_Aurigae> now,,,you could put an AVR intermediary device on each one.
[17:03:51] <Fleck> https://techsupport.cambridgeaudio.com/hc/en-us/articles/200999281-RS232-Codes
[17:04:11] <Fleck> no, I won't do that
[17:05:04] <Lambda_Aurigae> looks like you are limited to one device per serial port then.
[17:05:38] <Lambda_Aurigae> you could use a small avr to play address link point and have it forward through any commands that come to it when it is addressed.
[17:05:42] <LeoNerd> Just use a muxing buffer of some kind inbetween
[17:06:07] <Lambda_Aurigae> otherwise all of your devices will see the same data.
[17:06:11] <LeoNerd> I'm sure I remember a bidirectional 1:8 multiplexer in 4000-series
[17:06:35] <Lambda_Aurigae> LeoNerd, yeah...but that's gonna require running multiple cables from the central mux point.
[17:06:41] <Fleck> sure
[17:06:44] <Fleck> no problem with that
[17:06:44] <Lambda_Aurigae> rather than a straight bus from point to point to point.
[17:06:54] <LeoNerd> Mmm, true. I wasn't sure what the requirements are
[17:06:57] <Lambda_Aurigae> there are all kinds of muxes.
[17:07:06] <Lambda_Aurigae> 74 series even has a bunch of them.
[17:08:05] <Lambda_Aurigae> heck, you could just use a 40pin AVR and bitbang 10 uarts on it.
[17:08:17] <Fleck> ;p
[17:08:38] <Lambda_Aurigae> from the looks of it you will need level converters for those cambridge devices too.
[17:08:51] <Fleck> yeah, I got those
[17:08:51] <Lambda_Aurigae> as they are rs232 level serial, not ttl level like the avr talks.
[17:09:05] <Fleck> bunch of MAX232N
[17:09:29] <Lambda_Aurigae> I like max233 chips myself,,,,but they are considerably more expensive.
[17:09:36] <Lambda_Aurigae> no external caps required.
[17:09:52] <Lambda_Aurigae> but at 7 dollars each, they cost more than a max232 with caps.
[17:10:26] <Lambda_Aurigae> so it's a tradeoff...cost vs board area.
[17:10:35] <Fleck> goot to know
[17:10:41] <LeoNerd> I have a few MAX232s sitting around that I bought ages ago, never used
[17:10:46] <LeoNerd> And about 20 (!) 4066s
[17:10:59] <Lambda_Aurigae> I have bunches of them that maxim has sent me over the years.
[17:11:26] <Fleck> why they don't send me anything? :D
[17:11:34] <Lambda_Aurigae> they once sent me a sampler platter of like 3 each of every package of every max233/232/etc chip in the inventory.
[17:12:00] <Lambda_Aurigae> because you don't sweet talk the sales guys when they come to town.
[17:12:16] <Lambda_Aurigae> I used to talk them and the atmel rep and the ti rep out to lunch and beer.
[17:12:32] <Lambda_Aurigae> my atmel rep was this cute 26 year old redhead girl with an ass to die for.
[17:13:29] <Lambda_Aurigae> ok...done at work. heading home.
[17:14:27] <learath> uhm.
[17:56:28] * Lambda_Aurigae are homely!
[21:03:55] <grey> I was under the impression my AVR ICE could program an Atmega328p over ISP without requiring external power, but in atmel studio I see the target voltage being set at 0.2V which is too low for the chip, can I increase the voltage from the programmer or do I have to supply external voltage to the chip?
[21:09:13] <Tom_itx> supply external voltage
[21:09:52] <grey> okay, thanks :)
[23:37:15] <Casper> WTH... reading the datasheet for the tiny85... TCCR0A register.... bits are: COM0A1 COM0A0 COM0B1 COM0B0 -- -- WGM01 WGM00 flip page, get to Waveform Generation Mode: WGM0[1:0]... then a table: WGM02 WGM01 WGM00 <=== O.o
[23:37:30] <Casper> the text say: WGM02 is in the TCCR0B register....