#avr | Logs for 2014-04-29

Back
[02:08:50] <PHPtest> hi guys, anybody here programming avr in basic?
[02:21:03] <Xark> PHPtest: You mean like BASIC compiler?
[04:01:56] <PHPtest> Xark sry havent seen that you have written, yes BASIC compiler
[04:02:31] <PHPtest> also i have another question, is it possible to disable and reenable interrupts on runtime on Xmega 128A3
[04:02:51] <PHPtest> i have a code here whitch one does it, and im not sure if thats even possible
[04:05:33] <Fleck> heh, I remmember, I joined #avr :D it was like I was swearing or smthn! :D
[04:07:18] <Fleck> (joined and asked about BASIC) :D
[04:09:24] <PHPtest> Fleck?
[04:09:39] <Fleck> :)
[04:10:00] <PHPtest> You mean you remember when you joined avr you used BASIC? or i dont understand, my english is poor, sry
[04:10:40] <PHPtest> ah i get it now, first time when u joined #avr u also asked about BASIC?
[04:10:46] <Fleck> yep :D
[04:10:56] <Fleck> and the respond was not good! :)
[04:10:56] <PHPtest> ^^
[04:11:08] <PHPtest> Fleck i guess because its off topic here
[04:11:18] <Fleck> It felt like word "BASIC" is a bad word here :P
[04:11:21] <PHPtest> but i cant find any support for it elsewhere
[04:11:59] <PHPtest> Fleck anyway, i will rewrite the code in C, i just got a code in BASIC and have no ideea what it does mainly
[04:12:30] <PHPtest> Fleck but what i can see that it enables and disables interrupts on runtime, and as how i can remember thats bad, i mean mainly impossible
[04:12:36] <PHPtest> but correct me if im wrong
[04:13:29] <Fleck> why is it bad? If you don't mind missing some interrupts - then it's ok to disable them when CPU cycles are needed for something else!
[04:14:00] <PHPtest> Fleck, but on runtime? then enabling them back? is that possible?
[04:18:53] <Fleck> PHPtest: yes it is
[04:20:06] <Fleck> PHPtest: http://www.atmel.com/Images/Atmel-8068-8-and16-bit-AVR-XMEGA-A3-Microcontrollers_Datasheet.pdf << page 60, sei and cli!
[04:23:13] <OndraSter_> it is fairly normal thing
[04:23:35] <OndraSter_> you do not miss any interrupts in theory - they stack up and once you re-enable them, they fire up (of course unless it would have happened twice, then you miss it)
[04:25:16] <Valen> some can conflict as i recall
[04:25:27] <Valen> i could well be wrong about that though
[04:25:54] <Valen> IF if interrupt A and B fire you may see B but A and B wind up with the same flag or some such
[04:28:25] <inflex> Anyone created an AVR controlled SMS GSM module?
[04:28:35] * inflex wants to send/receive SMSs from his Linux box
[04:29:29] <inflex> ( tying in with my repair business, so I can keep track of everything and keep clients updated on their statuses ). Was planning on going PC(linux) ---usb--->AVR---SPI/TWI-->GSM module
[04:30:41] <OndraSter_> Valen, if they share the IF then yes, but can not think of any that do
[04:36:31] <PHPtest> Fleck but in this code an interrupt occurs and the guy before running the code from the isr disabbles all other interrupts one by one and after that he enables them back again, is that fine?
[04:37:41] <PHPtest> Fleck like this: http://pastie.org/private/bdig5go6bcywmdohq6aww
[04:39:08] <Fleck> meh, dunno, maybe in some conditions this is a good idea, sure that ALL are disabled? maybe some are still left on?
[04:48:32] <PHPtest> FLeck im not sure about anything in this code, but does it need to be all disabled?
[04:49:10] <PHPtest> Fleck and i can see "for" in some interrupts, also thats bad i guess, so robbust interrupts...
[04:49:36] <Fleck> it all depends PHPtest
[04:50:11] <PHPtest> Fleck i know but i try to debug it, because one interrupt without the other one works, when both enabled it stops working
[04:50:51] <PHPtest> Fleck im at school and some other coleagues wrote this buggy code, i got this project to work with it in some other project, but it wont work
[04:51:30] <PHPtest> when i remove a part of the code the other part works fine, when i remove the other part then the first part works fine
[04:51:46] <PHPtest> i dont understand why becase both of them using different interrupts
[04:59:34] <vsync_> i believe the solution is to use a php interpreter in the mcu
[04:59:46] <vsync_> it's probably more familiar to you
[04:59:52] <OndraSter_> D:
[04:59:53] <OndraSter_> PHP?!
[04:59:54] <OndraSter_> D: D:
[05:00:01] <vsync_> a wild php interpreter appears. It's super effective
[05:00:08] <OndraSter_> is it?
[05:00:14] <vsync_> totally.
[05:00:20] <OndraSter_> lol
[05:00:58] <Fleck> not cool vsync_, guy needs help!
[05:32:38] <PHPtest> vsync_ probably if it would have been a simple vga protocol, it would have been easier ^^
[05:33:13] * PHPtest joking xD
[05:35:08] <PHPtest> Fleck what ive found out that "the other part" of the code is simulating usart with timer interrupts, and the buffer is a simple variable
[05:35:23] <PHPtest> i guess that variable is empty or shitty because other interrupts are breaking it
[05:36:28] <PHPtest> but i dont understand why it affects the "first part of the code" where data is read on modbus.. so even an interrupt should not affect that
[05:48:09] <superware> I'm thinking about an attiny25/45/85 to for motor quadrature decoding (via pin change interrupt) and act as an SPI slave to supply last position, does this setup sound right?
[05:53:07] <superware> anyone?
[06:02:20] <superware> joh__: hi, do you happen to have any SPI experience?
[06:02:53] <vsync_> Fleck: not cool to be a software "engineer"
[06:03:02] <joh__> superware: sorry I do not, I joined this channel when trying to get I2C
[06:07:03] <vsync_> SPI is the easy part
[06:07:10] <vsync_> twi is bollocks
[06:07:48] <Fleck> so why are you vsync_? :D
[06:09:21] <vsync_> focus on the issue at hand
[06:19:30] <Fleck> so why don't you vsync_? :D
[06:19:56] <vsync_> such a good joke, do it one more time
[06:23:22] <Fleck> you are a joke, not good though!
[06:24:59] <vsync_> oh touché, that thing about software people hit a nerve?
[06:25:16] <vsync_> http://iop.io/ on the topic, this is totally the answer to all of our prayers.
[06:34:18] <superware> vsync_: TWI is actually I2C, right?
[06:53:47] <vsync_> yes
[06:58:34] <anton02> you can replicate the functionality of a h-bridge with just transistors cant you?
[06:59:03] <anton02> this guy is using 4 for some reason
[06:59:03] <anton02> http://www.youtube.com/watch?v=zZYnBvI5L14
[07:06:59] <Thrashbarg> anton02: sure, if you design it correctly
[07:09:50] <anton02> Thrashbarg: all i was going to do is use 1 transistor to give the dc motor negative voltage and the other transistor to give the motor positive voltage, and a microchip will control which one gets turned on. Also, there'd be 4 wires going to the dc motor. 2 from one transitor and 2 from the other.
[07:10:56] <Thrashbarg> thing is you can't just replace the FETs with transistors and expect it to not blow up
[07:11:30] <Lambda_Aurigae> anton02, yeah,,,4 transistors...2 pnp, 2 npn..a few resistors and away you go.
[07:11:45] <Lambda_Aurigae> you need 4 for the H-Bridge..can't do it with just 2.
[07:11:55] <anton02> so youre saying you do need 4 and not 2?
[07:12:07] <Lambda_Aurigae> yes...need 4 for an H-bridge.
[07:12:16] <Lambda_Aurigae> 2 of them for each side of the motor.
[07:12:23] <anton02> that guy uses 4 of the same type i think
[07:12:26] <Lambda_Aurigae> unless you have 2 power sources.
[07:12:31] <Thrashbarg> the whole thing about an H bridge is it uses 4 transistors lol
[07:12:56] <anton02> that guy uses 4 TIP122 trannys
[07:13:01] <Lambda_Aurigae> if you have 2 batteries with the + and - connected at a common GND reference then you can use 2 transistors to drive a motor.
[07:13:14] <Thrashbarg> you'll need level converters too
[07:13:53] <Lambda_Aurigae> there are many ways to build an H-bridge...with all the same transistors, 2 of each, all the same fets/mosfets, or 2 of each....
[07:13:57] <Lambda_Aurigae> or just buy one.
[07:14:09] <Thrashbarg> heh
[07:14:51] <Lambda_Aurigae> or sample some from allegromicro.com
[07:15:07] <Lambda_Aurigae> or steal them out of old copiers.
[07:15:15] <Lambda_Aurigae> I get a lot of parts from old copiers.
[07:15:27] <Lambda_Aurigae> lots of mosfets and motor controller chips and motors and stuff.
[07:15:41] <anton02> i found one in a remote control car but i threw it in the bin cause i didnt know what it was
[07:15:52] <Lambda_Aurigae> although, the motors are all 24V, but, I have a couple of functional power supplies from copiers too that give me my 24V.
[07:16:12] <Lambda_Aurigae> it helps that I fix copiers for a living too....muahahahaha
[07:16:27] <Lambda_Aurigae> have 2 of them in my shed ready to be disassembled, maybe this weekend.
[07:17:52] <anton02> tip122s look like darlingtons
[07:18:41] <vsync_> if we are talking high power stuff here I'm thinking you should lay it down
[07:18:42] <Lambda_Aurigae> they are..
[07:18:45] <Lambda_Aurigae> npn-darlingtons.
[07:19:07] <vsync_> Do you understand the principle of an h-bridge?
[07:19:19] * Lambda_Aurigae raises his hand...I do I do!
[07:19:30] <anton02> it reverses the polarity
[07:19:44] <Lambda_Aurigae> built my first one with one of those switches that looks like it comes from a frankenstein movie.
[07:20:01] <Thrashbarg> reverse the polarity and reconfigure the matrix subroutines! <-- trekkies
[07:20:18] <Thrashbarg> Lambda_Aurigae: knife switches?
[07:20:20] <Lambda_Aurigae> http://en.wikipedia.org/wiki/File:DPDT_knife_switch_in_closed_position.jpg
[07:20:22] <Lambda_Aurigae> yup.
[07:20:39] <Lambda_Aurigae> a 2p2d knife switch makes a great H-bridge controller..or it did when I was 10.
[07:20:53] <Thrashbarg> any DPDT switch does, yes
[07:21:05] <Lambda_Aurigae> yeah, but that has forward/off/reverse
[07:21:13] <Thrashbarg> centre off? :P
[07:21:30] <Lambda_Aurigae> yeah..if the switch isn't pushed to either side then it's off.
[07:21:45] <Thrashbarg> I know, I mean any DPDT switch with a centre off
[07:22:18] <Lambda_Aurigae> also remember using a dpdt switch and a pair of solenoids to make an RC car reversable.
[07:22:37] <Thrashbarg> heh
[07:23:05] <vsync_> that's... cool
[07:23:10] <Lambda_Aurigae> it was back when I didn't fully understand how to build an H-bridge out of transistors so I did it electro-mechanically.
[07:23:23] <Thrashbarg> yup
[07:23:25] <Lambda_Aurigae> the solenoids would kick the switch to forward or backwards.
[07:23:29] <anton02> wonder why DC motors often have caps across the terminals
[07:23:39] <Lambda_Aurigae> anton02, noise supression.
[07:23:46] <vsync_> derp
[07:24:36] <Thrashbarg> anton02: the switching noise on the commutator gets suppressed
[07:24:39] <Lambda_Aurigae> oh man..I should get a set of walkie talkies and recreate my old rc car design.
[07:25:03] <Lambda_Aurigae> did it with tone generators and LC discriminator circuits
[07:25:12] <Thrashbarg> wow
[07:25:30] <Thrashbarg> heh in the 70's British Rail did something similar with signal multiplexing
[07:25:43] <Thrashbarg> in the signal boxes
[07:25:49] <Lambda_Aurigae> build an LC, figure out the approximate frequency, then build a tone generator with a 555 or a 2 transistor oscillator,,,and tune it till the discriminator triggered.
[07:25:58] <Thrashbarg> but they used mechanical frequency division multiplexing because it was more accurate than LC
[07:25:59] <vsync_> ermahgerd, hack a train
[07:26:19] <vsync_> just find the right whistle
[07:26:25] <Thrashbarg> yup
[07:26:29] <Lambda_Aurigae> my RC car had been one of those kids battery powered ride on cars...
[07:26:50] <Lambda_Aurigae> hard to believe those things existed when I was a kid too....38ish years ago...
[07:27:00] <Lambda_Aurigae> 36ish years ago...something like that.
[07:27:44] <Thrashbarg> there's footage of Prince Charles driving a small electric car in the 50's some time
[07:27:49] <Thrashbarg> when he was a kid
[07:28:08] <Thrashbarg> but then, he was rich... no peddling for him!
[07:28:09] <vsync_> there's footage of german bombing london
[07:28:20] <vsync_> add y in there somewhere...
[07:30:22] <anton02> all i wanted to do is connect emitter of tran. A to + terminal of DC motor and connect emitter of tran. B to - terminal of DC motor. base of A goes to pin X of IC. base of B goes to pin Y of IC
[07:32:03] <Thrashbarg> http://www.talkingelectronics.com/projects/200TrCcts/images101-200/H-Bridge-1.gif
[07:32:15] <Thrashbarg> well, there's one way to make it and simplify the control process
[07:34:46] <anton02> annoying this i need 2 h-bridges and they sell for $30 a pop http://www.ebay.com.au/itm/H-Bridge-Motor-Driver-Shield-for-Arduino-/310869536782?pt=AU_B_I_Electrical_Test_Equipment&hash=item486144b00e
[07:36:15] <anton02> oh, that actually controls 2 motors which isnt so bad i guess for $30
[07:38:14] <Lambda_Aurigae> http://www.ebay.com.au/itm/Dual-H-Bridge-L298N-DC-Stepper-Motor-Driver-Module-Controller-Board-for-Arduino/261364656280?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222003%26algo%3DSIC.FIT%26ao%3D1%26asc%3D20140106155344%26meid%3D6545661667650816684%26pid%3D100005%26prg%3D20140106155344%26rk%3D3%26rkt%3D6%26sd%3D310869536782&rt=nc
[07:38:23] <Lambda_Aurigae> eeww...I hate those ebay links.
[07:38:40] <Lambda_Aurigae> but, dual h-bridge using a venerable l298n
[07:39:01] <anton02> yeah china though which still takes ages to ship to australia
[07:39:16] <Lambda_Aurigae> or just get an h-bridge chip locally and make one yourself.
[07:39:32] <anton02> where from?
[07:39:57] <Lambda_Aurigae> sparkfun or any of a number of electronic supply companies.
[07:40:06] <Lambda_Aurigae> https://www.sparkfun.com/products/9479
[07:40:34] <Lambda_Aurigae> that will play dual h-bridge or stepper controller..
[07:41:17] <Lambda_Aurigae> easy to work with, hard to kill, 2A per channel, up to 46V motor drive voltage.
[07:41:27] <Lambda_Aurigae> and easy to heatsink.
[07:41:51] <anton02> I wonder if this could do the same http://www.jaycar.com.au/productView.asp?ID=ZK8874
[07:43:07] <superware> can an atmega25/45/85 act as a SPI slave? receiving a 1-byte (command) and sending 2-byte (data)
[07:44:29] <Lambda_Aurigae> superware, probably
[07:44:39] <Lambda_Aurigae> except
[07:44:40] <Lambda_Aurigae> there is no atmega24/45/85
[07:44:42] <Lambda_Aurigae> it is an attiny
[07:44:44] <superware> sorry attiny
[07:44:47] <superware> :)
[07:45:46] <anton02> i have 3 darlington NPN transistors
[07:45:52] <anton02> guess thats not enough is it
[07:46:54] <superware> Lambda_Aurigae: why do you say "probably"?
[07:46:54] <anton02> though i do have a couple of lower current transistors as well. thing is their current rating is less than the motors stall current
[07:47:08] <Lambda_Aurigae> anton02, the l6201 is a single h-bridge.
[07:47:40] <Lambda_Aurigae> superware, because I'm not sure if you can do slave spi in hardware or will have to bitbang it.
[07:55:39] <anton02> Lambda_Aurigae: what happens if you make a DC motor stall but you dont allow that much current to run through the collector?
[07:55:57] <anton02> eg motor has stall current of 2A but you only allow 1A through collector
[07:56:43] <anton02> sorry i mean emitter
[08:01:44] <superware> Lambda_Aurigae: can't USI be used?
[08:02:59] <anton02> Beta=Ic/Ib yeah?
[08:03:20] <anton02> pls respond
[08:10:52] <superware> where can I find a working attiny25/45/85 SPI slave (using USI) code?
[08:11:01] <superware> already tried Google
[08:19:58] <vsync_> there's footage of german bombing london
[10:36:52] <Roter> I have this code: http://pastebin.com/2rpcbidq. Its only 9 lines. I am trying to learn TCNT, but there are 2 problems: the led doesnt blink, that is connect to PINB0 and if i leave the if statement in the code, the PINB0 pin only gives out about 3V. Its an atmega 32.
[10:37:36] <Roter> I just followed a tutorial example, its the same as mine, even the chip, but for some reason it doesnt blink, i just think i forgot something very simple...
[12:04:48] <ColdKeyboard> Grrr... after I've updated Java now OLS says that I don't have Java installed... wtf?
[13:30:44] <Mous> any one here familiar with ATmega169? (i need to see if i can change the external clock frequency)
[13:51:18] <Roter> did you try and check the datasheet?
[13:59:29] <Mous> i wanted to say yes and that there is ton of stuff :D bu i missed him :)
[15:45:46] <superware> is it possible to use attiny85 as an SPI slave? I need it to receive a single command byte and send two data bytes back..
[15:46:37] <Daulity> why does delay.h specificly delay_ms_() bloat up my code ?
[15:46:46] <Daulity> like my code was before 1K and now 3.5K
[15:46:50] <Daulity> why?
[15:47:59] <superware> optimization?
[15:48:24] <Daulity> don't know
[15:48:28] <Daulity> probably none
[15:49:10] <superware> try O2
[15:55:25] <specing> Daulity: objdump and see what assembly is there
[15:58:53] <Jordan_U> Daulity: If you don't use any optimizations then _delay_ms will add floating point operations to your code.
[15:59:46] <Jordan_U> Daulity: As explained at http://www.nongnu.org/avr-libc/user-manual/group__util__delay.html .
[16:06:57] <superware> I have an atmega328 dc brushed motor controller, but the quadrature-encoder full decoding (x4) takes much of the CPU time at high rpm. so I want to "outsource" the quadrature decoding to an attiny25/45/85 that will be pulled for current position (2-4 bytes) when needed. how should I communicate between the atmega328 and the attiny?
[16:08:11] <gchristensen> superware: you could setup the attiny as a I2C slave, I think
[16:10:09] <superware> well, since the quadrature decoding might take much of the CPU (pin-change interrupt only), I prefer the solution to use minimal interrupt time so it won't interfere with the decoding
[16:13:22] <gchristensen> superware: anything I suggest would be talking out of my ass, but I'm real curious what the solution is.
[16:14:33] <superware> when using SPI, should the master know before hand the "protocol" it should utilize when talking to a specific slave?
[16:21:59] <superware> gchristensen: any SPI experience?
[16:25:33] <sirpatrick> Anyone here design an embedded system that acts as kind of an internet enable IO?
[16:25:48] <sirpatrick> I am looking to make something of the sorts but make it as secure as possible
[16:26:10] <gchristensen> superware: no, I'm here to try and soak up any knowledge I can
[16:26:23] <sirpatrick> essentially an API communicates with devices via some set of commands. I want to make it so not anyone can send requests to my device if they found out the IP
[16:28:14] <gchristensen> sirpatrick: without any sort of cryptography, its pretty tricky. if you can implement SSL with a sort of secret token, perhaps
[16:29:19] <sirpatrick> yea
[16:29:51] <sirpatrick> I am just trying to figure out like what I need to look up for a workflow. I have found tons of stuff for like auth systems for user models but not request models
[16:30:40] <gchristensen> sirpatrick: look up various REST APIs and see howthey do the authentication?
[16:31:09] <sirpatrick> yup. that's what I am looking into
[16:31:12] <sirpatrick> Thanks!
[16:42:03] <kastein> you want some sort of authentication, not just cryptography. if you just use cryptography with a preset key or something you are relying on security through obscurity
[16:42:19] <kastein> which is almost universally recognized as a Bad Idea
[16:42:34] <kastein> those who do not recognize it as a Bad Idea generally do when their shit gets hacked.
[16:43:18] <sirpatrick> kastein:right!
[18:13:32] <awozniak> I'm working with an XMEGA192A3, and one of my I2C buses has become "stuck". One of the devices is holding the SDA line low. i've read it might be possible to unstick the bus by inserting extra clock pulses. Can I write to the SCL GPIO pin while it is configured for TWI? Or do I need to disable that, then write to the GPIO, then re-enable it?
[18:47:23] <GargantuaSauce> 48V on sda should solve the issue
[18:47:53] <Casper> now.... to make a led dimmer/fader...
[18:48:04] <Casper> will be fun!
[18:56:09] <Casper> now... to recall how to code :D
[22:31:31] <inflex> Why the hell do so many mfg'ers choose to have piss poor PWM rates on LEDs :(
[22:32:05] <inflex> and don't even have reasonable lowpass filtering :(
[22:32:32] <inflex> Certainly a compelling reason for me to do my own home LED drivers
[22:56:24] <Casper> inflex: because they can use shittier parts
[22:56:35] <Casper> and yeah... I don't get why they aim for 100Hz
[23:02:04] <inflex> Oh, the refresh... yeah... that's odd too. I see BenQ is making a point of selling Low-bluelight and no-flicker displays for PCs