#avr | Logs for 2014-08-24

Back
[00:03:05] * twnqx pokes WormDude
[01:20:28] <Xark> OK, cool. I now have one 8-bit wavetable sine wave audio voice output (with volume) during NTSC video generation. Now to mix in some others and try to make some fun sounds...
[01:21:41] <Thrashbarg> cool
[01:22:51] <Xark> Thrashbarg: Using max fast PWM rate and modulating with waveform at the end of each scan line (in theory ~11Khz max frequency - like Amiga). :)
[01:23:39] <Thrashbarg> ah yep nice
[01:23:45] <Thrashbarg> I thought NTSC was 15kHz :P
[01:24:07] * Xark has a headache now from listening to loud sine tones...(but I have the scope hooked up now for visual debugging [less painful]).
[01:24:13] <Thrashbarg> hehe
[01:24:41] <Xark> Hmm, sample every 64.5usec IIRC....what is that.
[01:24:59] <Xark> 63.55used
[01:25:26] <Thrashbarg> Xark: 15734Hz
[01:25:34] <Thrashbarg> plus a heap of decimal digits
[01:25:59] <Thrashbarg> it's exactly equal to 13.5MHz divided by 858
[01:27:39] <Xark> Hmm, so ~7khz max frequency. :)
[01:27:51] <Thrashbarg> ok so you're sampling every other line?
[01:28:03] <Xark> No, but nyquest etc.
[01:28:10] <Thrashbarg> ah yea, frequency, not sample rate
[01:28:45] <Xark> Generates pretty good sine wave on the scope (with a .1uf cap to smooth out high freq PWM)
[01:28:50] <Thrashbarg> yeah
[01:28:53] <Thrashbarg> I'm working on a composite television project too :P
[01:28:58] <Thrashbarg> https://hackaday.io/project/2526-Tube-Television-Tennis
[01:29:24] <Xark> Thrashbarg: Very cool. :)
[01:29:58] <Thrashbarg> still waiting for my tube sockets to turn up... I'm using what I've got so far
[01:30:01] <Xark> Thrashbarg: Here is a little test of my sprites and tile routines (added sound to this today) -> https://www.youtube.com/watch?v=Imk5ony8JHI
[01:30:24] <Thrashbarg> wow that's quite good!
[01:30:43] <Thrashbarg> what are you using for the video shift register?
[01:30:53] <Xark> Thrashbarg: It is using 128 8x8 ROM tiles and 128 8x8 RAM tiles with some software that fakes sprites (~14 16x16).
[01:31:06] <Xark> No, all bit banged. Serial and SPI are still available. :)
[01:31:23] <Thrashbarg> oooouch how the hell do you get that resolution with a bit banged output??
[01:31:25] <Xark> 4 cycles per pixel (with some "fun" scanout asm code). :)
[01:31:34] <Thrashbarg> wow
[01:31:59] <Thrashbarg> I managed to get 80 columns composite off a 27MHz ATMega using the SPI port
[01:32:08] <Thrashbarg> http://kaput.homeunix.org/spivideo/
[01:32:20] <Xark> Here is scanout code...(oh, also vertical and horizontal fine scroll too) -> http://hastebin.com/ikurobocus.tex
[01:32:58] <Xark> Thrashbarg: Nice. I can get 40 columns with 16Mhz -> https://imgur.com/a/JO4Cq (bottom)
[01:33:26] <Xark> Cool. I know that page. :)
[01:33:28] <Thrashbarg> pretty good still
[01:33:40] <Thrashbarg> yea it's mine
[01:33:43] <Xark> I think I perhaps saw it linked in HaD comments. :)
[01:33:50] <Thrashbarg> probably
[01:34:19] <Xark> I am cheating a bit with the 40 columns (there is a "stretched" pixel - but fine for text).
[01:34:24] <Thrashbarg> ok
[01:34:45] <Xark> Takes 3 cycles to read from flash, so a problem with 2 cycles per pixel. :)
[01:34:54] <Thrashbarg> yea...
[01:35:22] <Xark> SPI is a good technique. I perhaps should be using it (but it is kind of cool you can use Ethernet shield etc. with video).
[01:35:34] <Thrashbarg> yeah
[01:35:42] <Thrashbarg> not having the SPI port makes it tricky
[01:36:12] <Thrashbarg> for Ethernet ...
[01:36:15] <Xark> Thrashbarg: Do you have do deal with unwanted 9th bit with SPI (or only some ATMegas)?
[01:36:34] <Thrashbarg> no that page is the 'fix' for the 9th digit
[01:36:47] <Thrashbarg> er bit
[01:36:55] * Xark links to older video showing ~40 column "fake Apple ][" AVR accessing Internet via shield -> https://www.youtube.com/watch?v=DwAFF8XviSY
[01:37:38] <Xark> Thrashbarg: Oh, right, awesome. Seems much better than using serial port...
[01:38:40] <Thrashbarg> yeah... I'm clocking the SPI port externally so it doesn't insert the 9th bit but you have to time writes to the port in software exactly or it won't display anything
[01:38:49] <Xark> Or the "set DDR" to force black trick.
[01:39:24] <Xark> You may have seen http://www.batsocks.co.uk/readme/video_timing.htm
[01:39:43] <Thrashbarg> it's for my Z80 computer terminal controller. I needed 80 columns without the 9th bit or it wouldn't fit on the screen
[01:40:06] <Thrashbarg> yup
[01:40:13] <Xark> Cool. Pretty nice looking display on your page. I would have loved that in z-80 days. :)
[01:40:30] <Thrashbarg> I got colour working on mine too by overlaying a separate colour signal generated from some extra memory on the Z80
[01:40:54] <Xark> Thrashbarg: Very neat. Does that require a special crystal, I assume?
[01:41:22] <Thrashbarg> it needs 27MHz for the ATmega and a x4 NTSC/PAL crystal for colour
[01:41:32] * Xark can't find it, but there was an interesting color NTSC hack on HaD.io...
[01:41:36] <Thrashbarg> I have a switch to select between PAL/NTSC encoding
[01:41:42] <Thrashbarg> https://static.hackaday.io/images/3930781394182517360.png
[01:42:18] <Xark> Wow, that is neat.
[01:42:43] <Xark> Dithering to simulate more colors (or is that just the art)?
[01:43:02] <Thrashbarg> the clock for the SPI is only ticking when there's active video so I used that to clock out the colour information and encode it on the crystal clock
[01:43:06] <Thrashbarg> nah that's dot crawl
[01:43:13] <Xark> :)
[01:43:23] <Xark> "authentic composite video" :)
[01:43:27] <Thrashbarg> yup
[01:43:58] <Thrashbarg> it could be component if you removed the encoder and tapped into the resistors that output the different levels
[01:45:08] <Xark> Does your AVR have external memory (or > 328)?
[01:45:39] <Thrashbarg> it's an ATmega328... so 2k internal for the text buffer
[01:45:54] <Xark> So that color image is in flash?
[01:46:07] <Thrashbarg> no it's in an extra bank of RAM the Z80 addresses directly
[01:46:22] <Xark> Ahh, OK, so external RAM of some kind?
[01:46:41] <Thrashbarg> yeah just a boring 32k RAM
[01:46:45] <Thrashbarg> parallel 62256
[01:47:09] <Xark> With 80 columns, not much RAM left for AVR (but fine for a terminal). :)
[01:47:15] <Thrashbarg> yeah
[01:47:42] <Xark> RAM is a squeeze in my design as RAM tiles take 1KB, and 22x22 screen and 128 byte backsave buffer take much of the remaining KB.
[01:47:53] <Thrashbarg> yeah
[01:47:55] <twnqx> so just connect a 32k external one :P
[01:48:11] <Thrashbarg> I've wanted to try using an external SPI RAM to generate the video directly
[01:48:18] <Thrashbarg> thing is you can't write to it while it's being read from
[01:48:33] <Xark> twnqx: That is cheating. :) I am seeing how much of a video game system the 328 can be with just R+C video and audio circuits. :)
[01:50:02] <Thrashbarg> Xark: if you ran it at 14.31818MHz you could potentially encode NTSC with it, ala Apple ][
[01:50:20] <Xark> Thrashbarg: Yeah. I was taking to Lambda_Aurigae who has an interesting triple buffered system with 3 SPI RAMs (one can be updated, while the others are displayed).
[01:50:28] <Thrashbarg> yup
[01:50:45] <Xark> Thrashbarg: Yes, I do realize that. I have the crystal and have experimented with it.
[01:52:24] <Thrashbarg> https://www.youtube.com/watch?v=3Ug49zLClyo <-- NTSC colour... I managed to get a single pixel to move on it :P
[01:52:28] <Xark> Thrashbarg: Haha, I was getting a bookmark about color NTSC and I am surprised by the username -> http://kaput.homeunix.org/~thrashbarg/NTSC_colour.png
[01:52:42] <Thrashbarg> yeah that video I just linked is generated by that
[01:52:43] <Xark> (although not too surprised). :)
[01:53:04] * twnqx still recommends a certain demo scene wild demo for that
[01:53:10] <Xark> Neat, well that was my "source concept" circuit with color.
[01:53:24] <Thrashbarg> I'd do it with the SPI bus now
[01:53:27] <Thrashbarg> if I did it again
[01:53:50] <twnqx> http://www.linusakesson.net/scene/craft/ ':)
[01:54:01] <Thrashbarg> and fuse it so the crystal clock appears on PORTB and clock the SPI bus off that
[01:54:08] <Xark> twnqx: 2nd time I've seen that linked today (and it is still awesome). :)
[01:54:12] <Thrashbarg> twnqx: Linus Akesson is nuts :P
[02:00:21] <Xark> Thrashbarg: Here is the other technique I read about recently. It seems he could use your SPI trick (and not sure why his screen quality is so poor...) -> http://www.hackster.io/janost/avr-videoblaster
[02:02:21] <Thrashbarg> I can only imagine he's faking 3.57MHz with a 16MHz crystal and is getting a mountain of artefacts
[02:03:00] <Thrashbarg> I'm surprised he's pulling that off at all to be honest
[02:03:09] <Thrashbarg> unless he just changed the crystal and didn't say :P
[02:03:10] <Xark> Thrashbarg: Well, schematic (at bottom) shows proper 14.318... so I dunno
[02:03:14] <Thrashbarg> ahh ok
[02:03:31] <Thrashbarg> well he has no excuse for bad video then :P
[02:04:01] <Xark> Yeah, yours looks every bit as good as my Apple ][ did (probably better with LCD screen...)
[02:04:22] <Thrashbarg> mine was a capture off my composite capture card
[02:04:37] <Xark> Thrashbarg: OK, I was wondering about that. :)
[02:04:54] <Thrashbarg> just because it shows every little detail
[02:05:04] <Thrashbarg> which normally get blurred out with camera shots
[02:05:21] <Xark> Yeah. My video is "shaky cam". :)
[02:05:26] <Thrashbarg> heh
[02:13:56] <Mr_Sheesh> Does anyone have a table of instructions on the 328 which are 1 vs 2 etc. instructions? Trying to refresf my brain here, I need some tight timing on this
[02:14:28] <gjm> Datasheet?
[02:15:08] <Mr_Sheesh> Ya, I know a few are 2's like rjmp, just need a table of them to figure some things out
[02:15:27] <Mr_Sheesh> I guess I'll make the table I need
[02:20:43] <Xark> Mr_Sheesh: There is a great 2 page table in the 328 datasheet. :)
[02:21:10] <Xark> Mr_Sheesh: 32. Instruction Set Summary
[02:21:34] <Mr_Sheesh> I had the pdf open, missed that then; I'll lok again. Making a dsp widget and need isochronous code, wheee :p
[02:22:26] <Xark> Mr_Sheesh: Hmm, however, looking closely it has # clocks, but not # words...
[02:24:48] <Mr_Sheesh> IDK about #words, isochronous = all code branches take the same time so your timing's always identical (so it always has identical timing.) Usually end up with extra NOPs in some branches ofc :p
[02:25:15] <Xark> Mr_Sheesh: Right. I have been working on video code, so same deal and that table is handy. :)
[02:28:20] <Mr_Sheesh> Yeah :) Not sure yet what clock I want to use, client's driving me nuts, I may just do the 1st one on an Arduino Mini and let them file a bug report on the thing? So I can do some CODE on the durn thing -rolls eyes- :p
[05:15:47] * twnqx pokes WormDude again
[07:26:12] <carp3> If i connect 555's output pin to a mosfet with a 5k resistor and then connect mosfet's gate pin to AVR directly.. i can turn on the mosfet / turn off the mosfet and also let 555 take control of the mosfet by changing pin to high/low/high-z modes ? am i right ?
[07:29:03] <Lambda_Aurigae> carp3, probably.
[07:42:49] <noa> can someone spend 5 minutes to give me a suggestion? To my understandung the following code is correct, but the servo rotates only clockwise. Fuses for clock: INTRCOSC_8MHZ_6CK_4MS
[07:42:54] <noa> code: http://pastebin.com/2xqGZAWW
[07:53:42] <carp3> noa: what is your micro controller ?
[07:54:29] <noa> carp3: ATMEGA16
[07:55:25] <carp3> do your compiler convert 16bit (OCR1A) to OCR1AL and OCR1AH ?
[07:56:15] <noa> how can i tell? i use AVR Studio 6
[07:58:01] <carp3> don't know about avrstudio. but winavr don't convert them.
[07:58:42] <noa> carp3: and how do you overcome this in winavr?
[07:59:44] <carp3> OCR1AH = ((i >> 8) & 0xff);
[08:00:09] <carp3> OCR1AL = i & 0xff;
[08:02:28] <noa> carp3: i don't think that's the case. not sure tho..
[11:30:58] <bezoka> hello
[11:31:59] <Lambda_Aurigae> olleh
[11:45:44] <Steffanx> witam
[11:47:11] <Tom_itx> ?e?a
[11:47:29] <Lambda_Aurigae> abathra ma neshi kutal.
[11:51:42] <antto> kude popadnah /o\
[11:51:56] <Lambda_Aurigae> ah? popadna hesha?
[11:52:21] <antto> u w0t
[11:52:35] <Lambda_Aurigae> kno dava.
[11:52:40] <Steffanx> yes yes
[11:52:44] <Lambda_Aurigae> hehe.
[11:52:46] <Lambda_Aurigae> anyhow,,,
[14:12:38] <Duality> how would i set the correct fuses for 20mhz crystal ?
[14:13:05] <jeremyabel> http://www.engbedded.com/fusecalc/
[14:14:06] <jeremyabel> you'll want the last option for the clock fuse
[14:14:21] <jeremyabel> Ext. Crystal/Resonator High Freq with the longest startup time
[14:14:52] <Duality> yea see i did this once a few times and didn't work
[14:15:40] <jeremyabel> are your fuse bits locked?
[14:15:59] <Duality> no
[14:16:07] <Duality> but those chips are gone now :)
[14:16:15] <jeremyabel> heh
[14:16:42] <jeremyabel> yeah I was using a chip that had the arduino bootloader on it, and I was trying to nuke it but was unsucessful
[14:16:47] <jeremyabel> oh oh oh
[14:16:49] <jeremyabel> avrdude
[14:16:51] <jeremyabel> you gotta use -u
[14:16:55] <jeremyabel> to unlock the fuse bits
[14:17:03] <jeremyabel> otherwise it'll set them back for your "safety"
[14:17:14] <Duality> oh
[14:17:28] <Duality> but i am not using arduino, but an atmega16
[14:17:38] <jeremyabel> sure
[14:17:39] <jeremyabel> Disables the default behaviour of reading out the fuses three times before programming, then verifying at the end of programming that the fuses have not changed. If you want to change fuses you will need to specify this option, as avrdude will see the fuses have changed (even though you wanted to) and will change them back for your "safety". This option was designed to prevent cases of fuse bits magically changing (usually called safemode).
[14:17:42] <Duality> and wanted to play around with it, and use a 20mhz crystal
[14:17:54] <jeremyabel> if you're programming with avrdude, you have to use the -u parameter
[14:17:57] <jeremyabel> when programming the crystals
[14:18:01] <jeremyabel> http://www.nongnu.org/avrdude/user-manual/avrdude_4.html
[14:18:35] <Duality> what is this ckopt thing? and is it important to the clock workings ?
[14:18:44] <jeremyabel> not sure
[14:19:38] <jeremyabel> monday and tueseday are clock investigation days for me, so I'll be figuring all that out then
[14:23:42] <Duality> ok my settings seem to work, how would i verify that it's actually running at 20mhz?
[14:24:45] <soul-d> blinking a led at 1 sec with the delay function
[14:25:05] <Duality> ah yea offcourse
[14:25:09] <Duality> that makes sense :D
[14:25:16] <jeremyabel> the hello world of microcontrollers!
[14:29:28] <Lambda_Aurigae> I like to do an 8bit port output count...time it at 1MHz then time it at other frequencies to see how long it takes...
[14:30:27] <jeremyabel> an interestin approach
[14:32:34] <Lambda_Aurigae> gives me a good visual aid.
[14:32:48] <jeremyabel> via a logic analyzer?
[14:32:50] <Lambda_Aurigae> I also put a loop in there with a few nops just to slow things down a little.
[14:33:06] <jeremyabel> you got some code I could look at?
[14:33:07] <Lambda_Aurigae> could if you want...I'm more hands on and visual.
[14:33:34] <jeremyabel> so you'd do 8 leds then on a port?
[14:33:38] <Lambda_Aurigae> a while loop with an int counting up and output that to a port.
[14:33:41] <Lambda_Aurigae> yeah.
[14:33:43] <jeremyabel> ah ok cool
[14:33:47] <jeremyabel> now it makes sense
[14:33:56] <soul-d> it's not hard your first counter bit would me 0.5 mhz second 0.25 etc
[14:34:09] <soul-d> the size of counter just tells amount of divisions
[14:34:25] <Lambda_Aurigae> and inside the while loop a for loop with another 1-255 count with 1 or 2 nops in it.
[14:35:14] <jeremyabel> aha
[14:36:38] <Duality> it works!
[14:36:40] <Duality> it blinks!
[14:37:57] <soul-d> one small step closer to world domination Duality
[14:37:58] <jeremyabel> if you want to verify the clock you can have it output on some pin with a fuse setting
[14:38:17] <jeremyabel> and check it with a scope or whatever
[14:38:56] <Duality> i am not new to avr programming in fact i have been doing it for a good while now :) even know how to do assembly for it. but i never had ran an avr on 20Mhz :D
[14:39:18] <Duality> i wish i had my scope on me
[14:39:37] <soul-d> i assumed someone owning a fancy scope would have figured that out or maybe just to much hassle you usaly want a led anyhow to show some programing response error flashing whatever
[14:41:58] <RikusW> Duality: CKOPT usually means full swing oscillator, must be set for high freq
[14:42:19] <RikusW> (set = 0 in avr fuse speak)
[14:45:02] <Duality> yea RikusW i read that, but on the fuse calc site, does marking it meen it puts a 0 in or a 1, so confusing :)
[14:45:24] <RikusW> setting a fuse sets the bit to 0
[14:45:52] <Duality> yea i understand
[14:46:12] <Duality> but on the website marking it is setting it ? and that meens it makes it a 0 ?
[14:46:13] <RikusW> but its counter intuitive for sure...
[14:46:26] <RikusW> yes
[14:46:29] <Duality> anyway it works :)
[14:46:44] <Duality> i didn't mark ckopt,
[14:47:42] <soul-d> doesnt doe it for you if you select high freq osc stuff in the dropdown ?
[14:51:30] <Duality> maybe it does
[14:59:12] <JustinN> hey all, a bit confused on something and maybe somebody else has experienced this issue... I'm using ATMega8A (TQFP32 size) and trying to write some text on an HD44780 LCD. The LCD works (tested it on an Arduino), the ATMega8A works (I can flash LEDs and play tunes on a piezo), and the code I found here http://www.pocketmagic.net/2009/02/atmega8-and-2x16-hd44780-lcd/ (along with a small bit of code I wrote myself) works perfectly fine on an AVR Emulator by
[14:59:12] <JustinN> Oshonsoft. However the same hex file just turns both rows into black squares on my actual board - any ideas what might be going on?
[15:00:29] <Tom_itx> why do ppl still use the mega8?
[15:00:45] <Kev> stock
[15:00:50] <Fleck> why not? :)
[15:01:00] <Tom_itx> JustinN what about the backplane voltage?
[15:01:04] <Tom_itx> or the init pins
[15:01:20] <Tom_itx> Fleck because the 88 is cheaper and has more functions
[15:02:46] <JustinN> I was able to get the mega8 for 72c per, couldn't get the 88 for that and didn't need the extra features, just needed 1,000 chips for a simple project :)
[15:03:23] <Tom_itx> you could test fleury's lcd lib against yours
[15:04:08] <Kev> JustinN, i actually commented on that thread in 2009 (you can search "kev" on that page)
[15:04:14] <JustinN> Tom_itx: by backplane voltage, do you mean the voltage between the VSS and VDD pins? It should be 5v, but I'll check it
[15:04:21] <Tom_itx> pin 3
[15:04:39] <Tom_itx> contrast
[15:04:43] <Kev> i ended up using another lib i think
[15:06:08] <Kev> http://www.avrfreaks.net/index.php?module=Freaks%20Files&func=viewFile&id=4566&showinfo=1
[15:06:15] <Fleck> Tom_itx: yeah but we got stock of 8 and 88 and we don't waste 88 where we can put 8 :D
[15:07:02] <Tom_itx> JustinN, you could test this against it: http://tom-itx.ddns01.com:81/~webpage/avr/LCD/
[15:07:12] <Tom_itx> change the clock in the main and the chip in the makefile
[15:07:14] <Tom_itx> should work
[15:07:17] <Tom_itx> check the pinout
[15:07:28] <Fleck> + sometimes you need MCU fast, & local stores only got 8 ;D
[15:07:48] <Tom_itx> pinout is in the lcd.h file
[15:08:40] <Duality> i am working on avr + z80 and i have the address buss running :D
[15:08:52] <JustinN> Tom_itx: well it''s on a pot... and I'm reading 0v when it's showing black squares, and empty screen when it's at 5v (nothing inbetween really)
[15:09:30] <Tom_itx> hard to say what it should be... i've got some that require negative bias for pin 3
[15:09:31] <JustinN> Kev: aha! awesome, never expected to bump into the chap with similar issues :)
[15:09:32] <Jartza> yeah, and we actually discussed the fuses, F_CPU and stuff already on #hackvana :)
[15:09:44] <Tom_itx> new ones mostly use 5v
[15:10:28] <Tom_itx> well try those files ^^
[15:10:42] <Jartza> but as I'm not that familiar with 8, I thought you people here have more ideas about possible problems
[15:10:44] <Tom_itx> i know they work but you may need to change the pinout (easy to do)
[15:10:56] <Jartza> or actually, avr is quite new to me as an architecture, even
[15:11:07] <Jartza> I've just done arm... and a leg
[15:11:09] <Tom_itx> i blew up the only 8 i had (given to me) and never looked back
[15:19:38] <JustinN> Kev: as you've had experience with this before, can you say that fuse settings of L:0xE4 H:0xD9 are fine to work with? Looking at the link you provided now (really hoping it works)
[15:22:57] <Kev> i don't see why it would not work
[15:28:07] <Jartza> me neither
[15:28:15] <Jartza> didn't find anything suspicious from fuse settings
[15:39:01] <TechIsCool> alright have a question How do I combine two 8bit ints into a 16bit? Is it like this? uint16_t Red = packet.dat[0]<<8 | packet.dat[1];
[15:41:05] <Lambda_Aurigae> works for me TechIsCool
[15:41:10] <TechIsCool> ok
[15:46:36] <Jartza> DHL sent me a SMS
[15:46:53] <Jartza> "Estimated Delivery Date: 2014-08-26 23:59:00"
[15:47:10] <Jartza> I hope they don't bring it exactly on that time.
[15:51:03] <Kev> pxx[0]*256+pxx[1] should work as well but i think the shift operator is faster (not sure)
[15:51:35] <TechIsCool> Kev Yah I think the shift if faster
[15:51:39] <TechIsCool> is
[16:28:59] * Xark notes shift is one cycle per bit, multiply is 2 cycles for whatever (but often also needs a register move and clear from C).
[16:29:32] * Xark also notes "shifting" 8 bits is generally just a load/store. :)
[16:30:55] <Lambda_Aurigae> if I were doing it in assembly I would load the two 8bit values into one of the 16bit register pairs then use it from there.
[16:31:06] <Lambda_Aurigae> no shifting or multiplying necessary.
[16:33:14] <Xark> Lambda_Aurigae: C probably will notice that too.
[16:33:28] <Xark> (but will also probably do a pointless register move...)
[16:33:34] <Lambda_Aurigae> prolly
[16:34:01] <Xark> avr-gcc does OK, but it still annoys me about some things when I disassemble. :)
[16:35:49] * Xark is currently annoyed as he can only mix two voices before "end of scanline" merges with "beginning of next scanline"...I may need to use some asm. :)
[16:38:05] <Xark> It annoys with little things like clearing r1 after *every* multiply (even when it is going to do several in a row).
[16:45:33] <Xark> Lambda_Aurigae: I am curious, are your AVR video designs interrupt driven (like an interrupt per scan line)? If so, what do you do for interrupt "jitter"? Sync to a timer?
[17:06:28] <Lambda_Aurigae> it's too primitive for that yet....mostly some delay cycles and lots of assembly adjustments.
[17:07:01] <Lambda_Aurigae> interrupts are too unpredictable.
[17:09:21] <tunixbsd> Can someone say me what do the line ".global __do_copy_data" ?
[17:09:37] <tunixbsd> i'm using the GNU assembler .
[17:10:27] <Xark> Lambda_Aurigae: Yeah. I have some code that will "poll" a timer for cycle accuracy (i.e., interrupt a bit early then get sync accurate polling timer value).
[17:10:43] <Lambda_Aurigae> Xark, nice.
[17:10:54] <Lambda_Aurigae> tunixbsd, looking.
[17:11:12] <Xark> tunixbsd: It declares a variable as global in scope, I believe.
[17:11:57] <Xark> (for "exporting" symbol)
[17:12:02] <Lambda_Aurigae> I think it actually tells the system to copy the variable data to the sram.
[17:12:10] <Xark> Lambda_Aurigae: I disagree.
[17:12:36] <tunixbsd> but this line is alone in the end of code wihout any args.
[17:12:38] <Lambda_Aurigae> Xark, you could very well be right...I have no clue other than looking at some code here.
[17:12:45] <Xark> Only the "C startup" code will copy from flash -> SRAM (nothing to do with assembler/linker).
[17:13:37] <Lambda_Aurigae> looking at code here it says something about initializing global variables...it's a call to a routine apparently.
[17:13:38] <Xark> tunixbsd: Yes, I suspect in same file there is a symbol __do_copy_data? This is the name of the routine that will copy data from flash -> SRAM (part of C startup).
[17:14:08] <Lambda_Aurigae> http://www.microhope.org/p.php?id=23
[17:14:38] <tunixbsd> Xark: how i put the data from flash to SRAM without it ?
[17:14:42] <Lambda_Aurigae> so it seems to be a call to the __do_copy_data routine in the C runtime.
[17:14:48] <tunixbsd> Xark: how i can put the data from flash to SRAM without it ?
[17:15:03] <Xark> tunixbsd: What are you doing? Asm & C?
[17:15:06] <tunixbsd> sorry , i missed the "can"
[17:15:23] <Lambda_Aurigae> tunixbsd, well, you would read the flash and write to sram.
[17:16:02] <tunixbsd> Xark: no, just assembly
[17:16:11] <Xark> tunixbsd: The C startup routines __do_copy_data will copy initialized data from flash to SRAM and __do_clear_bss will zero other globals.
[17:16:30] <Xark> tunixbsd: What is your "entry point" named? main?
[17:17:06] <Lambda_Aurigae> tunixbsd, apparently you are looking at assembly code put out by avr-gcc?
[17:17:12] <Xark> tunixbsd: If you name it "main" then I believe the linker will believe it is C and do the normal startup (including SRAM copy and BSS clear).
[17:17:34] <Xark> tunixbsd: Basically "copy" the asm a C compiler produces (i.e., -S).
[17:17:50] <tunixbsd> Lambda_Aurigae: yes, i'm using the -S argument to see the assembler code.
[17:18:36] <Lambda_Aurigae> it's a good way to learn assembly but there's a lot of excess stuff in the C runtime that you wouldn't put in a regular assembly program.
[17:19:23] * Xark think that global is only needed to "export" global functions...(but perhaps AVR is different to other architectures).
[17:20:18] <Lambda_Aurigae> tunixbsd, if you aren't using the C runtime then you have to do all of that variable initialization on your own.
[17:20:32] <tunixbsd> How i can do this ?
[17:21:46] <Lambda_Aurigae> same way you would do with assembly on any platform....if you have blank variables then you pick a sram location and write it to 0...if you have a predefined value for a variable then you write that value to that memory location.
[17:22:16] <Lambda_Aurigae> working in assembly is kind of a different world from working in C....the assembler doesn't do all the setup stuff for you that is done by C.
[17:22:58] <tunixbsd> Can you post a bit of code in pastebin please ?
[17:23:28] <Lambda_Aurigae> probably better for you to read an assembly tutorial.
[17:23:56] <Lambda_Aurigae> http://www.avr-asm-tutorial.net/avr_en/
[17:24:12] <Lambda_Aurigae> best basic assembly tutorial I ever found....and the oldest.
[17:26:00] * Xark just confirmed that the .global __do_copy_data and .global __do_clear_bss are needed to "pull in" the C init code (without them it will not clear bss or copy initialized data to SRAM).
[17:26:27] <Xark> Is there a reason to not use the C runtime?
[17:26:47] <Lambda_Aurigae> if you aren't using C then why use the C runtime?
[17:26:53] <Xark> It adds only a few tiny routines to do the init (and doubtful your version would be much more efficient).
[17:26:57] <Lambda_Aurigae> lots of overhead you don't need.
[17:27:11] <Xark> It will only include what you actually "use".
[17:28:30] <Xark> Lambda_Aurigae: For example, the example AVR asm code on the page you linked is either 198 bytes with __do_copy_data an __do_clear_bss and 160 bytes without
[17:29:12] <Lambda_Aurigae> 38 bytes is 38 bytes.
[17:29:35] <Xark> Lambda_Aurigae: Indeed, but if you need to clear bss and init SRAM data, it is fairly par.
[17:30:47] * Xark links C startup routines http://hastebin.com/fomiyidiqe.avrasm
[17:31:45] <Xark> The key is knowing all the "magic linker symbols" that define the address and sizes of the regions to copy/clear (all the arbitrary immediates loaded).
[17:31:58] <tunixbsd> Xark: I'm able to use the "__do_copy_data" but because i'm learning, i would like to do this kind of thing with my own hands.
[17:32:17] <Xark> tunixbsd: OK, well, the link I just posted has the code if you want to do it yourself.
[17:34:54] <Xark> tunixbsd: You may find this helpful -> https://stackoverflow.com/questions/17323757/going-through-avr-assembler-hello-world-code
[17:41:07] <Xark> tunixbsd: This looks to be the source for the offical lib code (so you can copy the "magic symbols" in your version) -> http://svn.savannah.nongnu.org/viewvc/avr-libc-1_8_1-release/crt1/gcrt1.S?revision=2448&root=avr-libc&view=markup
[17:41:51] <Xark> (NOTE: It is a simple routine, but somewhat confusing code, with lots of #if checks for various AVR flavors etc.)
[17:42:40] <Xark> It also defined the required AVR interrupt vectors (something you will need to do yourself if you avoid all this startup code)
[17:50:27] <Jartza> cool
[17:50:39] <Jartza> got my flash write with modem working
[17:50:55] <Jartza> now I can start coding the real update-sw
[17:50:58] <Xark> Jartza: What kind of modem?
[17:51:07] <Jartza> well, more or less "modem"
[17:51:34] <Jartza> but I'm updating 2kB of data to attiny85 using audio from phone/tablet/laptop/pc/whatever
[17:51:37] <Xark> Jartza: So you can remotely update firmware?
[17:52:05] <Jartza> well, haven't made a bootloader out of it, but it updates part of the flash, yes
[17:52:07] <Xark> Jartza: I see, audio demodulation. Neat. :)
[17:52:25] <Jartza> that could be made of course to flash the whole firmware too
[17:52:43] <Xark> Jartza: Yeah. You may not want that. :)
[17:52:49] <JustinN> Tom_itx: solved the issue... this dumb dumb cannot count... all my pins were all wired up one off of the one they should have been from the breakout... shifted them one along and it worked first time...
[17:53:12] <Jartza> Xark: I'm actually thinking of that :) but of course the bootloader itself must stay intact
[17:53:18] <Xark> JustinN: D'oh! The 'ol pins off by one issue. :)
[17:53:30] <Jartza> now it just updates data, but I'm actually thinking of updating the software too :)
[17:54:09] <JustinN> Xark: would you believe I spent a day and a half trying to fix this, thinking it was a code issue, followed by thinking it was fuse settings or something else type of issue?
[17:54:12] <Jartza> anyway it's super simple hardware and super simple sw
[17:54:24] <Jartza> the modem, that is
[17:54:34] <Jartza> it just needs one pin with pin change interrupt
[17:54:38] <Jartza> and one counter
[17:55:26] <Xark> JustinN: Hehe, yes, I would totally believe that (having done very similar myself). :)
[17:55:35] <Jartza> I'm currently using timer1 counter at 125kHz
[17:56:28] <Xark> Jartza: Sounds pretty clever. If you do a write-up I'd love to check it out. :)
[17:57:42] <Tom_itx> most problems have a simple solution.
[17:57:57] <Jartza> Xark: will do later, and release the source and schema
[17:58:20] <Xark> Jartza: Excellent. :D
[18:14:28] <tunixbsd> why when i try to use the X register i get a "undefined reference to `X'" error ?
[18:14:42] <tunixbsd> XH and XL works well
[18:19:35] <Lambda_Aurigae> so X is not available directly.
[18:19:42] <Xark> tunixbsd: X register only works for certain opcodes, like LD r25,X
[18:24:51] <Jartza> §wwweeewq
[18:25:02] <Jartza> argh, cat-attack
[18:25:33] <Thrashbarg> hehe
[18:25:53] <Jartza> she's too curious about my UI tests :)
[18:26:01] <Thrashbarg> aw
[18:27:05] * Xark has to be cautious when his cat notices his mouse cursor moving around (pounce at LCD hazard...)
[18:27:44] <Thrashbarg> hehe
[18:27:56] <Thrashbarg> none of my cats are cute... they keep to themselves
[18:27:58] <Thrashbarg> strays
[18:57:02] <Jartza> sheet, it's again 2:38am
[18:57:09] <Jartza> so, I'm off to bed
[18:57:11] <Jartza> laters &
[22:44:26] <Xark> Got some good tips on 16-color video too (same guy who did https://www.youtube.com/watch?v=3Ug49zLClyo and https://static.hackaday.io/images/3930781394182517360.png )
[22:47:35] <twnqx> Xark: use a "ramdac", 256 out of 16m color style :P
[22:48:07] <twnqx> iirc you could get a fake 15/16 bit color mode switching the palette between to pictures
[22:48:28] <Xark> twnqx: Yeah, I have that on some of my FPGA boards. :) Also there is Uzebox with encoder that gets ~256 colors...
[22:48:34] <twnqx> early VGA PC demo tech :)
[22:48:50] <Xark> Sadly those external RAMDACs are very hard to find now...
[22:49:16] <twnqx> just use some rams
[22:49:32] <twnqx> 24bit wide data, 8 bit wide address :P
[22:50:03] <twnqx> and then even a(3) R/2R D/A converter will do
[22:50:08] <Xark> Well, that works for a palette, but for high quality DAC they would have been nice (vs R2R).
[22:50:37] <twnqx> nothing stops you from dropping three burr-browns in :P
[22:51:08] <Xark> I looked for VGA speed DACs and they were pricey.
[22:51:27] <twnqx> how fast do you want to go
[22:51:48] <twnqx> ~10mhz 8bit should do
[22:52:38] <Xark> Well, for VGA mostly I am looking at FPGA (not AVR). :) However, newest boards have HDMI so you can skip DAC.
[22:53:06] <Xark> With AVR you run out of memory too fast with B&W let alone any color... :)
[22:54:11] <Xark> I guess with ~12.5Mhz you can get ~320 horizontal.
[22:55:20] <Xark> Something like http://www.lucidscience.com/pro-vga%20video%20generator-10.aspx
[22:56:09] <twnqx> 640*480*30 = 9216000
[22:57:33] <Xark> Yeah. In my mind > 64K disqualifies AVR. :)
[22:58:11] <twnqx> mh. you kind of have a point
[22:59:01] <twnqx> go C64 VIC in soft :P
[23:00:09] <Xark> twnqx: I am currently trying to squeeze the time to mix two more audio wave voices (for 4 total) at the end of a scanline in my current AVR video hack -> https://www.youtube.com/watch?v=Imk5ony8JHI Looks like I will need more assembly...
[23:00:31] <Xark> twnqx: This is very close to a B&W VIC-20. :)
[23:01:19] <Xark> (but 2K AVR with only R+C audio and video (similar to TVout, but I need an additional capacitor to make fast PWM audio sound good).
[23:07:51] <twnqx> fun
[23:10:22] <Xark> Using this for a "development target" http://nootropicdesign.com/hackvision/
[23:11:15] <twnqx> 9V :(
[23:11:16] <Xark> (Due to handy buttons and video/audio - just another AVR breakout)
[23:11:38] <Xark> It has a crappy regulator. :)
[23:11:41] <twnqx> they should have added a 3.6V li-ion with boost regulator on it
[23:11:53] <Xark> Well, it needs a TV....
[23:12:22] <Xark> I suspect they used that as it is what Arduino uses.
[23:12:55] <Xark> "Based on Arduino technology" *cough*
[23:14:28] <Xark> I am powering mine with a 8u2 serial breakout...(similar to FTDI thingie).
[23:14:31] <twnqx> looks like 7805?
[23:14:40] <Xark> Yep. Really simple design.
[23:14:46] <twnqx> bah
[23:15:06] <twnqx> could have added a small tft with tv-in
[23:15:07] <Xark> I believe "audio output" is directly connected to MCU pin (which is a bit of a fail).
[23:15:13] <twnqx> and you'd have a portable version
[23:15:51] <Xark> twnqx: Did you see this? They did really good in a Kickstarter -> https://www.tindie.com/products/bateske/arduboy/
[23:20:42] * Xark notes apparently they are skipping KS and going straight to Tindie (or something - it already was popular enough)
[23:26:12] <Valen> So I was thinking, how would a credit card multimeter go. double thickness credit card size including probes, perhaps with bluetooth for the interface so no screen
[23:33:17] <Xark> Valen: That would be cool. Still needs some probes though. This fellow seems to have done well with his mini scope/LA http://www.gabotronics.com/oscilloscopes/xprotolab-portable.htm
[23:33:45] <Valen> probes need to fit in the package
[23:33:54] <Xark> Valen: Might be hard to compete with something like http://www.cabletiesandmore.com/american/catalog/triplett-2030-auto-ranging-digital-multimeter-pocket-size-p-608.php
[23:34:01] <Valen> thats way too big still, I'm thinking something that'll go into your wallet
[23:34:24] <Xark> Valen: OK, that would be interesting. :)
[23:34:47] <Xark> Don't need huge plastic probes...
[23:34:50] <Valen> I have a leatherman on my keyring, use it all the time, but I don't have something similar for the electrizical