#avr | Logs for 2016-05-01

Back
[02:56:19] <mohsen_> Do you have an example showing the equivalent of analog write() of arduino in avrgcc
[02:56:28] <mohsen_> ?
[02:57:27] <Casper> mohsen_: take the datasheet, open the dac section, look at the code example
[02:58:11] <mohsen_> Assuming the microcontroller is an atmega328
[02:59:00] <mohsen_> Is there a code example for DAC in its datasheet?
[02:59:40] <Casper> afaik, there is no analog output on the 328, so there will be no analog write for that one
[02:59:58] <Casper> and the datasheet contain code example for about everything
[03:00:10] <Casper> which is why they are 300-600 pages
[03:01:21] <mohsen_> Which microcontroller do you suggest that has analog pins?
[03:01:50] <Casper> a dac, I beleive only the xmega
[03:03:43] <mohsen_> Then how does arduino provide analogWrite in all of its boards
[03:03:54] <mohsen_> ?
[03:10:05] <Casper> the only way I can think of is that they use a PWM channel with a low pass filter
[03:12:21] <mohsen_> Casper:https://www.arduino.cc/en/Reference/AnalogWrite
[03:13:08] <Casper> ah so they misnamed a function
[03:13:16] <Casper> PWM != analog
[03:17:17] <mohsen_> Is pwm an emulation of analog?
[03:18:12] <Casper> can be, but not really
[03:18:21] <Casper> PWM = Pulse Width Modulation
[03:19:05] <Casper> basically, it switch high and low the pin at a fixed frequency, but different proportion of on and off time
[03:19:39] <Casper> ex: 10ms high 90ms low (10%) 50/50 90/10
[03:20:12] <Casper> if you PWM a led, your eye will actually average the light output if it get fast enought (else you see it flash)
[03:20:17] <mohsen_> Could it be used instead of analog?
[03:20:20] <Casper> a motor will run slower
[03:20:40] <Casper> and if you add a low pass filter, then yes it can be used as "true" analog
[03:24:24] <mohsen_> And how many analog pins xmega has?
[03:25:00] <Casper> depend on the chip
[03:25:07] <Casper> 0 to "a few"
[03:25:23] <Casper> I didn't touched the xmega yet, I just know that some have a dac
[04:45:06] <carabia_> oh, so fat long directory (/file) entries are stored in utf-16
[04:53:15] <mohsen_> Using a real analog pin or a pwm with an rc filter? which one is recommended?
[05:05:49] <mohsen_> Sorry, unstable internet connection, has my message been sent to the channel?
[05:08:50] <Xark> mohsen_: If you have a DAC, that is probably preferable. Either can work (depending...).
[05:09:26] * Xark links some results he got with PWM https://imgur.com/a/qPis6#0
[05:09:44] <mohsen_> Xark: by having a dac you mean the microcontroller have analog pins? like xmega?
[05:10:22] <Xark> mohsen_: "analog pins" is not precise. There is DAC and ADC. As mentioned, only Xmega AVR has DAC (AFAIK).
[05:13:12] <mohsen_> Xark: Do you know how many pins does it provide that has DAC support?
[05:13:35] <cehteh> prolly depends on the exact chip
[05:15:00] <mohsen_> Tops?
[05:15:28] <cehteh> -> datasheets
[05:15:41] <cehteh> there are also techniques to mux DAC outputs
[05:15:51] <cehteh> what bandwidth do you need?
[05:16:23] <cehteh> https://en.wikipedia.org/wiki/Sample_and_hold
[05:17:33] <Xark> mohsen_: For XMega max is 4 DAC.
[05:18:22] <Xark> mohsen_: See for yourself http://www.atmel.com/products/selector_overview.aspx (click on "microcontrollers" Parametric selector")
[05:19:38] <mohsen_> Xark: So it means I can only control 4 devices?
[05:19:50] <cehteh> what do you want to control
[05:20:18] <Xark> mohsen_: It means 4 analog outputs...(max on Atmel Xmega MCUs).
[05:20:52] <mohsen_> cehteh: Motors
[05:21:12] <cehteh> didnt we talked yesterday about that?
[05:21:20] <cehteh> you dont want DAC for motors
[05:21:22] <cehteh> never
[05:21:41] <cehteh> what motors? what do you want to build?
[05:22:31] <mohsen_> But by outputting an increasingly analog voltage the motor rotates faster
[05:22:35] <mohsen_> Thats all I need.
[05:22:49] <cehteh> you can not connect a motor to the output pin
[05:22:57] <cehteh> that will destroy the avr
[05:23:16] <mohsen_> Oh you mean by the returned current?
[05:23:24] <cehteh> bay anything
[05:23:45] <cehteh> output pins only drive 40mA *AT MAX*
[05:24:03] <cehteh> yesterdays you saied you want to reverse the motors too
[05:24:42] <cehteh> (dunno about the DAC pins, possibly less here)
[05:25:20] <cehteh> motors are best driven with some form of PWM .. and luckily thats much easier to generate than using DAC's
[05:25:40] <cehteh> but you still need some motor driver, depending on what motors you use
[05:36:12] <cehteh> .. get a irc client :D
[05:36:22] <mohsen_> I'm so sorry, don't know whats wrong witht he connection.
[05:36:26] <cehteh> [11:59] <cehteh> motors are best driven with some form of PWM .. and luckily thats much easier to generate than using DAC's
[05:36:26] <cehteh> [11:59] <cehteh> but you still need some motor driver, depending on what motors you use
[05:37:24] <mohsen_> cehteh: The web client is usually good, something's wrong with my internet conenction today.
[05:37:28] <cehteh> so you never told what you try to build .. whats it?
[05:38:12] <mohsen_> A small car actually
[05:38:24] <mohsen_> Like the ones that has a controll and childs play with it
[05:38:52] <mohsen_> First tell me why does the avr gets destroyed if I directly connect the motor to the output pin?
[05:39:46] <cehteh> it can only deliver very small current, and had voltage limits on these, motors are inductive loads which can produce short voltage spikes with over 1000Volts
[05:40:55] <cehteh> and avrs are pretty strong and robust in the mircocontroller world
[05:41:19] <lorenzo> mohsen_: to the microcontroller it would look pretty much like a short
[05:41:31] <cehteh> but still its about 40mA maximum output on a pin and iirc 200mA all together
[05:41:35] <lorenzo> there's just not enough drive current
[05:41:54] <cehteh> worse than a short, inductive kickback will destroy it
[05:42:21] <lorenzo> I suggest you pick a mosfet with low Rds(on) and low Vgs(th)
[05:42:27] <lorenzo> and pwm into the gate
[05:43:30] <lorenzo> OnSemi NTD4906N is pretty good and has more current handling capability than you'll ever need, can be driven by 3.3V logic
[05:43:42] <lorenzo> and at a decent price (~0.5$ iirc)
[05:44:17] <cehteh> http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+43%0As+304+96+672+96+0+1+false%0Al+672+96+672+368+0+1+0%0Av+304+368+304+96+0+0+40+5+0+0+0.5%0Aw+304+368+672+368+0%0Ar+768+96+768+368+0+1000000%0Aw+672+96+768+96+0%0Aw+672+368+768+368+0%0Ao+1+64+0+35+81920+0.4+0+-1%0A
[05:44:41] <cehteh> mohsen_: ^^ look at that .. turn the switch on, wait a few seconds .. then turn it off
[05:45:04] <cehteh> 5V input .. wooops over 20000V :)
[05:47:11] <sabor> mohsen_: http://www.ablab.in/pwm-controlled-l293d-driver-with-avr-atmega32-microcontroller/
[05:47:27] * inflex finally found his vacuum pump and all his other production equipment
[05:49:14] <mohsen_> I didn't get the part that microcontroller destroys. You mean a motor can return 1000volts back to the avr and that destroys it?
[05:49:36] <mohsen_> I'm not an electronic guy
[05:50:05] <jacekowski> mohsen_: motor can potentially return a lot more
[05:50:26] <sabor> the power you get from an AVR pin is not enough to drive the motor (except a very very small motor)
[05:52:38] <cehteh> and very very small means smaller than: http://thumbs2.ebaystatic.com/d/l225/m/mmQLF2d3h4pf44nBG8H14Eg.jpg
[05:54:17] <mohsen_> So it can't even turn a motor that works with 3.3v 300mA ?
[05:54:42] <cehteh> no way
[05:54:51] <lorenzo> mohsen_: inductive loads oppose to change in currents by, uhm, presenting a voltage
[05:54:51] <cehteh> that 10 times too much
[05:55:00] <mohsen_> And this lacking of amper will destroy the avr?
[05:55:10] <lorenzo> and that voltage is high enough to kill the microcontroller
[05:55:17] <cehteh> it just will not work
[05:55:35] <lorenzo> other than that, the AVR chip can't provide enough current for driving a 300mA motor
[05:55:39] <cehteh> when you have such a small motor a simple fet will do for driving it
[05:55:55] <cehteh> (unless you want to reverse it, then you need 4 fets
[05:56:04] <cehteh> or some driver chip, there are plenty
[05:56:07] <lorenzo> so yeah, grab a *decent* mosfet, put in a flyback diode, be happy
[05:56:18] <lorenzo> (because you still need to protect the mosfet)
[05:56:24] <cehteh> better some driver, he wanted reversing too
[05:56:36] <cehteh> those have buildin diodes too
[05:56:47] <cehteh> some can control more motors at once
[05:56:51] <cehteh> thats very simple
[05:57:38] <lorenzo> some sample designs
[05:57:39] <lorenzo> https://www.olimex.com/Products/RobotParts/MotorDrivers/BB-A4983/open-source-hardware
[05:57:42] <lorenzo> https://www.olimex.com/Products/RobotParts/MotorDrivers/BB-L298/open-source-hardware
[05:57:47] <lorenzo> these will both do
[05:58:07] <cehteh> way to big for is punny motors?
[05:58:53] <cehteh> someone shown me a motor driver few days ago
[05:59:01] <lorenzo> HG7881? 800mA
[05:59:08] <cehteh> that was very simple but i dont remember the part number
[05:59:20] <lorenzo> chinadriver, aka l9110
[05:59:38] <lorenzo> http://www.elecrow.com/download/datasheet-l9110.pdf
[06:00:55] <mohsen_> So pwm + a driver is more suitable than a real DAC in my case?
[06:01:32] <lorenzo> yes
[06:01:51] <lorenzo> mohsen_: a DAC alone won't be capable of driving your motor either, you'd still need the drive stage
[06:03:56] <cehteh> ah l9110 was what someone shown me iirc
[06:04:59] <cehteh> yes
[06:05:08] <cehteh> thats really simple and small
[06:06:16] <sabor> sweet little chip, thanks lorenzo :)
[06:06:17] <cehteh> pwm is much more proper, more efficient, easier to pogram and implment, simpler hardware ...
[06:06:23] <lorenzo> np sabor
[06:06:55] <cehteh> everything usues pwm .. from toy cars to railroad locomotives
[06:07:43] <mohsen_> In simple words, does pwm mean outputting a voltage periodically?
[06:08:04] <cehteh> yes
[06:08:38] <cehteh> microcontroller can do that in hardware, you just configure timers and then it outputs the desired pwm signal
[06:08:56] <mohsen_> So in case of my arduino nano, it can output 3.3v, so it would just like 3.3....3.3.....3.3....3.3, but this isn't analog?
[06:09:21] <lorenzo> mohsen_: it switches between 3.3V and 0V at a high frequency
[06:09:28] <cehteh> you power the nano with 3,3v?
[06:09:46] <lorenzo> the more it stays in the 3.3V area, the higher will be the average voltage in a period
[06:10:55] <mohsen_> cehteh: I power it with my laptop usb, which I think is 5v? I mean the digital output pins. Don't they output 3.3?
[06:11:09] <cehteh> no, around 5V then
[06:13:41] <mohsen_> lorenzo: Considering an analog voltage can vary from 0 to 5, which means it can even be 2.45, does pwm do this really? I mean by increasing the pwm value in analogWrite(value), will it go from 0 to 5?
[06:14:33] <lorenzo> mohsen_: no, it will switch between 0 to 5V at a high frequency, and the more it stays at 5V during a period, the higher the resulting power will look
[06:14:50] <lorenzo> mohsen_: you're basically turning on and off the motor very fast
[06:15:02] <lorenzo> the more it stays in the "on" area, the faster it will turn
[06:15:35] <cehteh> high frequency means dozens of kHz much faster than your motor rotates, simply speaking the motor does some averaging then
[06:15:55] <mohsen_> So a multi-meter never shows 2.5 if we measure the output? it just shows 0 and 5 over and over
[06:16:11] <cehteh> (actually it is a bit more complex, but on the favorable side, like motor starts easier, than applying a small voltage)
[06:16:30] <cehteh> your multimeter wont show anything because its too slow for that
[06:16:43] <cehteh> you need a oscilloscope or logic analyzer for that
[06:17:55] <cehteh> i mean it will show something .. but nothing usable, except some multimeter can measure pwm
[06:18:08] <cehteh> (frequency and duty cycle, not voltage)
[06:18:47] <cehteh> https://en.wikipedia.org/wiki/Pulse-width_modulation
[06:18:57] <cehteh> .. make it simple, read that
[06:20:25] <mohsen_> Thanks so much.\
[07:20:13] <WormFood> Is there any possible way, to force a function to a specific address, in avr-gcc?
[07:29:00] <Thrashbarg> WormFood: yes, but don't ask me how to do it :P
[07:29:10] <Thrashbarg> not sure why you'd want to however
[07:29:36] <WormFood> There are lots of reasons to want something like that.
[07:30:10] <WormFood> Perhaps I want a subroutine, that lives at a specific address, for some crazy reason.
[07:30:24] <WormFood> Actually, I want to force it to start in the vector table.
[07:30:51] <WormFood> I don't want a jump in the vector table, to in interrupt routine. I want my code to just start there, in the vector table. Make sense?
[07:31:03] <Thrashbarg> yes
[07:31:23] <Thrashbarg> sounds like you need to make your own crt0 file
[07:33:43] <cehteh> linker options/script .. see how the ISR's are implemented
[07:34:12] <cehteh> i mean vectors .. ISR's themself are placed elsewhere
[07:34:35] <cehteh> but the vector is a special section for the linker and its told where to place it
[07:34:39] <WormFood> I can't make sense out of the linker file avr5.x
[07:35:22] <cehteh> haha .. i hate that stuff too, have to dig the docs too. i know it works and looked at it once but stay away from it
[07:35:35] <WormFood> I have one that supposedly does that, but it doesn't seem to work with the current avr-gcc, and I can't seem to patch a current linker file to make it work
[07:36:16] <WormFood> /usr/lib/avr/lib/ldscripts/avr5.x Take a look at it.
[07:37:42] <cehteh> i just did
[07:37:46] <cehteh> but i dont know it well
[07:37:59] <WormFood> https://www.mail-archive.com/avr-gcc-list%40nongnu.org/msg08263.html <-- hhhmmm
[07:38:22] <cehteh> KEEP(*(.vectors))
[07:38:54] <cehteh> iirc you can pass some attributes by the compiler
[07:39:17] <cehteh> attributes about address
[07:39:44] <WormFood> I shared a page here before, that has a modified linker script to do that.
[07:40:25] <cehteh> so far i only used the noinit stuff
[07:40:44] <cehteh> eventually i wonder if one can make noinit default
[07:41:01] <cehteh> aka turn of the crt to initialize the ram to 0
[07:43:17] <WormFood> what version of avr-gcc you guys using?
[07:43:24] <WormFood> I got 4.8.1
[07:44:09] <cehteh> same here
[07:44:16] <cehteh> debian stale
[07:44:25] <WormFood> that's what I guessed
[07:44:32] <WormFood> Because I'm using the same thing
[07:44:42] <WormFood> in debian, "stable" == "3 years old"
[07:45:05] <WormFood> if you're lucky
[07:45:15] <cehteh> works for me so far
[07:45:21] <WormFood> ditto
[07:45:36] <cehteh> i hate bleeding edge stuff and then no one else can compile my code because of missing dependencies
[07:45:42] <cehteh> or feature
[07:45:43] <cehteh> s
[07:46:34] <WormFood> I don't share my code :P
[07:46:40] <WormFood> at least, not this code.
[07:46:55] <WormFood> actually, that's not true. If I release this, I'll have to release this code, since it's gpl
[07:47:08] <WormFood> But, I don't care if nobody else can compile it. ;)
[07:48:54] <cehteh> mhm .. lunch bbl
[07:51:11] <WormFood> dinner time here
[07:51:18] <WormFood> but, I'm sick, so I'm not eating much.
[08:17:27] <mohsen_> With an Atmega328, by the use of pwm and drivers, how many motors can I turn and control their speed?
[08:39:23] <mohsen_> Hello?
[08:41:24] <Lambda_Aurigae> depends on how you do the pwm.
[08:41:28] <Lambda_Aurigae> and what kind of motors
[08:41:46] <liwakura> http://jobs.arduinoexperts.com/wp-content/uploads/2013/03/atmega328w.png
[08:41:55] <liwakura> its not that difficult
[08:43:39] <Lambda_Aurigae> in theory the atmega328p has 6 pwm channels.
[08:46:09] <Lambda_Aurigae> also, what kind of driver are you using for the motor?
[08:57:45] <Lambda_Aurigae> mohsen_, having 23 i/o pins on the dip package atmega328p, you could in theory do software pwm and/or a combination of hardware and software and control as many as 11 motors without too much trouble but that wouldn't leave you much for communications or inputs or sensors.
[08:58:38] <Lambda_Aurigae> that gives direction and on/off/pwm for each motor.
[08:58:55] <Lambda_Aurigae> if you just want on/off/pwm then you can do, in theory, 23 motors.
[09:07:18] <mohsen_> I see
[09:07:46] <Lambda_Aurigae> so, your question is lacking in a lot of background and details for anybody to be able to answer it with anything useful.
[09:07:46] <cehteh> with the drivers mentioned before you can comfortably drive 4 motors on 4 pwm channels on the 2 8 bit timers, using the 16 bit timer for something else
[09:08:02] <cehteh> you saied 4 motors or?
[09:08:33] <cehteh> needs 4 pins pwm and 4 pins for direction when you do it in the most simple way
[09:16:10] <cehteh> liwakura: that .png does the same fault arduino does .. connecting avcc to vcc directly :S
[09:16:25] <cehteh> nothing definitive :D
[09:16:48] <liwakura> probably because it IS an arduini image
[09:16:55] <cehteh> yeah
[09:16:55] <liwakura> > arduinoexperts.com
[09:17:06] <liwakura> currently having different problems
[09:17:23] <liwakura> live patching void linux to get sabotage linux
[09:17:29] <cehteh> lol
[09:17:38] <cehteh> i never tried this live patching
[09:17:51] <liwakura> the rootfs transisition was fine, the void linux grubs boots into sabotage fine
[09:18:01] <cehteh> kexec?
[09:18:09] <liwakura> rm -rf /bin
[09:18:15] <liwakura> mv /sabotage/bin /
[09:18:20] <liwakura> like that
[09:18:49] <cehteh> mount --bind /sabotage/bin /bin
[09:18:59] <cehteh> for testing
[09:19:02] <liwakura> no, i wanted it to be persistent
[09:19:15] <cehteh> ok
[09:19:21] <cehteh> have fun
[09:19:32] <liwakura> felt a bit like http://i.imgur.com/KVnJblY.gif
[09:19:50] * cehteh makes a coffee and then continues on the blocking io stuff
[09:42:50] <nh41> d
[10:48:11] <eszett> hi! i have a question. im planning to connect a little speaker to a pin of my AVR? do i need a resistor too for it?
[10:49:10] <Thrashbarg> what sort of speaker? Piezoelectric, magnetic, etc
[10:50:04] <Thrashbarg> ideally there should be an amplifier for it so it doesn't load the AVR output pin
[10:50:06] <eszett> this one http://www.pollin.de/shop/dt/NDk5OTUzOTk-/HiFi_Car_HiFi_Video_TV/Lautsprecher/Lautsprecher_Chassis/Kleinlautsprecher_DH_90X.html
[10:50:12] <eszett> i guess its piezo right?
[10:50:22] <Thrashbarg> nope there's a magnet in it
[10:50:39] <eszett> oh, and i cant use it without amplifier?
[10:50:46] <Thrashbarg> http://i.stack.imgur.com/AV9no.jpg <-- piezo speaker
[10:51:08] <eszett> the piezo speaker are really thin, like a sheet of paper
[10:51:14] <Thrashbarg> well you might get away with using a capacitor between the speaker and the AVR, but it'd stress the pin
[10:51:33] <eszett> hm.. alright thanks
[10:52:00] <Thrashbarg> if it's magnetic it should pick up screws and things
[10:52:17] <Thrashbarg> also 10 ohms impedance gives it away
[10:52:56] <eszett> so you would recommend a piezo with lower impedance?
[10:53:14] <eszett> its for inside of a keyboard
[10:53:28] <liwakura> what kind of sounds do you want to make?
[10:53:40] <liwakura> piezo's are usually bad with lower frequencies
[10:53:53] <Thrashbarg> yer
[10:53:58] <eszett> basically such a small speaker hasnt many capabilities, but i plan a cracking sound
[10:54:10] <eszett> argh
[10:54:25] <eszett> ideally it should be the sound of a typewriter button pressed down
[10:54:40] <cehteh> eszett: little driver, capacitor, diode ...
[10:55:18] <daey> the petitfs library requires a function that writes a 'partial sector'. How can i do that with an SD card? I know that i always have to do 512byte reads/writes. Reading a partial sector is easy, i can simply ignore values. but how do i write a partial sector?
[11:00:13] <theBear> pretty sure you can't, well i spose you can read one out then write the whole thing back, but i guessing you a bit short of ram for that
[11:00:49] <eszett> cehteh: well, ok, i gotte read through the basics of driving a speaker first
[11:00:49] <daey> theBear: yea :D
[11:01:19] <theBear> yep, that's the age-old question...
[11:02:06] <daey> theBear: i mean it kinda is possible if you init a write, and then simply write byte by byte and do other stuff in between. but ones you send the end signal its over :/ but its gotta be possible as the petitfs lib asks for it
[11:03:07] <theBear> how does that make it gotta be possible ? is petitfs the arbiter of reality now ? i never heard of it, surprised it got promoted so quick :)
[11:03:45] <daey> yeah its pretty well known. probably THE goto library for fatXX stuff on uCs
[11:03:58] <daey> by lord elmchan :p
[11:04:10] <theBear> fairy nuff
[11:04:18] <theBear> how tiny is it ?
[11:04:26] <daey> 2kb iirc
[11:04:32] <theBear> and you sure there isn't a min-hw-write option or similar ?
[11:05:16] <daey> well the lib is hw independent. it contains a diskio.c file with the required functions that you need to fill
[11:06:19] <theBear> yeah, but one would assume it been used with sdcards on tiny micros before you
[11:07:01] <daey> yes definitely. im already looking for examples
[11:09:32] <theBear> i wonder if my buddy miraculously fell dead asleep minutes after i left yet again, or is busy gettin screamed at by his crazy nearly-ex missus yet again
[11:48:36] <Lambda_Aurigae> daey I suggest you ask the creator of petitfs
[11:53:28] <Lambda_Aurigae> according to the SD spec, only full block write is supported.
[11:53:41] <Lambda_Aurigae> so, you have to read the full 512bytes, modify, then write it back.
[11:54:53] <Lambda_Aurigae> some SD cards allow single byte reads but for most you have to read the entire sector of 512 bytes.
[11:55:54] <Lambda_Aurigae> it appears that petitfs will write some data,,,50 or 80 bytes then pad the rest out for a "partial write"
[11:56:09] <theBear> i'd be checking the mmc vs sd spec too, been too long since i looked closely to remember
[11:58:05] <daey> Lambda_Aurigae: after digging a bit more, i realized the petitfs has only limited write capabilities, its mostly a read library
[11:58:12] <Lambda_Aurigae> yup.
[11:58:21] <Lambda_Aurigae> seeing that now
[11:58:28] <Lambda_Aurigae> you need the full fledge version for most writes.
[11:58:37] <daey> which ist 25kb big :P
[11:58:54] <Lambda_Aurigae> what are you trying to do exactly?
[11:59:20] <daey> my plan is building a bike logger. position/height/speed/cadence etc.
[11:59:27] <Lambda_Aurigae> oh heck
[11:59:29] <Lambda_Aurigae> easy.
[11:59:32] <daey> yes
[11:59:37] <Lambda_Aurigae> create one big honking file on the sd card
[11:59:52] <daey> good idea...
[11:59:58] <Lambda_Aurigae> then do the sector read/write yourself without any filesystem stuff other than finding the beginning of the file.
[12:00:50] <Lambda_Aurigae> make one big file and fill it with blanks or 0x00 or something.
[12:00:57] <daey> yeah i can write a end pointer to another known sector and simply keep on writing from there next time
[12:01:12] <Lambda_Aurigae> then read from the beginning of the file one sector at a time,,modify the data, then write it back and read the next.
[12:01:44] <Lambda_Aurigae> I would keep the existing end pointer structure and just fill in the blanks.
[12:02:11] <Lambda_Aurigae> and neither petitfs or fatfs uses a partial sector write...
[12:02:26] <daey> eh?
[12:02:44] <Lambda_Aurigae> fatfs does have a function to put partial sector data into the fileio buffer but it doesn't actually write a partial sector...writes the whole thing.
[12:02:52] <daey> the comments in the diskio.c "Read Partial Sector" "Write Partial Sector"
[12:02:53] <Lambda_Aurigae> just looking through the code here.
[12:05:39] <Lambda_Aurigae> it's not exactly named correctly.
[12:06:37] <daey> so its a simple sector/block write/read?
[12:06:39] <Lambda_Aurigae> and, if you notice, there is no actual writing code in the writep function.
[12:06:50] <Lambda_Aurigae> disk_writep() function
[12:07:04] <Lambda_Aurigae> nor in the disk_readp() function either.
[12:07:07] <daey> yeah because thats supposed to be written by the user, as its hw dependend
[12:07:43] <Lambda_Aurigae> and the SD standard doesn't support partial write..so you have to write a full sector...no matter what that code hints at.
[12:10:15] <Lambda_Aurigae> copy the code from disk_read and disk_write from the fatfs diskio.c
[12:10:29] <Lambda_Aurigae> along with the other MMC/SD files that are required.
[12:11:54] <Lambda_Aurigae> now, if you were using linux to read the data, you could pretty much ignore the entire filesystem
[12:12:02] <Lambda_Aurigae> just write blocks of data from the beginning of the SD
[12:12:42] <Lambda_Aurigae> then read the data with dd or any of a couple dozen other ways to read a block filesystem from within linux as a regular binary file.
[12:12:52] <daey> Lambda_Aurigae: yeah i was already thinking of writing my own 'fs'. first few blocks for start/end pointers. then just dump data on it
[12:13:00] <Lambda_Aurigae> no fs required.
[12:13:15] <Lambda_Aurigae> just raw data...maybe keep the first block as a pointer to the last block used or something.
[12:13:29] <daey> yes thats what i meant
[12:13:50] <Lambda_Aurigae> but if you write 0x00 to the entire thing then you can just read it from the beginning until you reach a block full of nothing but 0x00
[12:14:05] <Lambda_Aurigae> or 0xFF
[12:14:17] <Lambda_Aurigae> if there is a possibility of all zeros in your data.
[12:14:26] <daey> it just would have been nice if i had actual files on there
[12:14:45] <Lambda_Aurigae> then get a bigger microcontroller.
[12:14:59] <Lambda_Aurigae> or a second one to just play disk-i/o
[12:15:34] <Lambda_Aurigae> it's nifty to make do with an attiny25 but not always practical...not sure what chip you are using.
[12:16:01] <daey> atmega88
[12:17:29] <Lambda_Aurigae> replace with an atmega328 and you have enough room for the full fatfs.
[12:17:36] <Lambda_Aurigae> at not much more cost...and pin compatible.
[12:20:32] <Lambda_Aurigae> in fact, the atmega328 is almost a dollar cheaper than the atmega88 at digikey..interesting.
[12:20:43] <daey> :D
[12:21:43] <Lambda_Aurigae> and, back to hanging screen...
[12:21:44] <Lambda_Aurigae> laters.
[13:08:36] <Lambda_Aurigae> aaand, it started raining.
[13:08:40] <Lambda_Aurigae> so, fixing tacos for lunch.
[15:29:27] <theBear> stupid damned mouse binding
[15:42:08] <Tom_itx> damn rodents
[15:43:03] <theBear> and friction-bound ones at that !
[18:10:47] <inflex> morn folks
[18:12:01] <Lambda_Aurigae> croutons
[21:25:06] <rue_shop5> can anyone confirm, the cheapest DIP avr seems to be the atmega8 ?
[21:25:37] <Lambda_Aurigae> no
[21:25:43] <Lambda_Aurigae> probably an attiny25 or similar.
[21:26:06] <Lambda_Aurigae> or attiny13
[21:26:28] <rue_shop5> I have the atmega8 at 80c from china...
[21:26:41] <Lambda_Aurigae> umm...is it genuine?
[21:26:47] <rue_shop5> d I care?
[21:26:57] <Lambda_Aurigae> might not be fully functional.
[21:27:06] <rue_shop5> I need to step motors with it
[21:27:33] <rue_shop5> need more than 8 pins tho :/
[21:27:40] <Lambda_Aurigae> I've heard rumors of a clone atmega8 out of china for about 4 years now.
[21:27:42] <rue_shop5> otherwise I'd use the tiny13's I ahve
[21:28:00] <rue_shop5> I just need a step/dir to 4 phases converter
[21:28:00] <Lambda_Aurigae> if it functions, go for it.
[21:28:19] <Lambda_Aurigae> I wouldn't put a bunch of money into them.
[21:28:23] <rue_shop5> I'd like to use the tiny24/44/84 but they cost $3 ea
[21:28:59] <rue_shop5> wtf, but they are $2 from dk
[21:31:03] <rue_shop5> 25 tiny24 from dk for $40usd or 50 atmega8 from china for $40usd
[21:31:06] <Lambda_Aurigae> http://www.digikey.com/product-detail/en/microchip-technology/PIC16F1454-I%2FP/PIC16F1454-I%2FP-ND/3879951
[21:31:12] <Lambda_Aurigae> not avr, but,,cheap micro
[21:31:21] <rue_shop5> oh, but dk would be +$8 shipping
[21:31:31] <rue_shop5> no F*&^ing pics
[21:31:56] <rue_shop5> microchip wants too much money for software and programmers
[21:32:04] <rue_shop5> I'm not profiting from this project
[21:32:49] <Lambda_Aurigae> so go for the atmega8 from china
[21:33:46] <rue_shop5> or use my tiny26's (which I value for adc's) or make something discrete
[21:33:58] <Lambda_Aurigae> yup.
[21:34:14] <rue_shop5> I have a 3 chip circuit that will run 2 steppers
[21:34:28] <rue_shop5> but I want to break up and put a driver board by each stepper
[21:34:41] <Lambda_Aurigae> you could always run it from the IDE port on your computer!
[21:34:58] <rue_shop5> no, multitasking os's suck for timing
[21:35:06] <Lambda_Aurigae> do it in dos!
[21:35:18] <rue_shop5> dos' network capabilities suck
[21:35:56] <rue_shop5> if I had some GAL I could do it
[21:36:00] <rue_shop5> GAL?
[21:36:04] <rue_shop5> PAL?
[21:36:05] <Lambda_Aurigae> PAL
[21:36:18] <rue_shop5> I need 16 bits of memory
[21:37:00] <rue_shop5> dont ahve a pal programmer tho
[21:37:31] <rue_shop5> haha they cost mroe than the avrs
[21:38:16] <rue_shop5> maybe its time to start using up the eeproms,
[21:38:25] <rue_shop5> make this a really big, overly complex project
[21:39:12] <rue_shop5> 16 bit state machine running on a ... which drawr is overflowing..... 256kbit eeprom state machine
[21:39:21] <rue_shop5> 16 bit state machine running on a ... which drawr is overflowing..... 256kbit eeprom
[21:40:16] <rue_shop5> 262128 bits unprogrammed
[21:41:45] <rue_shop5> I suppose I have to decide
[21:42:05] <rue_shop5> cost, time to implement, or practicallity of implementation
[21:46:44] <rue_shop5> oh...
[21:46:48] <rue_shop5> oh.../.
[21:46:50] <rue_shop5> crazy idea
[21:47:11] <rue_shop5> I put shift registers at the motors, and bring serial lines back to one baord that controls all the steps
[21:50:56] <rue_shop5> part of what makes that interseting is that now I t13 could do it
[21:51:08] <rue_shop5> data, clock, strobe
[21:51:44] <rue_shop5> I was interested in this idea when I saw the 10 bit serializer/deserializers that are used in lcd interfaces
[21:51:49] <rue_shop5> 48mbits
[21:52:08] <rue_shop5> you just push in the parallel signals and they come out hte other end a bit later
[22:20:45] <rue_shop5> hahaha
[22:21:29] <rue_shop5> the 74xx595 sells for over $1 ea, but the BA829, which has 300mA output drivers, sells for less than 80c ea
[22:22:28] <rue_shop5> of the 74HC595 is almost free
[22:23:14] <rue_shop5> $7 for 100pcs?
[22:48:28] <rue_shop5> ugh, I can get the atmega8 cheaper than the tiny13
[22:48:38] <rue_shop5> I thought tiny13 was supposed to be under $1 ea?
[22:53:51] <rue_shop5> it really feels wrong to use an atmega8 as a clock/dir to 4 phase converter
[22:54:14] <rue_shop5> I mean, two of the phases are just inversions of the other two
[22:54:36] <Casper> why not use a specialised IC for that? more expensive?
[22:58:00] <rue_shop5> yea
[22:58:26] <rue_shop5> or larger, you have to use a min of two 14 pin dips to do it
[22:58:44] <rue_shop5> than again, the mega8 is 28 pins
[23:07:51] <rue_shop5> atmega88 is more than a tiny13
[23:08:03] <rue_shop5> maybe I should use up these stupid t13's