#avr | Logs for 2016-03-09

Back
[01:44:19] <phinxy> Yay i just got my uzenet PCB.
[01:44:34] <phinxy> uzebox*
[01:52:24] <Xark> phinxy: Fun little kit. :)
[01:52:53] <Xark> Overclocked quite a bit, but I've not had trouble (hardy 644). :)
[01:58:33] <Jartza> most AVRs can be overclocked quite a lot
[01:59:10] <Xark> True. However, sadly, the 1284 not as much as 644 (since 16KB would be sweet). :)
[01:59:32] <Jartza> yeah. usually overclocking does bad things to ADC though
[01:59:40] <Jartza> but if ADC is not needed, then you can just kick it :)
[01:59:51] <Xark> EEPROM too (or needs extra delays)
[02:00:00] <Jartza> ah, true
[02:00:51] <Xark> Uzebox clocks 644 at (IIRC) 27Mhz. 1284 generally can't go that high.
[02:01:07] <Xark> NTSC x 4
[02:01:25] <Xark> Hmm, x 8. :)
[02:32:09] <Jartza> Never Twice Same Color
[02:41:47] <julius> morning
[02:41:53] <julius> cehteh, not for the code i write here
[03:08:09] <julius> i mean yes i do, but no public access
[03:23:43] <WormFood> Jartza, It's Never The Same Color :P
[03:52:34] <Jartza> WormFood: just another interpretation of the same thing :)
[04:09:31] <WormFood> Right Jartza, but I think the one I remember makes a little more sense.
[04:17:44] <Jartza> might be
[05:13:17] <phinxy> The Wifi protocol is 2.4ghz can/is each wave used for data or is it like every n wave is a bit?
[05:13:30] <phinxy> maybe that is what channels are?
[05:13:57] <lorenzo> phinxy: depends on the modulation
[05:14:30] <lorenzo> modern wifi is generally OFDM
[05:14:37] <phinxy> i dont know anything about radio. this ESP8266 module has a mcu running 50Mhz but its able to talk to wifi which is in the Ghz range
[05:15:03] <twnqx> so what
[05:15:18] <twnqx> a) you use a filter + frequency shifting, leaves about 80mhz of bandwidth
[05:15:41] <twnqx> b) the processing doesn't run on the cpu, demodulation etc runs on a separate piece
[05:16:07] <phinxy> mm ok. that stuff would be analog then?
[05:16:34] <phinxy> doesnt matter, its separated thats all i need to know
[05:16:47] <twnqx> to some points it's analog
[05:17:06] <lorenzo> phinxy: it's analog controlled by digital :-)
[05:17:25] <twnqx> filters and frequency selection are, at least
[05:17:27] <lorenzo> have a look at the esp8266 block diagram in the datasheet
[05:17:41] <lorenzo> it's pretty self explanatory
[05:17:41] <phinxy> !
[05:17:43] <twnqx> there are some insane radio frontends out on the market, though
[05:18:07] <phinxy> the esp is very interesting, its very powerful and cheap
[05:19:57] <phinxy> im not sure it will be as friendly to a programmer as avr's
[05:21:14] <lorenzo> phinxy: most people program it using the Arduino API
[05:21:21] <lorenzo> which I don't really like, but
[05:21:39] <phinxy> you mean flash the mcu on board with Arduino?
[05:22:06] <phinxy> its not an atmega , its a "diamond standard 32-bit 106Microcontroller"
[05:22:18] <lorenzo> yeah, you can add the esp8266 board to the Arduino IDE, write using the Arduino abstractions
[05:22:31] <lorenzo> and it generates a binary using their toolchain, which is then flashed on the board
[05:22:35] <phinxy> " ideal for designers looking for a basic 32-bit controller,
[05:22:36] <phinxy> particularly for those migrating up from an 8– or 16-bit
[05:22:36] <phinxy> controller. "
[05:22:57] <lorenzo> phinxy: the Arduino abstraction layers are pretty agnostic, I mean, it's C++
[05:23:11] <lorenzo> there's support for Atmel SAM, MSP430, MSP432, Tiva C, ESP8266
[05:23:13] <lorenzo> lots of cores other than AVR
[05:23:47] <phinxy> Ooh. I guess Arduino has some uses then
[05:27:02] <phinxy> Who is the company behind this MCU?
[05:31:12] <lorenzo> phinxy: Espressif
[06:04:35] <julius> hi
[06:04:59] <julius> are there other reasons beside a missing resistor between gate and GND that make a mosfet conduct without a signal on the gate?
[06:13:23] <RikusW> shorted mosfet ?
[06:13:50] <RikusW> I've seen that in smps with surge damage
[06:28:31] <twnqx> i recently had some mosfets with gate oxide breakdown
[06:28:35] <twnqx> "fun"
[06:29:53] <twnqx> especially with somewhat more powerful devices, like SQR50N06-07L
[06:31:12] <twnqx> julius: but generally your assumption is correct. a mosfet's gate acts like a small capacitor, it needs to be discharged in order to turn off again
[06:32:06] <twnqx> and it needs a small resistor to limit inrush
[06:38:20] <Lambda_Aurigae> just a background, julius is working with a 74HCxx chip which is fet based...the circuit appears to be a multiple-stage relaxation oscillator.
[07:01:15] <julius> this is a different circuit
[07:01:34] <julius> the moist sensor is dead
[07:02:51] <Lambda_Aurigae> ahh.
[07:02:54] <julius> the mosfet could be dead, but because of avaibility it can handle 10 times the current the water pump needs
[07:02:56] <Lambda_Aurigae> long live moisture.
[07:03:38] <julius> i will get a new one after sleeping over it a few days, but then it will get a isolation with plastik 70 or something
[07:09:16] <Jartza> today I've been mostly soldering msop-8 chips
[07:09:27] <Jartza> https://i.imgur.com/GHCRgOL.png
[07:09:38] <Jartza> starting to be pretty decent
[07:10:20] <Lambda_Aurigae> whatcha making?
[07:10:45] <Jartza> ahh, some customer stuff
[07:10:59] <Jartza> this is RTC + GPIO + Power IC cape for beaglebone black
[07:11:40] <Jartza> it has super accurate RTC, 4 screw terminals for buttons (with pull-down resistors etc), reverse polarity protection, overcurrent protection, overvoltage protection, shortcut protection and some power and fault leds
[07:13:21] <Jartza> that chip is this http://www.ti.com/lit/ds/symlink/tps2064c-2.pdf
[07:13:29] <Jartza> before that there's reverse polarity protection
[07:14:17] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxMlYtQWZKS1Exems/view
[07:14:21] <Jartza> that's the whole PCB :)
[07:15:47] <Lambda_Aurigae> what is it?
[07:15:53] <Lambda_Aurigae> oh.
[07:15:54] <Lambda_Aurigae> nevermind.
[07:15:59] <Lambda_Aurigae> scrolled up.
[07:17:09] <lorenzo> Jartza: that chip is basically a fancy PTC?
[07:17:24] <Lambda_Aurigae> just discovered a new toy on pic microcontrollers..need to order some samples..
[07:17:29] <Lambda_Aurigae> Configurable Logic Cell
[07:17:33] <lorenzo> really
[07:17:33] <lorenzo> :D
[07:17:35] <Lambda_Aurigae> like a mini CPLD
[07:17:41] <Lambda_Aurigae> ok.
[07:17:45] <Lambda_Aurigae> lorenzo showed me.
[07:17:51] <lorenzo> joking
[07:17:51] <Lambda_Aurigae> ordering samples now.
[07:17:54] <Jartza> and if you're wondering what those holes are for, well, these: https://i.imgur.com/YyqsQZh.png
[07:18:26] <Lambda_Aurigae> tie down straps, eh?
[07:18:31] <lorenzo> kinky :>
[07:18:34] <Lambda_Aurigae> have similar in copiers all over the place.
[07:18:38] <Jartza> yea
[07:18:53] <Lambda_Aurigae> half a pound of watermellon for breakfast.
[07:18:54] <Lambda_Aurigae> mmmmm.
[07:19:40] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxSXktek81RGJYWWM/view
[07:19:59] <Jartza> older version of the board... it'll have these screw mounts
[07:20:20] <julius> Jartza, whats the space between pins on msop?
[07:20:24] <julius> -8
[07:20:54] <Jartza> I think 0.65mm
[07:21:10] <Jartza> center-to-center
[07:21:51] <Jartza> and the pin... IIRC, it's 0.3mm wide
[07:22:06] <Jartza> so if you want to know how much space is _between_ the pins, 0.35mm :)
[07:23:09] <julius> Lambda_Aurigae, how long do you think will it take us to get printers that can print electronic components on a circuit?
[07:23:18] <Lambda_Aurigae> 3 years ago.
[07:23:32] <julius> oh
[07:23:40] <julius> let me take out my time machine
[07:23:43] <Lambda_Aurigae> just hasn't hit the market yet.
[07:23:44] <julius> lets go back ;)
[07:24:04] <Lambda_Aurigae> I remember seeing something that did just that.
[07:37:03] <julius> just attached a 12v pc fan for teting the pwm code, works fine. can run very slowly with 10% duty cycle @26khz
[07:55:25] <MrSaturn> Hi all. I am using a debugger to step through my code and inspect the stack. I can not see any return addresses on the stack, yet "bt" in gdb shows the correct backtrace. Am I missing something on how the PC is stored on the stack?
[07:58:24] <Jartza> what debugger, what code? :)
[07:59:39] <MrSaturn> Jartza, jtag3 w/ avarice & gdb. Code is for a vet clinic instrument.
[08:01:50] <Jartza> and the chip is?
[08:02:22] <MrSaturn> Jartza, xmega64d3
[08:02:27] <Jartza> mkay
[08:04:12] <MrSaturn> The return address SHOULD be 0xfd4 but doing "x/8bx $sp" dumps the following: 0x802a9c <ucHeap+1241>: 0x00 0x07 0xea 0x23 0xf1 0x08 0x51 0x0a
[08:04:20] <Jartza> AVR stores the return address to stack automatically and decreses the stack pointer when doing rcall/call or ISR
[08:05:00] <MrSaturn> 2nd line on a backtrace (where we came from): #1 0x00000fd4 in TWIRead () at
[08:05:07] <Jartza> and it stores PC+2 to stack
[08:05:40] <MrSaturn> So I would expect to see fd6 on the stack
[08:07:16] <Jartza> well, stack "grows" down
[08:08:14] <Jartza> you're trying to check the stack inside a function?
[08:08:45] <Jartza> and did you check assembly for the function, they usually push lot of stuff into stack when you enter them
[08:09:02] <Jartza> maybe display more data than just those 8 bytes?
[08:09:38] <Jartza> maybe something like "x/20bx $sp"?
[08:10:44] <MrSaturn> Jartza, Yes. So I am in a function (twi_master_transfer) that was called from TWIRead(). After the "call twi_master_transfer" function I wanted to inspect the stack to see the return address, which should be 0xfd4 which is the 2 more than the program counter at the address of the call instruction. I don't see it on the stack though
[08:11:14] <MrSaturn> Jartza, I put a break point on the entry into the function.
[08:11:30] <Jartza> yes. but I'm guessing, "C entry" of the program
[08:11:39] <Jartza> and not in assembly?
[08:12:24] <MrSaturn> Jartza, nope. I put a breakpoint on the first asm instruction in the routine
[08:12:34] <MrSaturn> this is the first 16 bytes:
[08:12:36] <MrSaturn> 0x802a9c <ucHeap+1241>: 0x00 0x07 0xea 0x23 0xf1 0x08 0x51 0x0a
[08:12:36] <MrSaturn> 0x802aa4 <ucHeap+1249>: 0x95 0x23 0xf1 0x17 0x16 0x15 0x14 0x06
[08:14:45] <Jartza> well, I have no clue how much stuff is pushed in stack and where the code stops in the assembly
[08:14:52] <Jartza> so my suggestion is that look even farther :)
[08:17:17] <Jartza> look for example 32 bytes, 40 bytes etc :)
[08:17:34] <Jartza> either that, or gdb doesn't know jack about your stack pointer :)
[08:19:01] <Jartza> but yes. the return address IS in stack, that's where the AVR core puts it
[08:23:20] <Jartza> MrSaturn: or... when in debugger, try to switch to asm view and see how much stuff is pushed to stack before it breaks
[08:28:02] <julius> testing a mosfet, +5v on D, S -> led + -> 330Ohm Resistor -> gnd - if the led stays dark, does that mean the mosfet is alive?
[09:11:44] <twnqx> first, that would depend on n-channel vs. p-channel and enhancement vs. depletion mode mosfet :P
[09:26:37] <rue_house> julius, you need to turn the gate on and off to know
[09:27:11] <rue_house> julius, but your also kinda upside down
[09:27:20] <rue_house> whats the part number of the fet?
[09:31:35] <julius> irf3205
[09:31:41] <julius> n-channel
[09:32:11] <julius> i know, the source is usually connected to GND. but does it matter?
[09:32:19] <rue_house> then +5v -> led + -> 330Ohm Resistor -> D, S -> gnd
[09:32:29] <rue_house> then
[09:32:42] <rue_house> +5v -> 100k resistor -> G
[09:32:47] <rue_house> should turn it on
[09:32:52] <cehteh> 100k?
[09:32:54] <rue_house> GND -> 100k resistor -> G
[09:32:59] <rue_house> should turn it off
[09:33:00] <rue_house> yes
[09:33:20] <julius> 100.000 ohm between +5 and gate?
[09:33:21] <rue_house> the 100k will not light the led if the gate is shorted to the D
[09:33:25] <cehteh> not that it matters, but much lower or no resistor
[09:33:36] <rue_house> it does matter for testing
[09:33:43] <cehteh> mkay
[09:34:02] <cehteh> at least when you pwm the fet dont use 100k
[09:34:05] <rue_house> if you use a resistor that can drive the led, then you dont know if the led is on beacuse of the gates supply or if its operating properly
[09:34:15] <julius> i know, for production its like 100ohm
[09:34:27] <rue_house> yes, dont use 100k when operating it with pwm, use 10 ohms
[09:35:03] <rue_house> the fet is turned on by the G-S voltage, so it does batter which way you wire it
[09:35:07] <julius> so if its not shorted, wont i even see something with the 100k?
[09:35:27] <rue_house> also, thats not an irfl, so you want to drive the gate to +10V atleast
[09:35:29] <cehteh> yes ok this way
[09:35:47] <julius> i know its not made for logic
[09:35:51] <julius> but it was available
[09:36:00] <julius> i already ordered "real" ttl fets
[09:36:11] <rue_house> julius, a fet is votlage controlled, 100k is fine to charge and discharge it for testing
[09:36:27] <julius> whats the difference if the load is before D or after S ?
[09:36:46] <rue_house> the voltage determines the on resistance, anyting over about 4V will cause the D-S to go down to atleast 100 ohms
[09:37:00] <julius> yes that makes sense
[09:37:24] <rue_house> julius, if you wire it like you origioanlly said, the load will bring up the S votlage, which will decrease the G-S difference, and turn the fet off more
[09:38:21] <rue_house> if you wan tto get the rated .035 ohms (or whatever it is) you need to drive with about 9 or 10V
[09:38:28] <rue_house> I use 12, cause its usually avialable
[09:39:11] <rue_house> for high current, high speed switching, you have to get really trickey
[09:39:19] <julius> yes the 5v are far to low, but for testing purposes and a load with about 2a i thouhg it would be ok. motor is only running <10s
[09:39:59] <julius> "bring up the s voltage" - what does that mean?
[09:40:29] <rue_house> think about the votlage between the G and S
[09:40:43] <rue_house> if your load is on the S then thats where the voltage drop is
[09:40:56] <rue_house> if the fet is on, the S votlage will go high
[09:41:19] <rue_house> if the S votlage goes high, and the G votlage is high, there is no S-G votlage to keep the fet on
[09:41:42] <rue_house> high side switching with N channel fets is a pain
[09:42:23] <rue_house> most circuits use whats called a 'bootstrap' that uses the output to generate a high voltage just for turning on the fet
[09:42:39] <rue_house> but it dosn't work for prolonged periods at 100% duty
[09:43:42] <julius> so this circuit: https://www.mikrocontroller.net/articles/Datei:Motor_PWM1_real.gif is bad becuase the load is above the fet?
[09:44:13] <rue_house> no, thats the right way around
[09:44:20] <rue_house> source has the arrow
[09:44:21] <julius> oh wait
[09:44:24] <julius> yes sorry
[09:45:16] <rue_house> that circuit should work pretty good, it uses a current source to charge the fet, which usually results in good switching speed
[09:45:42] <julius> ah ok, i get it
[09:45:43] <julius> thanks
[09:46:01] <julius> i only need ~26khz
[09:46:16] <rue_house> I think it'll do that fine
[09:46:25] <julius> my circuit starts at the R2 resistor
[09:46:36] <rue_house> I had challanges at 200Khz :)
[09:46:45] <julius> and the gate is also connected to ground with 10k
[09:46:51] <rue_house> no
[09:47:02] <rue_house> it takes 1A spikes to charge the fet
[09:47:09] <rue_house> I suggest a driver circuit
[09:47:19] <rue_house> the microcontroller cant do it well
[09:47:29] <julius> yes i read about that the capacitance needs to be moved
[09:48:11] <rue_house> the gate of the fet acts like a ~.05uF capacitor
[09:48:14] <julius> is there any driver ic you know on the top of your head that supports 26khz speeds? or is that low anyway?
[09:48:23] <rue_house> yup
[09:48:26] <rue_house> 44??
[09:48:31] <rue_house> irf44??
[09:48:34] <rue_house> hmmm
[09:48:59] <twnqx> why would you use an IC for that...
[09:49:00] <julius> thats a mosfet?
[09:49:10] <twnqx> just either a small logic level mosfet, or pnp
[09:49:25] <rue_house> https://hackaday.io/project/296-bench-power-supply
[09:49:51] <julius> twnqx, good idea
[09:50:11] <julius> do i have to look out for the speeds of transistors?
[09:50:54] <julius> i could use a 547c to switch on the mosfet with 12v to make it go into saturation hard?
[09:50:56] <rue_house> pin 3 of a 555 does a great job actually
[09:51:00] <Lambda_Aurigae> most transistors are going to be far faster than your pwm.
[09:51:54] <rue_house> that circuit you linked is a good one
[09:52:35] <rue_house> IRF4427.
[09:52:49] <rue_house> 2 channel fet driver
[09:52:52] <rue_house> low side
[09:55:16] <julius> ok, gonna take a break and than test the mosfet
[09:55:31] <rue_house> http://www.ebay.ca/itm/10PCS-TC4427CPA-Encapsulation-DIP-1-5A-DUAL-HIGH-SPEED-POWER-MOSFET-DRIVERS-/380926520989
[09:55:46] <rue_house> IR4427 :)
[09:55:48] * twnqx prefers testing of mosfets with spiece beforeand, virtually wiring them up until expected/desired output arrives
[09:55:48] <twnqx> :D
[09:55:59] <twnqx> spice*
[09:56:09] <julius> but im pretty sure its gone. the water pump jumps into action immediately even with a resistor between gate and source and no input
[09:56:53] <julius> is the spiece documentation good?
[09:57:01] <julius> or are there free videos/howtows?
[10:05:18] <rue_house> if you want something that works in a simulator, build it in a simulator
[10:05:30] <rue_house> if you want something that works int eh real world, build it in the real world
[10:05:55] <MrSaturn> Jartza, I think I figured it out. It looks like it stores (PC >> 1)
[10:05:56] <Lambda_Aurigae> or build it in minecraft and connect it to the real world via usb.
[10:23:47] <cehteh> julius: remember the online simulator i sometimes use? thats easy to use
[11:45:11] <PoppaVic> OK, some confusion.. With the atmega1284p - 128K of flash code-space - how the heck do you call (and return) between the 2 64K spaces? Direct or indirect. I can't find one sensible example.
[11:45:16] <PoppaVic> Even jmping direct/indirect would work, if I knew what to shove on the stack in the right order to insure a 'return'
[11:46:56] <twnqx> iirc i saw something about it in the at90can128 data sheet
[11:47:34] <PoppaVic> hmm.. One would hope that applied to the 1284p - I sure hope microchip flogs stuff into shape
[11:47:53] <twnqx> i bet they rather sell the avr cpu department
[11:48:13] <twnqx> my guess is they wanted the flash/eeprom department to consolidate with what they already have
[11:48:22] <PoppaVic> maybe their engineers are rubbing hands gleefully at finally FIXING things ;-)
[11:48:33] <twnqx> they should start with fixing pic
[11:48:42] <twnqx> limited call depth nesting, lol
[11:48:48] <twnqx> the 70s called and want their cpus back
[11:49:29] <PoppaVic> yeah, I got a small pile of pic24's I never used - no one ever replied when I asked wtf programmer I had to invest in. So, I didn't.
[11:49:40] <twnqx> the only thing i'll give pic is io function remapping
[11:49:47] <flyback> JMP! JMP!...................ASM WILL MAKE YA.....JMP! JMP!
[11:50:00] <cehteh> 2 64k spaces?
[11:50:02] <twnqx> looks it's time to isolate flyback again
[11:50:09] <twnqx> yeah, 128kB flash
[11:50:17] <flyback> YOU CAN'T take a joke wtf?
[11:50:31] <cehteh> i thought its addressed by words (16bit)
[11:50:33] <twnqx> oh come on, you obviously neither :P
[11:50:37] <lorenzo> PoppaVic: a pickit3?
[11:50:44] <PoppaVic> yeah. and I was poking around the friggin' web, and there is no example of the silly far call/jmp/indirect
[11:50:46] <flyback> oh I thought it was someone threatening to put me on ignore
[11:50:46] <flyback> nm
[11:50:52] <twnqx> or have you just never heardof isolated flyback smps topologies?
[11:50:56] <cehteh> then one 16bit address can address 128k flash
[11:50:58] <PoppaVic> lorenzo: at this point, I no longer care to invest in pic 'tools'
[11:51:00] <flyback> yeah I know
[11:51:07] <cehteh> (every other byte only)
[11:51:40] <twnqx> cehteh: that's how lpn and friends work, yes
[11:51:41] <PoppaVic> hmm.. cehteh I thought about word-addressing, but the entire eind/z register thing is all I seem to find
[11:51:43] <twnqx> lpm*
[11:52:07] <cehteh> i didnt cared so far
[11:52:20] <twnqx> anyway, gotta go back to cutting http://imgur.com/a/o92mQ down
[11:52:23] <twnqx> bbl
[11:52:41] <cehteh> wtf :D
[11:52:53] <cehteh> .. and i get some screws for my copter frame :D
[11:53:13] <cehteh> https://twitter.com/CehtehCt ...
[11:57:35] <Lambda_Aurigae> twnqx, looks like you gutted a car.
[11:57:46] <Lambda_Aurigae> or, rather, removed the car from the wiring stuff.
[12:01:05] <twnqx> that's what it is
[12:02:02] <PoppaVic> interesting that it claims in one place it's addressed as 64k x 16, and another speaks of byte-addressing
[12:02:52] <Lambda_Aurigae> depends on whether it is program addressing or data addressing.
[12:03:53] <PoppaVic> Lambda_Aurigae: well, I'd agree - but I have yet to see a decent example of code - not data - jumping/calling/returning from one half to the other.
[12:04:56] <lorenzo> http://store.extremeelectronics.co.in/eXtreme-Burner-PIC.html
[12:04:58] <Lambda_Aurigae> PoppaVic, you writing assembly for it I take it?
[12:05:01] <lorenzo> lol this pic programmer has an AVR on board
[12:05:14] <Lambda_Aurigae> lorenzo, I've built avr programmers from pic in the past.
[12:05:17] <PoppaVic> Lambda_Aurigae: I plan to. I've got one to tinker on.
[12:06:03] <Lambda_Aurigae> PoppaVic, IJUMP I think is what you want.
[12:06:05] <julius> assuming the flyback diode is soldered in the right direction, what else can kill a mosfet that can easily handle 10 times the ampere needed by the circuit?
[12:06:51] <Lambda_Aurigae> yeah...IJMP
[12:06:54] <PoppaVic> Lambda_Aurigae: well, this would predicate manually push/pop of eind/zh/zl? to return?
[12:07:05] <Lambda_Aurigae> you load the Z pointer(16 bits) and do an IJMP
[12:08:04] <Lambda_Aurigae> for 256Kbytes/128KWords you use EIJMP
[12:08:15] <Lambda_Aurigae> as for the return, let me check.
[12:08:21] <PoppaVic> Lambda_Aurigae: unless it plans to only run at odd bytes (cell addressing), you still got an eind
[12:08:25] <Lambda_Aurigae> I don't do a lot of assembly like that...mostly assembly subroutines.
[12:08:50] <Lambda_Aurigae> eind is not used for IJMP
[12:09:13] <Lambda_Aurigae> and, yes, commands are always word aligned, never byte aligned.
[12:09:17] <PoppaVic> Lambda_Aurigae: sure. I'm just wondering about how the hell you get above and below the 64K. And, it makes me worry about register-incrementing as it passes over that 64K boundary
[12:09:27] <PoppaVic> hmmmmm
[12:09:35] <Lambda_Aurigae> with EIJMP....and Zreg plus EIND
[12:09:59] <Lambda_Aurigae> http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_EIJMP.html
[12:11:12] <PoppaVic> Lambda_Aurigae: note they mention pc:16 and pc:22
[12:11:40] <PoppaVic> so, the registers are still byte-addressing, even if code has to start at words
[12:11:48] <Lambda_Aurigae> you mean PC(21:16)?
[12:11:54] <PoppaVic> yeah
[12:12:23] <Lambda_Aurigae> PC means program counter.
[12:12:40] <Lambda_Aurigae> on some chips the program counter is 32 bits long.
[12:12:54] <WormFood> I always thought "PC" stood for "Pretty Computer"
[12:13:00] <Lambda_Aurigae> we.., in this case 22 bits long.
[12:13:05] <PoppaVic> I am looking at (i) and (ii) - perhaps I misinterpret it?
[12:13:17] <Lambda_Aurigae> so you are loading program counter bits 15 to 0 with Z bits 15 to 0
[12:13:17] <Lambda_Aurigae> and
[12:13:28] <Lambda_Aurigae> loading program counter bits 21 to 16 with EIND
[12:13:49] <Lambda_Aurigae> PoppaVic, where are you seeing that?
[12:13:51] <Lambda_Aurigae> on the link I posted?
[12:14:13] <PoppaVic> I looked there, then went back to http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_IJMP.html
[12:14:37] <Lambda_Aurigae> ok...that's IJMP...no eind used.
[12:14:53] <PoppaVic> (which was desperation after the datasheet for the 90 and then the 1284p
[12:15:02] <Lambda_Aurigae> (i) is saying that the program counter is only 16 bits on devices with 128K bytes or less.
[12:15:12] <PoppaVic> hmm
[12:15:26] <Lambda_Aurigae> (ii) says the program counter is 22 bits on some chips and can go to 8M
[12:15:57] <Lambda_Aurigae> on the atmega1284p the PC should only be 16 bits.
[12:16:03] <Lambda_Aurigae> so EIJMP is not necessary.
[12:16:05] <PoppaVic> OK, so PC is word-addressed; using Z gives you a 64Kw range.
[12:16:15] <Lambda_Aurigae> yes.
[12:16:18] <PoppaVic> the eind then has to do with byte-addressing?
[12:16:34] <Lambda_Aurigae> eind is used on chips with 256K of flash or more.
[12:16:48] <Lambda_Aurigae> at least when it comes to EIJMP command.
[12:16:59] <Lambda_Aurigae> is not needed for IJMP
[12:17:00] * PoppaVic grumbles about one bloody example of code about these 64K boundaries from atmel..
[12:17:21] <Lambda_Aurigae> there is an example right there on the link you posted.
[12:17:41] <PoppaVic> ok, so I worry about eind on the mega2560, and for the 1284p and 328p, I just worry about Z. Is that accurate?
[12:17:42] <Lambda_Aurigae> r30 and r31 are the Z register.
[12:17:50] <Lambda_Aurigae> correct.
[12:18:02] <PoppaVic> ok. I can live with that conclusion. Thank you.
[12:18:11] <Lambda_Aurigae> so you load the Z register with a 16 bit address and it jumps by word address, not byte address.
[12:18:19] <PoppaVic> ahhh
[12:18:44] <Lambda_Aurigae> all program commands are word aligned...there are 64K possible words on the chip.
[12:18:57] <PoppaVic> I had not seen that anywhere - and days of searching. I kept seeing 8-bit and byte-addressing all over
[12:19:33] <Lambda_Aurigae> I found it in the datasheet somewhere years ago.
[12:20:06] <PoppaVic> I must not use the right search term, then
[12:20:51] <Lambda_Aurigae> ya see,,,I'm one of those people who actually reads the datasheet multiple times all the way through before ever buying the chip.
[12:21:03] <PoppaVic> heh
[12:21:10] <Lambda_Aurigae> and my retention is about 70 to 80 % depending on how awake I am when I read it.
[12:21:43] <Lambda_Aurigae> I don't remember it all in detail but I retain overall information and can regurgitate it and/or where to find it later as needed.
[12:21:59] <PoppaVic> Given how many poor docs I've read over the eons, I went by articles and builds and their comments for the buy. I then search madly thru docs.
[12:22:25] <Lambda_Aurigae> the TTL Cookbook was one of my favorite rereads over the years.
[12:22:34] <Lambda_Aurigae> pages and pages of 74xx datasheets.
[12:26:20] <Lambda_Aurigae> hell, I still have a copy of it I use for reference.
[12:26:36] <Lambda_Aurigae> my current read and reread is the pic32 manuals...
[12:27:43] <Lambda_Aurigae> atmega1284p datasheet vs pic32mx270f256b datasheets...is like the difference between reading The Shining or The Wheel of Time series.
[12:29:18] <PoppaVic> well, my EE buddy hates atmel and avr - he was the one recommended pic24 - he loves his pics.. <shrug> That's the diff between amateur/hobbyist and EE.
[12:29:46] <Lambda_Aurigae> pic has some nifty stuff that avr doesn't
[12:29:47] <WormFood> Is his hate of AVR founded in their higher prices?
[12:29:58] <Lambda_Aurigae> clock for clock I believe avr is faster.
[12:30:12] <WormFood> really Lambda_Aurigae? Like what? Do you think the AVR will get that "nifty stuff", after the merger is completed?
[12:30:13] <Lambda_Aurigae> avr used to be cheaper but pic has beat them out in the last 5 years or so.
[12:30:21] <PoppaVic> no, he had issues with products and support for some project they simply had to abandon - or switch to pic.
[12:30:54] <Lambda_Aurigae> WormFood, I would love to see things like PMP, DAC, and such on AVR
[12:31:00] <PoppaVic> From the sound of it, I suspect they wanted to embed the xmega and finally screamed and gave up
[12:31:10] <Lambda_Aurigae> and would love to see a USB AVR that can sync clock to the usb clock.
[12:31:26] <Lambda_Aurigae> and an AVR in dip package with USB.
[12:31:48] <WormFood> PMP? I don't recognize that TLA
[12:31:53] <Lambda_Aurigae> parallel master port.
[12:32:21] <PoppaVic> yes. microchip acquiring them makes me hope it's for tech and to keep ee's busy fixing, improving and modifying stuff.
[12:33:43] <Lambda_Aurigae> pic chips have a wider variety of peripherals than avr chips do.
[12:33:47] <Lambda_Aurigae> http://www.microchip.com/wwwproducts/en/PIC16F1459
[12:33:55] <Lambda_Aurigae> that's my current play around chip.
[12:37:32] <pepijndevos> How do people generally program attiny chips? Do you write everything from scratch, put Arduino on it, or something inbetween? Like, a tiny collection of utility functions.
[12:37:58] <Lambda_Aurigae> depends on the project pepijndevos
[12:38:10] <Lambda_Aurigae> I generally use a few simple libs and write everything from scratch.
[12:38:16] <pepijndevos> It seems a waste of flash to put a bit library on it, but a waste of time to write everything from scratch.
[12:38:23] <Lambda_Aurigae> but, I also hate arduino almost as much as I hate mickysoft.
[12:38:35] <Lambda_Aurigae> all depends on the lib.
[12:38:46] <Lambda_Aurigae> for tinys I generally do everything in assembly
[12:38:59] <Lambda_Aurigae> but I have assembly libraries to help me do things so I don't have to reinvent the wheel every time.
[12:39:06] <pepijndevos> Lambda_Aurigae, yea, I found Arduino is not very useful beyond the basics.
[12:39:09] <Lambda_Aurigae> most of which I've made myself.
[12:39:27] <Lambda_Aurigae> arduino is bloat to the microcontroller world like windows is to the PC world.
[12:39:58] <pepijndevos> Lambda_Aurigae, are some of the libs you use out there on the web?
[12:40:20] <Lambda_Aurigae> not the stuff I use for the attiny chips.
[12:40:36] <pepijndevos> Assembly would be a challenge, but an interesting one...
[12:40:37] <Lambda_Aurigae> for atmega chips, most of what I use when programming in C I've stolen from somewhere on the web.
[12:40:48] <Lambda_Aurigae> you can do C on most attiny chips these days.
[12:40:51] <PoppaVic> Lambda_Aurigae: sadly, a lot of devices provide "arduino" code - rather than avr-gcc or asm
[12:40:54] <Lambda_Aurigae> but your programs will be very limited.
[12:41:15] <Lambda_Aurigae> read the datasheet...there are C and assembly snippets all through the avr datasheets.
[12:41:41] <PoppaVic> I love to read "How can I convert Arduino source to C?" all over - and the response is inevitably "Arduino is C language"
[12:41:50] <Lambda_Aurigae> assembly isn't so much a challenge as a paradigm shift.
[12:41:59] <Lambda_Aurigae> you learn to do everything one byte at a time.
[12:42:04] <PoppaVic> or word
[12:42:11] <Lambda_Aurigae> arduino is C/C++
[12:42:29] <Lambda_Aurigae> it uses the avr-gcc compiler suite.
[12:42:29] <PoppaVic> But, yes. C makes that more sufferable, but you are at the mercy of compiler and optimizers.
[12:42:45] <Lambda_Aurigae> what it does different, however, is wrap everything in the arduino libs.
[12:42:53] <pepijndevos> Yea, I saw the datasheet, and I can do it without libs... if it makes sense.
[12:43:01] <PoppaVic> the arduino is a c++ perversion of that Processing mess - with java filtering of sources. It's a clusterfuck
[12:43:13] <Lambda_Aurigae> and if you use the wiring lib, you aren't going to do it on an attiny.
[12:43:15] <LeoNerd> Arduino is what makes PORTD |= _BV(PD5); turn from one assembly instruction into about fifty
[12:43:31] <pepijndevos> About how much time and space would you say you waste by using C over assembly?
[12:43:41] <LeoNerd> A fairly small amount
[12:43:45] <PoppaVic> Depends on the job
[12:43:57] <LeoNerd> avr-gcc does a pretty good job at building straightline code
[12:44:02] <PoppaVic> C is certainly far more convenient
[12:44:07] <Lambda_Aurigae> pepijndevos, depends on the project, but, C overhead is considerable on a chip with only 1K of program space.
[12:44:10] <LeoNerd> Certainly, the amount of my development time it saves is definitely worth it
[12:44:16] <PoppaVic> oh god yes
[12:44:25] <Lambda_Aurigae> it all depends on your chip and your project.
[12:44:27] <LeoNerd> I've just finished a project that would not have been possible in the deadline I had, were I writing assembly
[12:44:31] <LeoNerd> So it just would not happen. at all
[12:44:48] <Lambda_Aurigae> Jartza wrote a vga display system in C for the attiny85
[12:44:54] <Lambda_Aurigae> he then rewrote it in assembly
[12:44:59] <Lambda_Aurigae> and added tons of features
[12:45:08] <Lambda_Aurigae> including color using 3 synced attiny85 chips.
[12:45:15] <pepijndevos> I guess I'll start in C and switch to assembly if I run out of space.
[12:45:24] <Lambda_Aurigae> the video display is 512 bytes of ram....the chip only has 512 bytes of ram.
[12:45:28] <LeoNerd> I usually find it's not flash space, it's exact timing requirements
[12:45:31] <Lambda_Aurigae> pepijndevos, what chip do you have?
[12:45:44] <LeoNerd> The one time I wrote anything in inline assembly was exact-timing talking to WS2812 LEDs
[12:45:56] <Lambda_Aurigae> also, with C you tend to run into lack of ram more than lack of program flash.
[12:46:08] <LeoNerd> I'm not sure I'd notice the difference.
[12:46:21] <LeoNerd> As in: if I wrote assembly I'd lay things out the same in memory anyway
[12:46:22] <pepijndevos> I went to the store and said give me tinys, they gave me attiny25... looking at the datasheet, that was not a wise move.
[12:46:27] <Lambda_Aurigae> heap runs into stack and the chip resets...hard one to debug sometimes.
[12:46:34] <Jartza> hmm
[12:46:40] <Lambda_Aurigae> attiny85 would be better.
[12:46:40] <Jartza> yea
[12:46:43] <LeoNerd> In fact I'd be more likely to *waste* RAM because doing things like multiplying array offsets by 5 is harder to write in asm code
[12:46:49] <Jartza> pepijndevos: https://github.com/Jartza/octapentaveega
[12:46:50] <Jartza> :)
[12:46:51] <LeoNerd> So I'd just give up and use 8 instead, and waste 3 bytes per element
[12:46:52] <pepijndevos> I know that *now*
[12:47:13] <Jartza> pepijndevos: that's the VGA... there's links to videos and pics too
[12:47:21] <pepijndevos> Awesome.
[12:47:24] <LeoNerd> Because gcc can efficiently pack those things, and also bitfields in structs,... using C over assembly makes it more likely my RAM footprint is smaller
[12:47:27] <Lambda_Aurigae> pepijndevos, my recommendation for a starting chip, what I use with my students, is the atmega328 or atmega1284p depending on the project.
[12:47:32] <LeoNerd> Just because I'd be lazy when writing assembly code
[12:47:44] <Lambda_Aurigae> LeoNerd, yeah...all depends on the project.
[12:47:53] <pepijndevos> Lambda_Aurigae, I use those all the time.
[12:48:25] <Lambda_Aurigae> in Jartza's case, no way could C do what he did with that chip....he has no room for stack or heap variables as ALL of the ram is used for video memory.
[12:48:47] <Lambda_Aurigae> but I believe there is still quite a bit of flash space left.
[12:48:50] <pepijndevos> But for this project I wanted a grid of small chips talking to each other. So a pin for every neighbor plus a clock line.
[12:49:11] <Lambda_Aurigae> sounds like my RGB christmas lights project.
[12:49:31] <Lambda_Aurigae> only I had 4 wires running to everything...VCC, GND, SCK, DATA
[12:49:55] <pepijndevos> I'm basically building TIS-100 in real life :D
[12:49:58] <Lambda_Aurigae> one atmega1284p feeding 64 attiny25 chips with RGB LEDs connected to each one.
[12:52:59] <PoppaVic> Yeah. I look forward to finishing my 1284p ZIF and getting that thing to wave ;-)
[12:57:27] <Jartza> Lambda_Aurigae: well, not that much flash space left actually
[12:57:33] <Jartza> because I have 5kB of "font data"
[12:57:42] <Jartza> 2.5kB for real font, 2.5kB for "pixels"
[12:57:53] <Jartza> of course, I could generate those pixels in firmware too, but I was just lazy
[12:58:13] <Jartza> Assembly complete with no errors.
[12:58:13] <Jartza> Segment usage: Code : 3372 words (6744 bytes) Data : 512 bytes
[12:58:46] <Jartza> that "graphics" mode though is basically just some curiosity :D
[12:59:36] <Jartza> but I just wanted to display this classic pic https://drive.google.com/file/d/0B2dTzW9TMeBxVTRjUkRGQzJNdlU/view
[13:00:26] <PoppaVic> put the 'font' in eeprom, and it becomes replaceable, no? (slower though, iirc)
[13:00:28] <Lambda_Aurigae> and it works wonderfully for what it is.
[13:00:40] <Lambda_Aurigae> PoppaVic, no...too slow.
[13:00:43] <Jartza> PoppaVic: too slow
[13:00:47] <PoppaVic> yeah, figured
[13:01:03] <PoppaVic> although, you could haul a block to sram
[13:01:04] <Lambda_Aurigae> that thing is sucking every clock cycle possible as it is almost.
[13:01:15] <Jartza> I'm still thinking to make a feature to save current screen to EEPROM
[13:01:25] <Jartza> it would then be able to fetch that screen with some escape code
[13:01:26] <Lambda_Aurigae> PoppaVic, could store an image or such in eeprom.
[13:01:30] <Jartza> and maybe show that on boot
[13:01:35] <Lambda_Aurigae> but there is no free sram to load fonts into.
[13:02:03] <PoppaVic> well, at least yer not using malloc() ;-)
[13:02:13] <Jartza> if someone doesn't like the font, it's easy to modify it:
[13:02:13] <Jartza> https://github.com/Jartza/octapentaveega/blob/master/vgafont.dat
[13:02:21] <Lambda_Aurigae> PoppaVic, he isn't even using interrupts.
[13:02:33] <Jartza> just modify that very free-form ascii file and recompile
[13:02:36] <Lambda_Aurigae> and he is bitbanging 9600bps uart as well.
[13:02:43] <PoppaVic> Lambda_Aurigae: "ouch"
[13:02:56] <Jartza> yeah
[13:02:58] <Lambda_Aurigae> and abusing the USI to generate the vga signal.
[13:03:05] <Jartza> and the UART is actually very very neat trick
[13:03:08] <PoppaVic> pervert ;-)
[13:03:21] <Lambda_Aurigae> and all done in assembly.
[13:03:25] <Jartza> because I sample UART in my HSYNC routine
[13:03:42] <PoppaVic> masochist-pervert ;-)
[13:03:48] <Jartza> which happens 31.46875kHz
[13:03:49] <Lambda_Aurigae> Jartza, that confused the hell out of me at first.
[13:03:58] <Jartza> yea
[13:04:16] <Jartza> 31468Hz isn't exactly divisable with 9600
[13:04:43] <Jartza> it's about 3.28
[13:07:48] <Jartza> and I can't sample every 3.28th hsync :D
[13:08:04] <Jartza> so... I used bresenham to calculate optimal sequence
[13:08:33] <Jartza> which is like, sample uart every 4,3,3,4,3,3,4,3,3,2 'th hsync :)
[13:08:44] <Jartza> if you know the bresenham line drawing algorithm?
[13:08:56] <Jartza> https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
[13:09:02] <Jartza> I reused the idea for UART sampling :)
[13:10:15] <Jartza> the implementation is even more pervert. I put value to register and then shift it and when I get "stop" (which is 0b11) I load new value to that register
[13:10:28] <Jartza> which is magically xorred to get correct value
[13:10:29] <Jartza> :P
[13:10:35] <Jartza> took me a while to get it working
[13:11:14] <Jartza> even if the code does some weird things, I think it's still pretty readable for asm code
[13:11:20] <Jartza> https://github.com/Jartza/octapentaveega/blob/master/vga.asm
[13:14:20] <Jartza> also I'm pretty proud of the horizontal scrolling
[13:14:27] <Jartza> you can either scroll a row or full screen
[13:14:31] <Jartza> only to left, but anyhow
[13:15:22] <Jartza> you can check the videos
[13:15:36] <Jartza> also split screen gtaphics/text :)
[13:57:21] <Jartza> wow.
[13:57:36] <Jartza> seems showing octapentaveega is a good way to silence all conversation :D
[13:57:40] <Lambda_Aurigae> hehe.
[13:57:54] <Lambda_Aurigae> sorry, I was hanging sheets of corrugated steel on my shed.
[13:58:20] <Lambda_Aurigae> https://drive.google.com/open?id=0BxaP1wMEe_6ab3ZHUnJyMEU0b28
[14:07:38] <PoppaVic> ..I was off reading pages and then out to get a beer - seeing as we 'solved' that silly issue
[14:08:31] <PoppaVic> Lambda_Aurigae: for the record? That tin ain't a huge improvement ;-)
[14:08:45] <Lambda_Aurigae> it will be once its painted.
[14:10:41] <Lambda_Aurigae> and it's better protection than what's on there now.
[14:11:19] <Lambda_Aurigae> I'm putting it right up on top of the existing siding which is really thin. That thin stuff is over a thicker 2x6 lapped siding.
[14:12:05] <PoppaVic> yeah, I've seen the construction before - Barns/sheds were usually "just keep snow off"
[14:12:19] <Lambda_Aurigae> the building is over 80 years old.
[14:12:27] <Lambda_Aurigae> original siding is the 2x6 stuff.
[14:13:15] <Lambda_Aurigae> was originally the general store and post office in town.
[14:13:19] <Lambda_Aurigae> then was turned into a garage.
[14:13:51] <Lambda_Aurigae> 2x12 floors for 2/3 of it. The back 1/3 is concrete floor where my woodwork shop is.
[14:14:09] <pepijndevos> If I want to have a bidirectional pin that is pulled high, can I just set PORTB to 0 and change DDB to alternate between high-impedance input and pulling the output low?
[14:14:50] <Lambda_Aurigae> pepijndevos, need more info.
[14:15:42] <Lambda_Aurigae> you want the avr to be able to read the i/o pin,,,set as high-z input,,,and alternately go into output mode, leaving it pulled high normally then pull it low by the avr?
[14:20:35] <Jartza> did I already tell here that I got attiny5 to generate 8-color vga? :)
[14:20:45] <Jartza> ...that puny sot23-6 chip
[14:20:52] <Jartza> and using only 3 pins
[14:21:06] <Jartza> because 1 goes to external oscillator, and of course gnd+vcc
[14:22:57] <Jartza> attiny5 has full 32 bytes of sram, and 512 bytes of flash :)
[14:23:29] <Jartza> https://www.youtube.com/watch?v=qucJMObCUpI
[14:24:16] <Jartza> https://drive.google.com/file/d/0B2dTzW9TMeBxbTQ5WVVRTTRsa3M/view
[14:24:20] <Jartza> that's the circuit
[14:24:29] <Jartza> sot23-6 = attiny5, sot23-5 = oscillator
[14:32:26] <pepijndevos> Lambda_Aurigae, I want to pull it low in output mod and pull it high externally in input mode (so that the other end can pull it low)
[14:32:58] <WormFood> As a test, I'm sending an endless stream, if a single character out of the serial port. After a minute or so, I stop receiving anything on Minicom, but the Tx light is still flickering. A reset of the AVR does nothing, but if I unplug it, and plug it back in, then it seems to work ok. I'm suspecting it's a problem with Linux, but not sure. Anyone have any ideas, or seen this problem before?
[14:33:05] <Lambda_Aurigae> so you will need a moderate pullup resistor on it then.
[14:33:19] <Lambda_Aurigae> 10Kohm maybe
[14:33:41] <Lambda_Aurigae> WormFood, not I.
[14:34:11] <PoppaVic> btw, (this is prolly a dumb question): why is it that the bootloaders and hosts don't "negotiate" a bps speed?
[14:34:26] <Lambda_Aurigae> PoppaVic, additional code.
[14:34:37] <PoppaVic> Lambda_Aurigae: would it be that heavy?
[14:34:50] <Lambda_Aurigae> I often do speed negotiation on my serial stuff if I don't use a crystal on the avr.
[14:34:57] <WormFood> I wonder if it might be because of the error rate. I'm running it a little outside if Atmel's recommended max error rate, but well within the maximum error rate. I've changed to 1mbit, which has 0.0% error rate, which hasn't stopped yet.
[14:35:23] <Lambda_Aurigae> WormFood, possibly, maybe?
[14:36:00] <WormFood> well, based on the short time this has been running without a problem, I'm suspecting that is the root of this problem.
[14:36:06] <Lambda_Aurigae> PoppaVic, it is an additional 100 to 200 bytes depending on how it's done at the avr side...can be done much smaller if you put the bulk of it on the PC side.
[14:36:19] <WormFood> I just changed it, before I asked, and it's been working flawlessly longer than normal ;)
[14:36:22] <Lambda_Aurigae> can probably be done much smaller on the avr side too.
[14:36:25] <PoppaVic> yeah, that's what I was thinking
[14:36:31] <PoppaVic> got any links?
[14:36:45] <Lambda_Aurigae> not of any of my code.
[14:36:53] <Lambda_Aurigae> I use the UUUUUU method.
[14:37:02] <WormFood> I'm wondering if the serial-to-usb converter may be glitching or something.
[14:37:13] <Lambda_Aurigae> send a stream of UUUUU from one end and adjust the other until you see it stable then send an OK response back.
[14:37:14] <PoppaVic> no, I meant to any negotiation code for either
[14:37:17] <PoppaVic> OK
[14:37:23] <Lambda_Aurigae> from the PC, send UUUUUU.
[14:37:30] <WormFood> why "U"?
[14:37:38] <PoppaVic> magic bits
[14:37:39] <Lambda_Aurigae> on the AVR, start at a base speed and watch for incoming data.
[14:37:45] <Lambda_Aurigae> look at the bit pattern for U
[14:37:46] <WormFood> alternating bit pattern?
[14:37:56] <WormFood> That'd be my guess.
[14:38:53] <Lambda_Aurigae> decimal 85, hex 55, binary 01010101
[14:39:20] <PoppaVic> http://www.avrfreaks.net/forum/autodetect-baud-rate
[14:39:23] <Lambda_Aurigae> some systems actually watch for the bit pattern by oversampling then figure the speed from that.
[14:39:29] <WormFood> oh, you mean in ASCII :P
[14:39:56] <Jartza> hmm
[14:39:57] <WormFood> I was thinking you were using EBCDIC
[14:40:00] <Jartza> I had a crazy idea
[14:40:00] <WormFood> :P
[14:40:05] <Jartza> this sort of "emergency avr programmer"
[14:40:09] <Lambda_Aurigae> yeah....ascii.
[14:40:14] <Jartza> using audio and only passive components
[14:40:21] <Lambda_Aurigae> Jartza, I thought you did that.
[14:40:30] <WormFood> an "emergency avr programmer", is a 25-pin connector, and 4-5 resistors, on a parallel port :P
[14:40:30] <Jartza> Lambda_Aurigae: well, Tagsu has this audio bootloader, yes.
[14:40:42] <Jartza> Lambda_Aurigae: but now I'm talking like talking directly to ISP
[14:40:44] <Lambda_Aurigae> WormFood, better yet, an ide port.
[14:40:55] <Jartza> no bootloader required :)
[14:40:56] <WormFood> why an IDE port?
[14:41:12] <WormFood> It may be possible, but I doubt it, due to lack of control.
[14:41:13] <Lambda_Aurigae> WormFood, why not? just ask rue_house, rue_bed, rue_shop3
[14:41:16] <Lambda_Aurigae> he did it once.
[14:41:20] <Lambda_Aurigae> I've duplicated it.
[14:41:21] <WormFood> really?
[14:41:23] <Lambda_Aurigae> it works.
[14:41:31] <WormFood> using PATA?
[14:41:31] <Lambda_Aurigae> you trick the system into thinking the ide port is a parallel port.
[14:41:33] <Lambda_Aurigae> yeah.
[14:41:43] <WormFood> what? parallel port?
[14:42:04] <Lambda_Aurigae> you load the linux parallel port driver to point at the ide port instead.
[14:42:14] <WormFood> You sound like you're crazy. I'm pretty knowledgeable, but I've never heard this before.
[14:42:23] <Lambda_Aurigae> let me find the webpage.
[14:42:31] <WormFood> great. I was about to start searching
[14:43:04] <Lambda_Aurigae> https://forbharat.wordpress.com/2011/02/04/avr-programmer-isp-stk200-using-old-pc-hard-disk-pata-port/
[14:43:24] <WormFood> ugh. wordpress...it's blocked here...maybe I have it routed over the vpn.
[14:43:30] <pepijndevos> What does the pin register contain when a pin is in output mode? As I understand it, DDRx sets input/output, PORTx sets high/low or pullup/no pullup. and PINx in input is the pin value, but in output?
[14:43:35] <Lambda_Aurigae> http://hackaday.com/2011/02/03/stk200-pocket-change-programmer/
[14:43:51] <Lambda_Aurigae> rue's website is down or changed though.
[14:44:51] <Lambda_Aurigae> http://www.pjrc.com/hub_isp/ for when you are really desperate for an avr programmer
[14:45:38] <WormFood> I'm still confused, as how the PATA port, can be accessed as a parallel port.
[14:45:52] <WormFood> How can the driver work? It's different hardware.
[14:46:18] <WormFood> actually, for IDE, it's a bus.
[14:46:19] <Lambda_Aurigae> using some 74xx glue logic.
[14:46:37] <Lambda_Aurigae> to pseudo-emulate the parallel port interface.
[14:46:37] <WormFood> still doesn't make sense.
[14:46:51] <Lambda_Aurigae> ide gives you bus interface, yes.
[14:47:08] <Lambda_Aurigae> the driver doesn't care what is connected at that particular i/o port memory location.
[14:47:17] <Lambda_Aurigae> so long as it responds properly.
[14:47:46] <WormFood> Right
[14:48:07] <WormFood> But you're saying that interface (in hardware), is the same for the parallel port, and the ide port?
[14:48:08] <Lambda_Aurigae> when rue gets back online ask him for the correct page.
[14:48:29] <Lambda_Aurigae> with a little 74xx logic tied to the ide port, it functions like a parallel port.
[14:48:32] <WormFood> I wished to hell, he'd put his stuff on a real web server, on a real IP
[14:48:37] <WormFood> I know his IP is static
[14:48:47] <pepijndevos> Ah, "If port is made output, then reading PINx register will give you data that has been output on port pins."
[14:48:55] <Lambda_Aurigae> the interface from the PC side is the same..just a bus interface to a memory mapped i/o port.
[14:49:17] <Lambda_Aurigae> pepijndevos, sorry,,,was on to other things and missed your question.
[14:49:31] <pepijndevos> no problem, solved my own issue :D
[15:15:35] <pepijndevos> Is there a more efficient way to set or clear a bit depending on the value than an if statement?
[15:16:06] <pepijndevos> if (val){ DDRB &= ~(_BV(pin)); } else { DDRB |= _BV(pin); }
[15:16:14] <WormFood> fuuuck....now Minicom stopped receiving data...I still suspect the problem is on the pc side
[15:16:30] <WormFood> pepijndevos, use ? :
[15:17:13] <pepijndevos> WormFood, is that actually more efficient, or just shorter?
[15:17:49] <WormFood> hhhmmm, not sure how the &= and |= part would work with ?:
[15:18:28] <Thrashbarg> DDRB = val ? DDRB & ~(_BV(pin)) : DDRB | _BV(pin);
[15:18:30] <WormFood> pepijndevos, it depends on other factors. I believe it's actually faster in most instances. You'd have to run some tests to find out. It should be easy enough to do. Just count a timer ;)
[15:18:35] <WormFood> no
[15:18:53] <WormFood> er...actually, I think that would work.
[15:19:19] <WormFood> you will probably need to use () around your values (right and left of : )
[15:19:22] <Thrashbarg> yeah
[15:19:58] <pepijndevos> sweet
[15:20:02] <Thrashbarg> I'm wondering if it could be done with tricky use of the XOR function :P
[15:20:23] <WormFood> you may be able to remove the 2nd and 3rd DDRB. You'd have to experiment with it a bit, and see what works, or read up on the specs.
[15:21:12] <Thrashbarg> WormFood: it'd need the second DDRB's because DDRB |= _BV(pin) is the same as DDRB = DDRB | _BV(pin)
[15:21:39] <Thrashbarg> if you wanted to really do it well you'd create some assembler macros to use the bit set/clear assembler commands
[15:21:58] <Thrashbarg> which probably already exist
[15:23:15] <WormFood> I understand how |= works Thrashbarg :P
[15:23:29] <WormFood> but ?: doesn't work the way many people thinks it works.
[15:23:43] <Thrashbarg> yea
[15:23:52] <Thrashbarg> brackets then :P
[15:23:55] <WormFood> it's more than just an if-then-else shorthand.
[15:25:31] <WormFood> I mean, it works slightly differently than that, but is frequently used as that.
[15:25:44] <WormFood> I tend to use ?: a lot.
[15:25:58] <WormFood> I even cascade them ??::?:
[15:26:05] <Thrashbarg> oh jeez haha
[15:26:20] <Thrashbarg> my C isn't quite that good :P
[15:27:10] <Thrashbarg> bah surely someone's made an inline assembler macro to use the SBI and CBI op-codes :/
[15:27:44] <WormFood> $longmode?($bitrate<500000?" Kbps":" Mbps"):($bitrate<500000?"K":"M")); <-- here is a line from avrbaudcalc.php ;)
[15:28:06] <Thrashbarg> hehe
[15:28:55] <WormFood> It doesn't look so hairy in person, but when you see ??::?: it looks insane.
[15:29:10] <Thrashbarg> PHP come LISP come PERL
[15:29:20] <WormFood> ?(?:):(?:)
[15:29:34] <WormFood> (.)(.)
[15:29:38] <WormFood> :D
[15:29:40] <Thrashbarg> yes haha
[15:30:05] <WormFood> or, ( . )( . ) if you prefer
[15:30:38] <WormFood> (。)(。)
[15:32:38] <PoppaVic> ?: ala C? so badly used and misunderstood.
[15:48:43] <Jartza> WormFood: that isn't even bad :)
[15:49:03] <Jartza> I had to cramp some code into unreadable mess when I had to fit tagsu firmware into 6kB :D
[15:49:09] <Jartza> there are certain things...
[15:49:18] <Jartza> font[j] = (pgm_read_word(addr + ((((i > 3 ? j + 8 : j) + y_off) & 0x0F) << 1)) << (5 - x_off) >> (3 - (i & 0x03)) * 5) & 0x1F;
[15:49:21] <Jartza> like that
[15:49:36] <Jartza> it was on multiple lines, but putting that into one sentence for some reason optimizes much better
[15:49:51] <Jartza> and I saved 20 bytes
[15:49:55] <WormFood> yeah, that doesn't look bad
[15:51:20] <Jartza> well I generally hate stuff like that
[15:51:32] <Jartza> usually I like to write more readable code
[15:51:48] <PoppaVic> Jartza: dude, it OPTIMIZED better on one LINE? wtf compiler was that nonsense?
[15:52:01] <Jartza> it's called gcc
[15:52:11] <PoppaVic> why the hell would the LINE matter?
[15:52:27] <Jartza> because I don't have to create that many local variables to stack
[15:53:12] <PoppaVic> umm... we have different ideas of "line", then.. All of that could be formatted on multiple lines
[15:53:43] <Jartza> well... pgm_read_word returns uint32_t
[15:53:43] <WormFood> Jartza, are you talking about changing the whitespace, or actual code?
[15:53:48] <Jartza> that needs to be stored somewhere
[15:53:57] <Jartza> WormFood: code, of course
[15:54:05] <Jartza> uint32_t line = pgm_read_word(addr + ((((i > 3 ? j + 8 : j) + y_off) & 0x0F) << 1));
[15:54:08] <Jartza> font[j] = (line << (5 - x_off) >> (3 - (i & 0x03)) * 5) & 0x1F;
[15:54:31] <Jartza> make it like that and it'll already grow 8 bytes
[15:54:39] <Jartza> split it even more and you get more bytes
[15:56:50] <julius> that is ugly code
[15:56:53] <julius> nobody should use that
[15:56:54] <Jartza> it is
[15:57:03] <Jartza> it was much prettier
[15:57:08] <Jartza> but I ran out of flash :)
[15:57:11] <julius> unless you want to confuse someone ;)
[15:57:17] <julius> ok
[16:05:29] <Jartza> luckily only I need to work with that code
[16:10:00] <julius> how does that line reduce flash usage?
[16:10:10] <julius> ah
[16:10:12] <julius> i backread
[16:10:18] <julius> optimization
[16:10:55] <julius> https://www.mikrocontroller.net/wikifiles/0/01/Motor_PWM1_real.gif - when no motor is connected, it should be possible to measure D versus S resistance...or?
[16:34:26] <julius> cehteh, i just read the most amusing story about some guys figuring out what power supply to buy for a car washer pump for their fish tank
[16:37:30] <julius> in german
[18:39:32] <rue_bed> WormFood, you can run a avrisp from an ide port
[18:39:43] <rue_bed> I'm the only one in the world to have done it
[18:39:54] <rue_bed> and the only reason I did was to prove I could
[18:40:15] <rue_bed> I can link you if you want
[18:40:27] <rue_bed> just search for it on hackaday th
[18:40:28] <rue_bed> o
[18:40:34] <Lambda_Aurigae> rue_bed, your link off the hackaday doesn't work nymore.
[18:40:44] <Lambda_Aurigae> anymore
[18:40:45] <rue_bed> oh
[18:40:47] <Lambda_Aurigae> I tried earlier.
[18:40:52] <rue_bed> I wonder what changed
[18:41:17] <Lambda_Aurigae> dunno, but it don't link nomore.
[18:41:49] <rue_bed> http://ruemohr.org/~ircjunk/tutorials/elex/ata2isp/main.html
[18:44:49] <rue_bed> :P
[18:44:59] <Lambda_Aurigae> spanks.
[18:46:30] <rue_bed> I AM hardware hacker, I used a 2 channel scope to trace the execution of a vetrex machine to being stuck on a loop waiting for its 6522 timer flag, changed the 6522, happy as a clam
[18:46:42] <Lambda_Aurigae> hehe.
[18:46:43] <rue_bed> some moments are glorious
[18:47:06] <Lambda_Aurigae> between you and Jartza, we are in genius company here.
[18:58:23] <cehteh> julius: link?
[19:00:35] <cehteh> julius: this driver circuit you posted earlier (and weeks ago) did you build that? looks a bit overcomplicated to me, why different diodes .. and motor flyback diode is completely oversized
[19:01:33] <julius> yeah, my local conrad didnt have the parts i wanted
[19:01:51] <julius> and it was my first dc motor design for 2a...so i went overboard
[19:02:17] <cehteh> possibly works only bat42 and bc547 only, maybe little change in resistor values
[19:02:42] <julius> http://codepad.org/zP55wmsa
[19:03:05] <cehteh> and you may want to add a small (10nF) cap over the motor terminals (parallel to the diode)
[19:03:43] <julius> cehteh, i did built it. but it doesnt work as expected....sometimes the motor just runs and keeps running even if theres no signal...and sometimes it wont start at all
[19:04:06] <cehteh> i recommended you a pullsdown at the input
[19:04:08] <julius> got that, 1000uf
[19:04:19] <julius> let me show you my "real" circuit:
[19:04:30] <cehteh> nah not that 1000µF
[19:04:31] <julius> http://electronics.stackexchange.com/questions/221758/mosfet-resistance-between-drain-and-source-in-circuit
[19:04:39] <cehteh> thats around the fet as well
[19:04:44] <julius> ah ok
[19:04:52] <cehteh> i mean 10nF only over the motor terminals
[19:05:06] <julius> what will that do?
[19:05:07] <cehteh> "Entrörkondensator"
[19:05:10] <cehteh> s
[19:05:13] <julius> ok
[19:05:22] <cehteh> reduce the sparking at the brushes
[19:05:53] <cehteh> 10nF is only a guess .. 100nF may do too
[19:05:55] <cehteh> just try
[19:05:58] <julius> oh, i did put the "kondensator" in the wrong place here...its over the fet too
[19:06:15] <cehteh> the 1000µF should be over the fet
[19:06:21] <julius> yes
[19:06:21] <cehteh> but not the 10nF
[19:06:47] <cehteh> thats one should be directly acros the motor terminals
[19:08:24] <cehteh> https://www.mikrocontroller.net/attachment/161993/Gleichstrommotor.gif
[19:20:24] <julius> looks like i soldered a short into the circuit, led on a breadboard from the same power supply goes out when i connnect + and -
[19:20:32] <julius> dont worry, i only touched -
[19:20:51] <julius> will go over it tomorrow
[19:28:38] <cehteh> freenode hickup?
[19:33:08] <julius> ?
[20:32:25] <flyback> <cehteh> julius: this driver circuit you posted earlier (and weeks ago) did you build that? looks a bit overcomplicated to me, why different diodes .. and motor flyback diode is completely oversized
[20:32:33] <flyback> THAT'S WHAT SHE SAID\
[20:35:28] <julius> yeah yeah ;)
[20:35:50] <julius> she was telling you that your fingers are to big ;)