#avr Logs

Aug 24 2017

#avr Calendar

12:05 AM robinak is now known as robink
12:38 AM rue_house: enh, did you do that last one with the headers expanded off the arduino nano?
12:38 AM rue_house: er pro mini
12:39 AM rue_house: backplane?
12:42 AM rue_house: enh, also, have you considered interconnecting with CABLES!?
12:42 AM rue_house: aka, each module has a cable comming off it you plug into the backplane
12:47 AM rue_house: enh, I'd like to take a look and your gcode sender, if your interested, I wrote one too
01:23 AM _ami_: finally, PCBs from seeedstudio had arrived: https://cdn.hackaday.io/images/8420231503506541875.jpg
01:54 AM remkooo1 is now known as remkooo
04:48 AM rue_house: hu?
04:48 AM rue_house: whats fast about it?
04:48 AM rue_house: wait, what
04:48 AM rue_house: its a stm32 based avr flasher?
04:49 AM rue_house: is that blastfamous?
04:49 AM * Haohmaru stares at rue_house
04:50 AM rue_house: but, why wouldn't someone just get a $1 usbasp from china?
04:51 AM rue_house: if you need the fancy stuff, you might be able to coax tom into making one of his
04:54 AM renn0xtk9: I am doing an I2C communitcation. The master sends the start conditoin with the address and write bit. The slave seems to receive it (at least the TWINT flag is raised) but the SCL (and SDA) are held done afterwards (presumably from slave) can't figure out why
05:07 AM twnqx: isn't there something called clock stretching by the slave an option?
05:12 AM renn0xtk9: twnqx, you mean the TWINT flag would not be cleared from the ISR?
05:13 AM twnqx: no, just that the slave might need some time for processing whatever you did, and thus keeps the line up
05:19 AM renn0xtk9: twnqx I don't know, on slave I can see that I enter the ISR and in there I enter the condition if (TW_SR_SLA_ACK) which to me means the slave should have ACK
05:35 AM polprog: you think 4n7 is enough decoupling for a small chip?
05:42 AM twnqx: i always use 100n
05:43 AM twnqx: just because i buy them in 1000 packs
06:11 AM polprog: damnit
06:11 AM polprog: cant get stuf to work
06:12 AM polprog: oh crp it worked
06:16 AM polprog: lol, wrong clock phase
06:19 AM Lambda_Aurigae: doing SPI?
06:20 AM polprog: yeah
06:21 AM polprog: stupid bus pirate calls it "output clock edge" and you dont know what the hell does that mean
06:21 AM Lambda_Aurigae: hehe
06:22 AM polprog: damnit, if not the scope id sit here all day long
06:28 AM Lambda_Aurigae: that's why I built a modified logic pirate
06:28 AM Lambda_Aurigae: looking at building an even more modified one using sdram modules
06:28 AM Lambda_Aurigae: like, maybe 512MB 168 pin dimm
06:29 AM Lambda_Aurigae: I have several around.
06:29 AM Lambda_Aurigae: just gotta figure out the whole refresh thingie on it.
06:31 AM Lambda_Aurigae: I have a stack of 256MB and 512MB pc133 168pin dimms here.
06:31 AM polprog: logic pirate?
06:32 AM Lambda_Aurigae: like a bus pirate only an 8 pin logic analyzer instead.
06:32 AM polprog: ah, that analyzer
06:32 AM polprog: i have a saelae clone
06:32 AM Lambda_Aurigae: that should work for doing spi analysis then.
06:33 AM polprog: it does now, but initially i used a scope thinking amybe that's something wrong on electical level
06:33 AM polprog: i should now look into scripting the bus pirate
06:36 AM Lambda_Aurigae: it has some scripting ability built in as I recall.
06:36 AM polprog: it has
06:38 AM Lambda_Aurigae: which buspirate do you have?
06:39 AM Lambda_Aurigae: I got an early V3 here.
06:40 AM polprog: v3.6
07:32 AM renn0xtk9: I GOOOOOOOOTTTT ITTT !!! :p:p:p:p:p:p I can now start up my hifi from the computer, via SSH+VUSB+I2C + IR ^^^ thanks a lot to polprog Lambda_Aurigae LeoNerd Emil (among others) for their help these dayse ;)
07:35 AM LeoNerd: :)
07:42 AM renn0xtk9: I just do echo "004.007.021.063" > /dev/usbcheck and itpowers it up :p lalalala:p hehehehe
07:52 AM polprog: :) good job!
08:14 AM dgriffi3 is now known as dgriffi2
08:30 AM twnqx: renn0xtk9: did you simply build a https://github.com/harbaum/I2C-Tiny-USB ?
08:34 AM polprog: wha tdoes it mean if during hot air soldering the paster makes those tiny balls that dont want to reflow to anything? too much paste?
08:37 AM renn0xtk9: twnqx not exactly what I did is a ciruit with One ATMEGA that communicate with computer via USB . and sends instruction over an I2C bus, On this I2C bus there is another ATMEGA that receiver instruction [protocol; address; command] and should those as Infrared comand
08:38 AM renn0xtk9: but by doing so at the end my idea was that yeah, with few modification, I could attache other components to the bus
08:38 AM renn0xtk9: which is what I2C-Tiny-USB is for so far as I understand.
08:39 AM renn0xtk9: Do you happen to know of any website that produce very cheap PCB even if I need just one piece of it? I generally etch my PCB myself but right now I don't want to fuck up all my appartments with iron chloride ^^
08:41 AM polprog: oshpark is good for low volume, though i never ordered there so i dont know if the pricing is good
08:41 AM polprog: ask Emil
08:51 AM Emil: renn0xtk9: any chinese
08:52 AM Emil: renn0xtk9: they cost pennies
08:52 AM Emil: renn0xtk9: if you want good quality and small then Oshpark is kawaii
08:58 AM Emil: renn0xtk9: quite convoluted but eh :D
09:02 AM twnqx: i'll just stick to seeed, the price is too lol
09:02 AM twnqx: low*
09:03 AM Lambda_Aurigae: I like dirtypcbs myself but you get 10 of them..give or take a couple.
09:13 AM carabia: not to be a killjoy, but renn0xtk9 are you sure you really want to get a one-off pcb for that?
09:16 AM renn0xtk9: carabia you mean you would use a solder board ?
09:17 AM carabia: yups
09:17 AM renn0xtk9: yeah I am thinking about it
09:17 AM renn0xtk9: the price will decide
09:17 AM carabia: well, some protoboard of your choice
09:17 AM renn0xtk9: not to be a perfectionist, but I usually find it dirty
09:17 AM renn0xtk9: but may I will do yeah
09:17 AM carabia: depends on how you lay it out. if you only need one, i'm sure it's cheaper
09:19 AM carabia: that thing's not the most complicated one. even if you'd do it with smd ics i'd still go without a pcb. Though, if you get a pcb made, you will get more than a single board, which is nice if you have i.e. some buddies interested.
09:25 AM Lambda_Aurigae: heck, for what you are doing, make an art project out of it and do it deadbug/airwire style!
09:26 AM carabia: exactly
09:26 AM carabia: and you know, on the note of dirtiness, renn0xtk9 you know what's dirty?
09:27 AM carabia: doing usb with an attiny
09:28 AM Lambda_Aurigae: v-usb is horribly dirty..hehe
09:28 AM Lambda_Aurigae: but we've been saying that all along.
09:30 AM renn0xtk9: It is already made with a bug in driver module as I am just witnessing it
09:31 AM polprog: not using smd? wow that's gonna be yugee
09:31 AM renn0xtk9: strange, beacause the same driver was working fine on my test machine
09:31 AM Lambda_Aurigae: haha
09:31 AM Lambda_Aurigae: that's v-usb for you.
09:31 AM Lambda_Aurigae: not compatible with all systems...both hardware and software incompatibilities show up.
09:31 AM renn0xtk9: and on my own one it is not wokring
09:31 AM Lambda_Aurigae: it is a hack.
09:31 AM polprog: is vusb a bitbanged usb implementation?
09:31 AM Lambda_Aurigae: yes
09:32 AM polprog: lool
09:32 AM carabia: they're all "bitbanged"
09:32 AM renn0xtk9: maybe (hpefully) the bug is in my code
09:32 AM Lambda_Aurigae: usb without usb hardware.
09:32 AM carabia:
09:33 AM renn0xtk9: yeah i should start to do things with SMD to have Xmega and usb controller (and even can controller:p) but i first need to get an smd starter kit
09:34 AM renn0xtk9: and lerarn to sold those properly
09:34 AM carabia: xmega. please restrain yourself from swearing
09:35 AM carabia: .1" broken out stm32f103 cm3 boards (30 mm x 20 mm or so) starting now at under $4 (just playing off the topic) :)
09:35 AM LeoNerd: USB on a non-XMEGA AVR is a rather sad state of affairs currently
09:35 AM LeoNerd: The only ATmegas that do USB are the xU2 and xU4 chips; both of which while having USB are fairly limited in most other respects
09:35 AM carabia: with hw usb that is
09:36 AM LeoNerd: The xU2 has no ADC and very little else by way of peripherals; it makes a good USB-UART bridge but that's about it. Little point in that when there's dedicated chips for it
09:36 AM LeoNerd: xU4 is a bit better; has ADC and most of the usual peripherals; but it is quite limited in interrupt-capable IO lines and they're all in stupid clashy places
09:36 AM polprog: carabia: xmega swaring, what?
09:37 AM renn0xtk9: the issue is for all those you need a specifi programmer no? i mean if you want to program their fuse?
09:37 AM polprog: renn0xtk9: wha tprogrammer do you have?
09:37 AM renn0xtk9: avr dragon
09:37 AM polprog: that can edit fuses
09:37 AM carabia: you're set...
09:37 AM carabia: polprog: yes
09:37 AM polprog: carabia: i dont get it
09:38 AM carabia: xmegas are a failure
09:38 AM carabia: get with the times
09:38 AM polprog: what about at90 :P
09:38 AM carabia: get with the times again
09:41 AM * polprog hides his 7880
09:42 AM polprog: i picked up a bit of time ago a grab bag of old ICs, there was a polish clone of that cpu and some EPROMs, ram
09:42 AM polprog: essentially a crude DIY computer kit
09:42 AM polprog: there are some ussr clones there too
09:44 AM renn0xtk9: But if I want an STFM32 it will probably not be compatible with ATMELs programmer will it?
09:45 AM polprog: take a guess
09:46 AM renn0xtk9: I guess no
09:46 AM polprog: that's right
09:47 AM renn0xtk9: And I guess that to programm those from a linux enviroment is already a big fat mess
09:47 AM carabia: renn0xtk9: nope.
09:47 AM polprog: im looking orward to get into stm32 too
09:47 AM renn0xtk9: okay one good thing at least
09:47 AM carabia: unless you're willing to pay, you're going to use FOSS-stuff, renn0xtk9
09:47 AM carabia: and, a clone programmer literally costs a few dollars off ebay
09:48 AM carabia: less than $5, most likely
09:48 AM carabia: also, you'll get *real* debugging as an added bonus.
09:48 AM polprog: carabia: an stlink clone?
09:49 AM carabia: yeah
09:49 AM renn0xtk9: Yeah but for programmer you need good sutff. In my case with those atmegas I used an basp and i inadvertenly enable the debug wire so that afterward I could not programm it again anyway
09:49 AM carabia: though, i don't know if dragon does dw, been a while since i've touched avrs
09:49 AM carabia: renn0xtk9: i have almost never seen anyone encounter problems with the st-link clones
09:50 AM renn0xtk9: don't underestimate my ability to get it wrong even when it should go straight ;)
09:50 AM carabia: there's not a whole lot you can fuck up.
09:53 AM carabia: for the software side you'd use the gnu arm toolchain with openocd
09:53 AM renn0xtk9: I don't need a lot ^^
09:53 AM renn0xtk9: I thik I will give it a try indeed
09:54 AM renn0xtk9: I bought my dragon for those atmegas so i wish to make it a bit rentable ^^ but I see that it will be soon very limited ..
09:54 AM LeoNerd: Is there really anything opensourcey that can do dW though?
09:55 AM carabia: LeoNerd: guess not.
09:55 AM LeoNerd: I still have the impression Atmel treat it as a closely guarded secret and don't tell anyone about it
09:55 AM * LeoNerd might have to make something
09:55 AM LeoNerd: except in practice I don't think I'd use it
09:55 AM LeoNerd: And I dislike making tools I don't use
09:57 AM LeoNerd: .. to be honest I dislike making /anything/ that I wouldn't use; just most of the time I end up making tooling of one sort or another
09:57 AM renn0xtk9: what is with stm32 you can debug with opensource tools ?
09:57 AM carabia: yes, openocd + gdb and a frontend for that
09:58 AM LeoNerd: Randomly while it comes to my mind: Does anyone have any good suggestions for ISP'ing an Arduino Pro Mini board? Those annoyingly don't have the 2x3 ISP header on them :/
09:58 AM LeoNerd: My current thought involves rigging up some pogo pins to press into it
09:58 AM carabia: i have pretty much always used sw4stm32, it's a patched eclipse, and while it is a pain in the butt at times, it is rather straightforward to use
10:02 AM carabia: ...for the sake of the channel's name, i'm not trying to tell you to throw your avrs in the trashcan. just that in this day and age if you want to do electronics, at some point you should (read: have to) give arms a shot
10:02 AM carabia: that said they both have their respective applications
10:21 AM Emil: carabia: stfu
10:21 AM Emil: carabia: why the heck would he diy the board
10:21 AM Emil: when he can order
10:21 AM carabia: he needed ONE
10:21 AM Emil: carabia: so?
10:21 AM Emil: carabia: 4,9 usd delivered
10:21 AM carabia: for something that has 2x dip sockets and a bunch of passives?
10:21 AM Emil: carabia: of course
10:21 AM Emil: carabia: china costs fucking nothing and produces good quality pcbs
10:21 AM carabia: he can probably get the stuff from the nearest electronics store and make the board in a day rather than wait for the turnaround
10:22 AM Emil: that's true
10:22 AM learath: Emil: that's... mixed
10:22 AM Emil: if time and cost are issues then of course you diy it
10:22 AM carabia: i'm not saying diy a pcb. i'm saying proto it
10:22 AM Emil: but if time is not an issue then of course he should order the board
10:22 AM learath: Emil: they absolutely can produce a quality pcb, but a lot of the stuff on scambay isn't
10:22 AM carabia: well, he kind of said, "what's cheaper", too
10:23 AM Emil: If he values his time then china is cheaper, also
10:24 AM learath: Emil: most people don't value their time
10:24 AM carabia: err, no it's not
10:25 AM carabia: unless it's an insurmountable task to solder a few dip sockets on a board along with a few passives
10:28 AM Emil: carabia: for a beginner it probably takes over an hour to do that
10:29 AM enh: hi
10:29 AM carabia: so then you value your time of a trip to the store, or ordering locally with a shipping time of a few days, vs. waiting for a turnaround
10:30 AM carabia: also, if we want to go nitty gritty on the whole price thing, you can get st dev boards with aux circuitry and breakout for less than the mf cost for a single board
10:35 AM Emil: carabia: I am aware
10:49 AM enh: all right?
10:50 AM Emil: enh: of course :D
10:51 AM polprog: what a heatd discussion
10:52 AM LeoNerd: Semi-topical question: Does anyone know what those little metal bars are called, that you put on a PSU between the 'force' and 'sense' terminals? I thought they were called "shorting bars" but eBay doesn't seem to find me much for that
10:53 AM LeoNerd: I want to buy some spares since I lost them
10:53 AM LeoNerd: (well rather, I bought a secondhand PSU that didn't have them in the first place)
10:54 AM twnqx: force and sense? :S
10:54 AM LeoNerd: Yes; the little metal bar you put between the two when you want to operate it in 2wire mode
10:54 AM LeoNerd: What is that called?
10:55 AM twnqx: i don't even have a clue what those terminals are supposed to be
10:55 AM LeoNerd: Then you're unlikely to know the answer to my question
10:56 AM twnqx: yeah.... i was thinking of a power resistor to measure current possibly, as they look like a metal bar :P
10:56 AM LeoNerd: ... no
10:56 AM LeoNerd: This is just a metal shorting lnk
10:56 AM LeoNerd: Have you never seen or used a 4wire PSU?
10:57 AM twnqx: only those with 3x AC (phase shifted) and ground, if you're talking input side
10:57 AM twnqx: but i rarely have a need for multi-kW PSUs
10:58 AM LeoNerd: No
10:58 AM LeoNerd: On the output side
10:58 AM LeoNerd: You often get two pairs of red/black terminals. The main pair has the actual output current, and the "sense" pair is for voltage feedback
10:58 AM LeoNerd: So you can account for voltage drops down cabling, if you want nicely accurate output
10:59 AM twnqx: ah, i see
10:59 AM twnqx: but no, i know of the principle, but didn't even know you can have them off-the-shelf
10:59 AM LeoNerd: In the case that you don't want such a sense, you put a shorting link between the two terminals so it just senses at the front panel
10:59 AM LeoNerd: That's done with a little metal bar, which I seem to have lost
11:00 AM LeoNerd: Hrm.. actually maybe this is quite a rare thing to buy, now I think about it
11:01 AM LeoNerd: My PSU design is from the early 1980s, when people started putting these terminals on PSUs but before they realised they ought to link them internally with a resistor anyway for various failure-mode handling cases
11:01 AM LeoNerd: So anything sufficiently new has a resistor and doesn't need the bar. so maybe they're rare to find
11:01 AM LeoNerd: Maybe I should just put a resistor in mine anyway then
03:32 PM Raykin: Hi
03:34 PM polprog: evening
03:34 PM HelloShitty: Hello
03:35 PM Raykin: Guys can you have phase shift PWM with variable duty cycle on atmega 328p?
03:37 PM Emil: Raykin: what is "phase shift PWM"?
03:38 PM polprog: probaby generating a wfm that is phase shifted on demand
03:38 PM Emil: Raykin: the phase of your pwm compared to the other pwm outputs is entirely dependent on when you start your pwm
03:38 PM polprog: oh, squeaky dave is measuring atto amps
03:38 PM Emil: polprog: wfm?
03:38 PM polprog: waveform
03:39 PM Emil: Controlling the phase is hard, though
03:39 PM Emil: but not impossible
03:39 PM LeoNerd: It's just a matter of resetting the timer count at the right time
03:39 PM LeoNerd: Easier to do the slower it ticks
03:40 PM Raykin: Its a constant phase shift like say 20% of waveform 1 to 2
03:40 PM Jartza: ahlo
03:40 PM Raykin: Hello
03:40 PM Raykin: Right now i cant vary both duty cycle and get a phase shift using the hardware pwm options
03:41 PM LeoNerd: You can't on one timer, n
03:41 PM Raykin: Ah
03:41 PM LeoNerd: But if you have two timer units set to the same prescale divider, you can do phase shift between them
03:41 PM Raykin: ah
03:41 PM Raykin: It would work
03:43 PM Raykin: So is it a matter of setting one then addding a delay then setting the other ones registers?
03:43 PM LeoNerd: No, just adjust the count register
03:45 PM Raykin: The count register of the second timer?
03:46 PM LeoNerd: Yes
03:46 PM HelloShitty: Guys, I'm back with more questions
03:46 PM HelloShitty: heheh
03:46 PM LeoNerd: So for example if you were needing 16bit timers, you'd need one of the chips that has multiple of them
03:46 PM LeoNerd: E.g. the 328PB
03:46 PM HelloShitty: I'm reading chapter 24 - Analog-to digital Converter
03:46 PM HelloShitty: I need to read values from OpAmps outputs
03:47 PM polprog: chapter 24 of what?
03:47 PM HelloShitty: datasheet
03:47 PM HelloShitty: sorry
03:47 PM Raykin: Its alright,ill do it with the two 8 bit ones on arduino nano
03:48 PM HelloShitty: I read at 24.2 - Overview
03:48 PM HelloShitty: page 237
03:48 PM HelloShitty: that we can use a capacitor on pin AREF to improve noise performance
03:49 PM HelloShitty: How do we connect this cap and of what value?
03:49 PM HelloShitty: Is it an electrolitic one?
03:49 PM cehteh: 100nf to GND
03:49 PM cehteh: ceramic
03:49 PM HelloShitty: ok
03:49 PM HelloShitty: thanks
03:49 PM cehteh: and some AVR's want a bit set somewhere when that cap is connected iirc
03:50 PM cehteh: and when you want more stability you may want filter the AVCC input as well
03:50 PM HelloShitty: wait
03:50 PM HelloShitty: I don't have ceramic 100nf
03:50 PM cehteh: and .. do oversampling and averaging
03:50 PM HelloShitty: can it be a film cap?
03:50 PM cehteh: yes
03:50 PM HelloShitty: good
03:50 PM cehteh: well dunno how much noise those have
03:51 PM cehteh: maybe not, just try
03:51 PM cehteh: isnt critical
03:51 PM cehteh: last point, add filtering in software
03:52 PM cehteh: rolling average is so easy to do that it makes no sense to leave out, doesnt even need additional memory just a bit shifting
03:52 PM cehteh: and you get increased resolution as bonus
03:53 PM HelloShitty: wait
03:53 PM HelloShitty: I just placed the 100nF cap
03:53 PM HelloShitty: at AREF
03:53 PM cehteh: first few ADC reads are crap, after starting the ADC up ..
03:54 PM LeoNerd: Or after switching the reference. or the MUX
03:54 PM Emil: cehteh: in the context of avrs
03:54 PM LeoNerd: Or after anyone in the room sneezes. or...
03:54 PM Emil: cehteh: that noise doesn't really matter
03:54 PM LeoNerd: Bascially, always read the ADC a bunch of times and ignore the first few readins
03:54 PM Emil: it's only 10 bits sar
03:54 PM LeoNerd: I usually do either 3 or 5, ignore the first, average the rest
03:54 PM LeoNerd: (because average of 2 or 4 is just a bitshift)
03:54 PM cehteh: actually the noise improves the reads when done right :)
03:54 PM LeoNerd: Yup
03:55 PM Emil: Discarding only once is enough
03:55 PM cehteh: (when you consider uniform noise)
03:55 PM LeoNerd: It's called decimation
03:55 PM Emil: Because that gets rid of the possible crap at sample and hold
03:55 PM Emil: LeoNerd: lol why the heck :D
03:55 PM LeoNerd: Why what?
03:55 PM Emil: LeoNerd: ignore 3 or 5
03:55 PM cehteh: i just count down 255 to 0 and add up the last 16 reads or so
03:55 PM Emil: LeoNerd: it's enough to ignore the first read
03:55 PM LeoNerd: Hm?
03:56 PM LeoNerd: I said: I read 3 or 5 times, ignore the *first* and average the rest
03:56 PM Emil: Oh
03:56 PM Emil: I can't read
03:56 PM Emil: yeah
03:56 PM LeoNerd: :)
03:56 PM Emil: https://emil.fi/jako/kuvat/2017-08-24_23-19-50_Yu3OUp51.png
03:56 PM cehteh: later then value = value-value/16 + ADC; ... done
03:56 PM Emil: lol
03:57 PM Emil: anyone know if <<8 is "free"?
03:57 PM LeoNerd: Should be
03:57 PM Emil: yeah but gcc T.T
03:58 PM polprog: y so many highlights?
03:58 PM HelloShitty: ok, the cap is now correctly placed... I'm sorry the delay
03:58 PM HelloShitty: I also had to check the dinner in the oven
03:58 PM HelloShitty: xD
03:59 PM Emil: polprog: vituttaako, häh?
03:59 PM Emil: :D
03:59 PM Emil: ;)
03:59 PM Emil: HelloShitty: don't place any other voltage at AREF then
03:59 PM Emil: You'll break the analog reference
03:59 PM polprog: Emil: im not pissed :D
04:00 PM HelloShitty: Emil:
04:00 PM HelloShitty: I have a small wire from AREF to the +5V DC
04:00 PM HelloShitty: which is the circuit power source
04:00 PM Emil: HelloShitty: remove it
04:00 PM HelloShitty: now I placed the cap between AREF and GND
04:00 PM HelloShitty: hum ok
04:01 PM HelloShitty: so it's just the cap making the connection betten AREF and +5V DC, right?
04:01 PM HelloShitty: ok
04:01 PM HelloShitty: that will save some space and wiring
04:02 PM HelloShitty: Now I need to read what cehteh said all again
04:02 PM Emil: HelloShitty: https://emil.fi/jako/kuvat/2017-08-24_23-31-30_NWRMS4K5.png
04:03 PM Emil: https://emil.fi/jako/kuvat/2017-08-24_23-32-05_NkGXEyVH.png
04:03 PM Emil: HelloShitty: wire the 5v to AVCC
04:03 PM polprog: if you want to switch between arefs you could trhy mux the voltage sources (correct me if im eonr)
04:03 PM polprog: muxing*
04:03 PM polprog: s/eonr/wrong
04:04 PM Emil: What I want to know is how low you can take externally set AREF
04:04 PM Emil: If there's a lower limit
04:04 PM polprog: you can always try to make some low noise amp
04:04 PM Emil: Point is that
04:04 PM Emil: By switching the reference from AVCC to band gap
04:05 PM Emil: you can increase the dynamic range of the ADC
04:05 PM polprog: ??
04:05 PM polprog: i know what's synamic range but how would you do it?
04:05 PM polprog: dynamic*
04:05 PM Emil: polprog: normally measure with AVCC and if the voltage drops under 1.1V then switch to band gap
04:06 PM polprog: ah
04:06 PM polprog: smart
04:06 PM Emil: You retain resolution while zooming in on a setion
04:06 PM Emil: section*
04:07 PM polprog: hmm
04:07 PM Emil: polprog: here's a neat trick, too
04:08 PM Emil: polprog: connect the 16 bit pwm output to a low pass filter and that to the aref pin
04:08 PM polprog: you could try to do that with switchable x1 and, say, x10 gain (assuming no noise)
04:08 PM polprog: that's brilliant
04:08 PM Emil: You've now got a controllable range on the ADC
04:08 PM Emil: You can't change it quickly
04:08 PM Emil: but for some things that's fine
04:09 PM Emil: Well, actually, depending on how you do it you could do it pretty quicklöy
04:09 PM polprog: i think switchable gain preamps could be faster
04:09 PM Emil: they are :D
04:09 PM polprog: :D
04:09 PM polprog: nice
04:10 PM Emil: This is for when you just have an avr and must do shit
04:10 PM polprog: i have no idea about analog stuff (ok, maybe a bit)
04:10 PM cehteh: atmel has a nice technical paper on that
04:10 PM Emil: cehteh: on what?
04:16 PM cehteh: http://www.atmel.com/images/doc8003.pdf
04:16 PM cehteh: HelloShitty: ^^
04:17 PM polprog: hmm
04:17 PM polprog: suppose i took a ton of measurements with my adc
04:18 PM polprog: and then averaged them (and did some mathematica transforms, standard deviations, discarding maximums and minimums all sorta stuff)
04:19 PM polprog: could i get much more precision from that?
04:19 PM Emil: Don't discard
04:19 PM Emil: Unless obviously measurement errors
04:19 PM Emil: But like cehteh said
04:19 PM polprog: obviously
04:19 PM Emil: The lsb needs to flip
04:19 PM polprog: errors out
04:19 PM HelloShitty: sorry guys I had to take dinner out of the oven and take care of my daughter bath
04:19 PM HelloShitty: be back after dinner
04:19 PM polprog: bon apetit HelloShitty
04:19 PM HelloShitty: but probably I'll need explanations again
04:20 PM polprog: lsb needs to flip, that makes sense
04:21 PM polprog: im wondering if i could make a meter that outperforms my handheld brymen
04:21 PM polprog: like a bench meter
04:21 PM polprog: for precise stuff
04:21 PM LeoNerd: If you just want a basic DC voltmeter function, that's easy to make much better than handhelds
04:21 PM LeoNerd: I've made a 6 digit bench voltmeter
04:22 PM polprog: my handheld is 6 digit :D
04:22 PM polprog: i was thinking... 7 or 8 digits
04:22 PM LeoNerd: Yah, that's not too hard
04:22 PM LeoNerd: If you want range switching it's a little tricky but still not impossible
04:22 PM polprog: im sure there are some phenomenons that occur in this type of stuff
04:22 PM LeoNerd: You're looking at $100 or so at that point though
04:22 PM Emil: Wellll
04:22 PM polprog: why so expensive?
04:23 PM Emil: polprog:
04:23 PM Emil: here's the thing
04:23 PM LeoNerd: Because if you want a voltage reference, an input buffer, a divider network, not to mention the actual ADC, that are capable of 8 digits, you'll have to pay for them
04:23 PM Emil: polprog: you could sample using gpio if enough noise was present
04:23 PM LeoNerd: My divider resistor alone cost me £20
04:23 PM Emil: you could also sample realy slow if you didn't care about frequency
04:23 PM polprog: LeoNerd: precision resistors?
04:24 PM Emil: A lot of professional mics are actually 1 bit
04:24 PM Emil: but with 2.4MS/s
04:24 PM Emil: or even more
04:24 PM Emil: as long as there's noise
04:24 PM Emil: and that noise is not correlated
04:24 PM LeoNerd: polprog: no point having an 8 digit meter if you're going to build it on 1% carbon film resistors, is it? :)
04:24 PM Emil: and you sample quickly enough and long enough
04:24 PM polprog: LeoNerd: sure
04:24 PM Emil: you can make arbitrary amounts of bits
04:24 PM Emil: but how much you are willing to trust your measurement is another thing
04:25 PM polprog: eventually it would need to be calibrated
04:25 PM LeoNerd: Yes
04:25 PM polprog: but that can be done
04:25 PM LeoNerd: Calibration alone isn't useful unless you know how much the device will drift though
04:25 PM Emil: In the timespan that we humans use multimeters
04:25 PM polprog: well you need to characterize it too
04:25 PM Emil: say like 2-3 seconds
04:25 PM LeoNerd: You could calibrate that to 8 digits at the cal lab, but it would be useless if it will drift more than that by the time you get it home again
04:25 PM Emil: You can increase the avrs adc resolution to like 16 bits
04:26 PM Emil: easily
04:28 PM polprog: ill first try to write a piece of code that takes measurements and just averages them
04:28 PM Emil: https://emil.fi/jako/kuvat/2017-08-24_23-57-21_uNErqyMo.png
04:28 PM polprog: hmm
04:28 PM polprog: link?
04:29 PM LeoNerd: polprog: "decimation"
04:29 PM Emil: polprog: the appnote above
04:29 PM polprog: thx
04:30 PM Emil: 3 seconds is 0.3Hz so you can oversample twice more to get 18 bits
04:30 PM polprog: i know
04:30 PM polprog: what's the practical barrier?
04:30 PM Emil: There isn't
04:31 PM Emil: Well, perhaps that it's a quad-increase in sampling time for every bit
04:31 PM polprog: hmm
04:32 PM LeoNerd: The practical barrier is that it can't work beyond your noise level
04:32 PM polprog: that's shielding's job
04:32 PM LeoNerd: It also gets very slow the more extra bits you want to gain
04:32 PM Emil: LeoNerd: false
04:32 PM LeoNerd: Hmm?
04:32 PM polprog: maybe external ADC could help - easier to shield
04:32 PM LeoNerd: Shielding only takes away some sources of noise
04:33 PM polprog: i know
04:33 PM Emil: LeoNerd: digging under noise floor is possible
04:33 PM LeoNerd: Other sources remain
04:33 PM polprog: internal sources, like the CPU core and stuff?
04:33 PM Emil: But yeah like you and I said, it becomes slow
04:33 PM LeoNerd: The slower it gets, the more likely your signal has to have moved by the time you finish, anyway
04:33 PM Emil: True
04:34 PM polprog: hmm, you could try a sample and hold buffer
04:34 PM Emil: polprog: no
04:34 PM polprog: why not
04:34 PM Emil: polprog: well, if you use delay lines then mayyyyybe :D
04:35 PM Emil: but those decay, too
04:36 PM polprog: ill try oversampling for now
04:36 PM LeoNerd: S&H will add noise
04:36 PM LeoNerd: really, all you're doing is basically the same technique as deltasigma ADCs use anyway
04:36 PM LeoNerd: You could just get one of those :)
04:36 PM * LeoNerd looking at a 24bit ADC now in fact
04:36 PM polprog: yea, i saw 24 bit adcs
04:38 PM cehteh: 10 bits are enough for everyone!
04:38 PM Lambda_Aurigae: 8 bits should be enough for everybody. extra bits are just a waste of electricity!
04:40 PM * LeoNerd hunting a 20bit DAC too
04:40 PM polprog: i saw one recently
04:41 PM LeoNerd: Looking for one largely to see if there's much point in buying i, as compared just making one with the dual-PWM technique and an ADC
04:42 PM polprog: LeoNerd: ADC08200
04:42 PM polprog: no idea if useful for you
04:42 PM LeoNerd: That doesn't sound like a DAC
04:42 PM polprog: wait
04:42 PM polprog: duh
04:42 PM polprog: im stupid
04:42 PM LeoNerd: 8bit 200MS/sec ADC :)
04:42 PM LeoNerd: Sounds like an excellent device for an oscilloscope
04:43 PM LeoNerd: What I want is exactly opposite in basically every way ;) A 20bit DAC with high linearity, but I'd be happy with even just a few samples/sec
04:43 PM LeoNerd: It's to set DC voltage or current levels, very accurately
04:44 PM polprog: making something like a precision source?
04:44 PM ohsix: can't delta-sigma?
04:44 PM LeoNerd: polprog: indeedy :)
04:44 PM polprog: hmm
04:44 PM polprog: i could use one like that
04:44 PM polprog: or in general i could use a psu...
04:45 PM LeoNerd: ohsix: I could but that's a *lot* of CPU work as compared just PWM'ing it
04:45 PM day_ is now known as daey
04:45 PM polprog: i saw one for 80 euros but i didnt buy it
04:45 PM polprog: precision stuff is cool
04:45 PM cehteh: you could get a good ADC and make a feedback loop to control a not so good DAC
04:46 PM LeoNerd: Random chip: TI DAC1220E - 20bit 500S/sec DAC, £11
04:46 PM ohsix: at the same precision, cpu use is probably comparable to just using the pwm peripheral
04:46 PM LeoNerd: cehteh: Yup
04:46 PM cehteh: looks to me that getting highly accurate ADC's is considerably easier than good DAC's
04:46 PM LeoNerd: ohsix: huh? Once set, the PWM peripheral costs no CPU at all
04:46 PM ohsix: but use a little bit more
04:46 PM cehteh: pwm the DAC on the lsb
04:46 PM ohsix: at same precision
04:46 PM Lambda_Aurigae: LeoNerd, there are some units that are built for that...not sure if they are quite accurate enough for you but I have played with one from Maxim/Dallas. DMM chips.
04:47 PM LeoNerd: cehteh: Yes, that is one approach. You can overlap two 16bit PWM DACs to make anyhing up to about 22bits of resolution, and feedback with an ADC for fine correction
04:47 PM ohsix: :|
04:47 PM Lambda_Aurigae: oh, wait, you want DAC, not ADC...duh.
04:47 PM cehteh: i never did that, just guessing about a aproach
04:48 PM LeoNerd: Lambda_Aurigae: Well, ish.
04:48 PM cehteh: DAC has all kinds of problems with varying loads, impedances, inductivity 'n shit
04:48 PM LeoNerd: As I said; if you want an N-bit DAC you can make one out of some (essentially free) PWM channels plus an N-bit ADC for feedback
04:48 PM Lambda_Aurigae: max5719
04:49 PM LeoNerd: Turns out actually that might be best; aside from a couple of weird-looking DACs, all of them at 18bits or higher seem to be at least £30 or so
04:49 PM LeoNerd: Whereas I can get a 24bit ADC for £3
04:49 PM LeoNerd: Lambda_Aurigae: yeah even that's £15 a chip
04:49 PM Lambda_Aurigae: yeah.
04:49 PM Lambda_Aurigae: they aren't cheap.
04:50 PM LeoNerd: Really, at this level you're always paying for the speed, which I really don't need
04:50 PM LeoNerd: This chip you mention says settles in 750nsec, so that's good for 1Msample/sec. I'd honestly be fine with 10 samples/sec
04:51 PM LeoNerd: Which is where the DIY-style PWM DACs really shine
04:52 PM Emil: Anyone know how to convert drill file to g-code/pdf/something like that
04:52 PM Lambda_Aurigae: max542 is 16bit
04:53 PM ohsix: there are lots of reasons to not go open loop on something you expect to be precise
04:54 PM ohsix: is it a hersesy to mention stm32's multiple adcs/dacs :p
04:55 PM LeoNerd: DACs on an MCU?! Heresy indeed I say sir!
04:55 PM ohsix: it has a smart mux for scanning a lot of inputs too, and channel injection
04:55 PM LeoNerd: Mm.. yes; MUXing will be fun
04:56 PM LeoNerd: Now I've made a basic 24bit single voltmeter, my next one will be a bipolar thing with min/max peakhold circuits in analog, so I need to scan those channels too
04:56 PM ohsix: single ~= no ranges / frontend?
04:56 PM LeoNerd: Yah; no range switching
04:57 PM LeoNerd: that's another thing to fix now I know how to do it
04:57 PM LeoNerd: https://twitter.com/cpan_pevans/status/888534394859925504 -- the unit currently
04:59 PM LeoNerd: This thing is just an LTC2400 basically. My redesign involves a MAX11200, with probably 3 range switching and min/max peak holds
04:59 PM LeoNerd: Because again in my category of "building test equipment I've never seen before", I've yet to see anyone make a voltmeter with analog min/max peakhold
05:06 PM nabil: Hi
05:06 PM nabil: Are there any peole here
05:06 PM nabil: ?
05:07 PM LeoNerd: 164 by my count
05:07 PM polprog: odd
05:07 PM aczid: hello
05:07 PM nabil: yep; just saw it
05:07 PM nabil: I have a problem with programming an atmega32u4
05:07 PM polprog: im out of op amps
05:07 PM nabil: I think I made a mistake when setting the lfuse
05:09 PM nabil: basically I wanted to use an external 8MHz clock without deviding it by 8, instead of using lfuse:w:0xDE
05:09 PM nabil: I used 0x5E
05:09 PM LeoNerd: Do you really mean "external clock2?
05:09 PM LeoNerd: Or do you mean crystal?
05:10 PM nabil: I mean crystal
05:10 PM nabil: now I can't read the fuse's values
05:10 PM nabil: and can't program it
05:11 PM nabil: the one I used was 0xD0
05:11 PM nabil: not 0x5E
05:11 PM nabil: the original one was 0x5E
05:12 PM nabil: I'm using usbasp for programming
05:12 PM nabil: Any ideas for a solution to this
05:12 PM nabil: ?
05:13 PM LeoNerd: Yah; you've selected external clock there
05:13 PM LeoNerd: So you'll have to apply an external clock to the input pin to make it work
05:13 PM LeoNerd: Another AVR chip could do it
05:13 PM nabil: That's what I wanted to do, I have an external 8MHz clock
05:13 PM LeoNerd: http://www.engbedded.com/fusecalc/ might be useful to you also
05:14 PM nabil: but still have the same problem
05:14 PM LeoNerd: WEll no idea. To be honest I'm having a hard job following what you've said because you've said too many numbers I can't keep track of
05:14 PM LeoNerd: use above page to enter the numbers you *ACTUALLY* put into the chip and see what it's now set to
05:15 PM LeoNerd: then apply a clock as appropraite
05:15 PM LeoNerd: then continue as above
05:15 PM nabil: okey, I'll repeat to make it clear
05:15 PM nabil: right now I can't read the fuse's state
05:15 PM nabil: the original lfuse value, was : 0x5E
05:16 PM nabil: I wanted to remove the division by 8, but I changed the startup time by mistake as well,
05:16 PM nabil: I set the lfuse to 0xD0
05:17 PM nabil: (I think the correct value was : 0xDE
05:17 PM LeoNerd: Right; so yes D0 means it's now on external clock
05:17 PM LeoNerd: not crystal
05:17 PM LeoNerd: so you'll have to apply a clock. not a crystal. to the pin
05:17 PM nabil: ah, okey, I thought a crystal would give a similar signal
05:17 PM LeoNerd: ((also purely as a useful note: you can change the clock divider in software; I usually leave the fuse as it is and make resetting the clock prescaler one of my first tasks in main() ))
05:17 PM LeoNerd: No
05:18 PM LeoNerd: This is the mistake everyone makes
05:18 PM LeoNerd: which is why I mention it *really really really* clearly
05:18 PM LeoNerd: An external *CLOCK* is something that pulses of its own, without any further need to poke it to do anything
05:18 PM HelloShitty: ok, guys, I'm back
05:18 PM LeoNerd: A *crystal* is something that would resonate at its tuned frequency if put into the inverter oscillator that XTAL1+XTAL2 pins provide
05:18 PM ohsix: is that really confusing? he
05:18 PM LeoNerd: Totally unrelated
05:19 PM LeoNerd: Since your chip is now set in external *CLOCK* mode, it needs a clock. I.e. something that pulses of its own
05:19 PM ohsix: all the talk about highs wing and low swing and stuff in the actual description of the clock bits and whatnot
05:19 PM LeoNerd: You can use another AVR chip to provide that
05:19 PM HelloShitty: I have saved the link cehteh sent to here about the technical doc about ADC
05:19 PM nabil: So I'll apply a clock signal to one of XTal pins, right?
05:19 PM HelloShitty: But for now I want to focus on how to make a basic reading
05:19 PM LeoNerd: Either turn on the CKOUT fuse (but that requires more risky fuse fiddling), or just write a tiny program that turns on one of the PWM controllers into its fastest possible settings with the toggle mode
05:19 PM LeoNerd: Or use a signal generator to output a square wave
05:19 PM LeoNerd: or any other such source of a fast clock
05:20 PM LeoNerd: It realyl doesn't matter too much what the frequency is, it just has to be fast enough to be able to run ISP enough to rewrite the fuses again
05:20 PM nabil: And apply it to one of the xtal pins or both of them?
05:22 PM HelloShitty: I have a question: I'm now confused...
05:22 PM LeoNerd: To the input one. I forget offhand which
05:22 PM LeoNerd: data sheet will remind you
05:22 PM HelloShitty: I just read in the previous page that to enable the ADC PRADC bit must be set to 0
05:22 PM LeoNerd: HelloShitty: it *probably* defaults to that anyway though
05:23 PM LeoNerd: so you can ignore it unless you've overridden it. I often don't bother
05:23 PM HelloShitty: Now I'm reading that to enable ADC ADCEN must be enabled in ADCSRA
05:23 PM HelloShitty: so which one enables ADC?
05:23 PM nabil: Thank you @LeoNerd
05:23 PM HelloShitty: Or both must be set
05:23 PM HelloShitty: ?
05:24 PM nabil: I didn't think the diff between clock and crystal would matter that much
05:26 PM HelloShitty: ok, I got it
05:26 PM HelloShitty: PRADC starts the conversion and ADCEN enables the ADC
05:32 PM LeoNerd: nabil: Yes; everyone does that. that's why I always say it clearly
05:32 PM LeoNerd: Maybe one day people will learn.. but meh
05:33 PM polprog: night
05:34 PM HelloShitty: Jartza: long time no see
05:34 PM HelloShitty: remember me?
05:34 PM HelloShitty: xD
05:43 PM HelloShitty: LeoNerd:
05:44 PM HelloShitty: you around?
05:44 PM nabil: yes
05:44 PM HelloShitty: nabil: can you help me with a makefile?
05:45 PM nabil: I'll see if I can, give me details?
05:45 PM HelloShitty: ok, I have a template downloaded from Atmel site
05:45 PM HelloShitty: and now I'm trying to organize my project
05:45 PM HelloShitty: with main files
05:46 PM HelloShitty: with 3 main files
05:46 PM HelloShitty: project.c, ad9850.c and atmega328p.c
05:46 PM HelloShitty: the file which contains the main() function is the project.c
05:46 PM nabil: I think you need to have only one main in the end
05:46 PM Lambda_Aurigae: LeoNerd, people don't learn..they want other people to spoon feed them.
05:46 PM HelloShitty: each one of this .c files has their own .h files
05:47 PM nabil: so change the other ones to header +.c files
05:47 PM nabil: and include them in the main
05:47 PM HelloShitty: ok, bad words from me
05:47 PM HelloShitty: wait
05:47 PM HelloShitty: I meant 3 main files but only project.c contains main() function
05:47 PM HelloShitty: the othter 2 .c files only have function definitions
05:48 PM nabil: ok
05:48 PM HelloShitty: and wach one of these 3 .c files has their own .h file
05:48 PM HelloShitty: so
05:49 PM nabil: you said the other two .c files have only function definitions?.
05:49 PM HelloShitty: ad9850.o depends on ad9850.c and ad9850.h
05:49 PM HelloShitty: yes
05:49 PM HelloShitty: atmega328p.o depends on atmega328p.c and atmega328p.h
05:49 PM HelloShitty: my question is about the file that contains the main() function
05:50 PM nabil: yes?
05:50 PM nabil: what is your question?
05:50 PM HelloShitty: does it only depends on project.c and project.h or it also depends on all the other .c and .h files?
05:50 PM HelloShitty: -----------------
05:50 PM nabil: you have to include the .h in the .c file (for the other two)
05:50 PM HelloShitty: ad9850.o: ad9850.c ad9850.h
05:50 PM HelloShitty: atmega328p.o: atmega328p.c atmega328p.h
05:50 PM HelloShitty: project.o: project.c project.h ad9850.c ad9850.h atmega328p.c atmega328p.h
05:50 PM HelloShitty: should it be like this?
05:51 PM nabil: for the one containing main you include the two headers
05:51 PM nabil: then you compile the three .c files with -c
05:51 PM HelloShitty: yeah, I'm ytalking about makefile
05:51 PM Emil: HelloShitty: abort
05:51 PM HelloShitty: Emil: abort what?
05:51 PM Emil: HelloShitty: whatcha including shit like atmega328p.o atmega328p.c and atmega328.h for
05:52 PM HelloShitty: Well, isn't a makefile built like that?
05:52 PM HelloShitty: I know there are other ways
05:52 PM HelloShitty: but I just want to make it simple
05:53 PM HelloShitty: I know about all the $@ and %$ stuff
05:53 PM HelloShitty: but didn't want to waste time on that now
05:53 PM HelloShitty: just wanted to know how to do the dependencies in the makefile
05:53 PM HelloShitty: -------------------------------
05:53 PM HelloShitty: ad9850.o: ad9850.c ad9850.h
05:53 PM HelloShitty: atmega328p.o: atmega328p.c atmega328p.h
05:53 PM HelloShitty: project.o: project.c project.h ad9850.c ad9850.h atmega328p.c atmega328p.h
05:53 PM HelloShitty: ------------
05:54 PM HelloShitty: I have it like that
05:54 PM HelloShitty: but I don't know if that is correct
05:54 PM HelloShitty: for project.o, do I need to include all other .c and .h files?
05:55 PM Emil: HelloShitty: stop
05:55 PM Emil: HelloShitty: AVRs are simple.
05:55 PM ohsix: gmake can do patsubst and stuff, so if you have a list of c files you can generate a list of .o files
05:55 PM Emil: Read https://emil.fi/avr
05:56 PM Emil: If you want to understand makefiles quickly https://matthias-endler.de/2017/makefiles/ and http://nullprogram.com/blog/2017/08/20/
05:57 PM HelloShitty: I'm using avr-gcc but I'll read that
05:57 PM Emil: ...
05:57 PM Emil: Yes
05:57 PM Emil: That guide is for GCC
05:57 PM Emil: GCC-AVR is just GCC that's compiled to target AVR
05:59 PM ohsix: it bucks the host/target triplet the gnu tools use
05:59 PM ohsix: but it's a normal target
06:00 PM Emil: bucks?
06:02 PM LeoNerd: Lambda_Aurigae: well, the main trouble is that individuals do learn, but there's always a supply of new people who haven't learned; and I get increasingly more annoyed at having to explain every time
06:16 PM polprog: make a guide like emil did
06:16 PM LeoNerd: ?
06:16 PM polprog: for newbies
06:16 PM LeoNerd: That sort of thing rarely helps
06:16 PM LeoNerd: People would only read it after they'd made the mistake the first time
06:16 PM LeoNerd: The thing that annoys me, is people making the mistake the first time anyway
06:17 PM LeoNerd: It's *really* hard to make people read things before they know they need to read them
06:17 PM polprog: heh, i know
06:17 PM polprog: levels of competence
06:18 PM LeoNerd: It's why most countries have a driving test, for example
06:18 PM * LeoNerd sometimes wishes a lot more things came with mandatory filter testing
06:18 PM polprog: like internet access
06:23 PM Emil: LeoNerd: you are too cynical
06:23 PM LeoNerd: I've learned from ~15 years of experience at this ;)
06:23 PM LeoNerd: The world will always supply you with a fresh stream of people who haven't read the docs
06:25 PM HelloShitty: Ok, I tried to make the Makefile but it's not working at all
06:25 PM HelloShitty: can't understand this of dependencies
06:26 PM LeoNerd: HelloShitty: http://paste.debian.net/982943/ <-- is half of mine, if it's useful
06:27 PM HelloShitty: LeoNerd: thanks for the link
06:27 PM HelloShitty: but as you use the symbols, it won't be very useful to me because at this point I didn't want to waste time learning them
06:28 PM HelloShitty: I have 5 files
06:28 PM HelloShitty: and I can't make the dependencies to work
06:28 PM Emil: HelloShitty: stop. You _don't_ include or play with device specific files
06:28 PM Emil: HelloShitty: It's already handled for you
06:28 PM HelloShitty: I get a bunch of undeclared variables and funcitons and stuff
06:29 PM HelloShitty: Emil: you can have the best intention, but I can't understand what you say
06:29 PM HelloShitty: I just know I can't make my dependencies to work in my makefile
06:29 PM HelloShitty: with only 5 files
06:30 PM HelloShitty: I just understand that for instance my ad9850.o file deppends on ad9850.c and ad9850.h
06:31 PM HelloShitty: and that my file atmega328p.o deppends on atmega328p.c and atmega328p.h
06:31 PM LeoNerd: That's easy to write
06:31 PM HelloShitty: but then I'm not sure about the file that has the main() funciton
06:31 PM LeoNerd: Yeah that's harder
06:31 PM LeoNerd: personally I don't bother
06:31 PM HelloShitty: LeoNerd: it's easy for you that you have all this at the tip of your tongue
06:31 PM LeoNerd: Make's main goal is for minimising CPU work to compile
06:31 PM LeoNerd: don't bother
06:32 PM LeoNerd: yoyr dev. machine is maaaaaassively fast
06:32 PM LeoNerd: just rebuild the lot each time
06:32 PM LeoNerd: I do that
06:32 PM LeoNerd: I throw every .c file together in one gcc call that generates the final output
06:32 PM LeoNerd: No need to think about dependencies theb
06:33 PM LeoNerd: Any .c or .h file changed? Just rebuild the lot
06:33 PM LeoNerd: It means my Makefile doesn't have to understand how to extract dependencies
06:34 PM HelloShitty: At the beginning those files will change
06:34 PM HelloShitty: as I'm building my project
06:34 PM HelloShitty: I read that link that someone posted here about the makefiles
06:34 PM LeoNerd: Any program small enough to fit in an AVR can be rebuilt in its entirity in about 3 seconds
06:34 PM LeoNerd: So it's not worth aplitting it up
06:35 PM LeoNerd: Just throw them all together. That's all it will do *anyway* if you have LTO turned on
06:35 PM HelloShitty: the catch is that I can't establish a relationship between the file where I have the main() fucntion and the file where thy, in the site, have their main() function
06:35 PM LeoNerd: Bit hint: You really want LTO turned on :)
06:35 PM HelloShitty: What is LTO?
06:36 PM LeoNerd: An easily googleable term
06:36 PM LeoNerd: I am phonetypung and trying to be efficient
06:36 PM LeoNerd: I am telling you enough to learn on your own. I am bot trying to teach everythong roght now as I want to go to bed
06:37 PM HelloShitty: https://www.acronymfinder.com/LTO.html
06:37 PM HelloShitty: lol
06:37 PM HelloShitty: 31 finds for LTO
06:37 PM HelloShitty: ok, go to bed
06:37 PM HelloShitty: I'll try to find help somewhere else
06:37 PM HelloShitty: thanks for the help given
06:37 PM LeoNerd: Excellent. I expect one of those will be correct
06:38 PM LeoNerd: Should be easy enough to disregard most of them
06:38 PM LeoNerd: Huh. wow it's not on that list
06:39 PM LeoNerd: Maybe man avr-gcc and search
06:39 PM HelloShitty: nevermind... I don't want to waste time with that for now either
06:39 PM LeoNerd: Well fine
06:39 PM LeoNerd: In any case I really do suggest "throw all the .c files together" as the solution. it avoids the deps problem
06:40 PM HelloShitty: ok...
06:40 PM LeoNerd: My lines 16-18 there
06:44 PM Emil: HelloShitty: DO_NOT_TOUCH_LINK_OR_USE_FILES_LIKE_ATMEGA328P.C_OR_ATMEGA328P.H
06:44 PM Emil: Get this through your head
06:44 PM Emil: They are handled automatically
06:45 PM Emil: LeoNerd: why don't you say this to him T.T
06:46 PM HelloShitty: Why not Emil ?
06:46 PM HelloShitty: What is wrong with those names?
06:46 PM Emil: What part of
06:46 PM Emil: _They_are_handled_AUTOMATICALLY_for_you
06:46 PM HelloShitty: You CAPS
06:46 PM HelloShitty: Your
06:46 PM Emil: Do you not understand?
06:46 PM HelloShitty: How they are handled automatically?
06:46 PM Emil: Your loss I don't care anymore
06:47 PM HelloShitty: Thank you for the help!
06:47 PM LeoNerd: You must #include <avr/io.h>
06:47 PM LeoNerd: The chip-specific file is pulled in from that
06:48 PM HelloShitty: I have it included
06:48 PM LeoNerd: Do not use the chip-specific files directy then
06:48 PM HelloShitty: you mean in .c files, right?
06:48 PM LeoNerd: no
06:48 PM LeoNerd: Er. yes/
06:48 PM LeoNerd: anywhere
06:48 PM LeoNerd: nowhere in any filr you ever write shou;d you make reference to <avr/iom328p.h>
06:49 PM HelloShitty: All my files uses that includes except the .h files which only have funvtion prototypes
06:49 PM HelloShitty: I'm not
06:49 PM HelloShitty: I never said I did
06:49 PM LeoNerd: Ok. then I'm not sure what Emil is on about
06:49 PM HelloShitty: I have 5 files
06:49 PM HelloShitty: all created by me
06:49 PM LeoNerd: OK, that's fine then
06:50 PM Emil: Do not name or create files like atmega328p.c or atmega328p.h
06:50 PM HelloShitty: project.c, atmega328p.c, ad9850.c, atmega328.h and ad9850.h
06:50 PM LeoNerd: Oh, well yeah also don't do that :)
06:50 PM LeoNerd: Files named after external chips you want to use are fine. but those atmega ones are best avoided
06:50 PM HelloShitty: And can I ask why, or am I gonna be bombed again?
06:51 PM LeoNerd: Too likely to clash with avr-libc internald
06:51 PM LeoNerd: internals
06:51 PM HelloShitty: hum, ok
06:51 PM LeoNerd: Notsure why you need that abyway
06:51 PM LeoNerd: why do you have a .c file named after an AVR chip?
06:52 PM HelloShitty: those were random names related to the content of the files
06:52 PM LeoNerd: bk
06:52 PM HelloShitty: like ad9850.c has functions related with AD9850 setup
06:52 PM LeoNerd: Syre
06:52 PM LeoNerd: *that* is fine
06:52 PM LeoNerd: I do that all the time :)
06:52 PM HelloShitty: atmega328p.c has funcitons related with atmega328p setup
06:53 PM LeoNerd: Yeah, don't do tgat :P
06:53 PM HelloShitty: ok
06:53 PM HelloShitty: I'll change names
06:53 PM HelloShitty: but I'm sure the problem isn't that anyway
06:53 PM LeoNerd: Tgat's just general project neatness
06:54 PM HelloShitty: If you still have time I'll paste my makefile somewhere and you'll see it and try to tell me why I get the errors
06:54 PM LeoNerd: Persoanlly, I keep a HAL .c file per peripheral - spi.c, i2c.c, timer16.c, etc...
06:54 PM LeoNerd: Those rarely vary per AVR part so it's easy to reuse those
06:54 PM HelloShitty: And how would you name a file that has functions to setup ports and pins of an atmega328p?
06:55 PM LeoNerd: I wouldn't
06:55 PM HelloShitty: So you would mix setup functions with other type of functions?
06:55 PM LeoNerd: The prohect-specific setup is done in void setup(void) in my main.c
06:56 PM LeoNerd: E/g/ writes to DDRx registers are just done directly there
06:56 PM LeoNerd: Those are simple enough not to need HAL functions
06:56 PM HelloShitty: ok, fair enough
06:56 PM HelloShitty: but I just decided to go the way I did
06:56 PM HelloShitty: not sure why
06:56 PM HelloShitty: just seemed to me logical
06:56 PM HelloShitty: to split devices setups
06:57 PM HelloShitty: to avoid conffusions and mixing code that has nothing to do with each other
06:57 PM LeoNerd: Well, ish... the program itself runs *on* that atmega though
06:57 PM LeoNerd: so it's odd to put it in a file named that
06:58 PM HelloShitty: Yes, I understand that but the code to set up an AD9850 is different than the one to setup the atmega
06:58 PM HelloShitty: so I split the codes and functions
06:58 PM LeoNerd: Gaaah
06:58 PM LeoNerd: no
06:58 PM LeoNerd: "to set up the atmega" doesn't really make sense here
06:59 PM LeoNerd: it's already running. it just is
06:59 PM HelloShitty: Why to mix a function named send_frequency() which is related to the AD9850with a funciton that enables the ADC or defines the ports of the AtMega as inputs or outputs and stuff like that?
06:59 PM HelloShitty: ok
06:59 PM LeoNerd: A function that enables the ADC might live in adc.c
06:59 PM LeoNerd: Mine does :)
06:59 PM LeoNerd: it's called void adc_setup(...);
06:59 PM HelloShitty: ok, inexperience (on my side) make me think like this
07:00 PM LeoNerd: If you particularly feel the ports need abstraction functions, maybe make a ports.c
07:00 PM HelloShitty: ok, fair enough too
07:00 PM LeoNerd: But realiscally that's just a write to a DDRx register
07:00 PM LeoNerd: that's one line
07:00 PM HelloShitty: yes, indeed
07:00 PM HelloShitty: it was just an example
07:01 PM HelloShitty: ok, I'm gping to try to redefine my names and code
07:01 PM LeoNerd: Why call portb_setup(_BV(PB3)); say, when you can DDRB |= _BV(PB3);
07:01 PM HelloShitty: and make a better project organization
07:01 PM LeoNerd: The latter is arguably neater
07:01 PM HelloShitty: sure
07:01 PM HelloShitty: I also use the latter
07:02 PM LeoNerd: Then you won't need a ports.c then :)
07:03 PM HelloShitty: well, this is my Makefile
07:03 PM HelloShitty: https://paste.debian.net/982945/
07:03 PM HelloShitty: the problem is probably lines 20 and 21
07:03 PM HelloShitty: maybe
07:04 PM LeoNerd: Yeah I wouldn't bother wirh that
07:04 PM HelloShitty: ok, also ignore project.o at line 2
07:05 PM HelloShitty: yeah, but I don't know how to do it the way you say
07:05 PM LeoNerd: you also don't seem to have a recipe to mske .o files
07:05 PM LeoNerd: See my file
07:05 PM LeoNerd: I do it all in one gk
07:05 PM LeoNerd: no. .o files at sll
07:05 PM LeoNerd: throw all my .c files at gcc and get the .elf out *directly*
07:06 PM LeoNerd: there's really no point thesr days doing it any other way
07:06 PM LeoNerd: AVR programs are *tiiiiiny* as compared the desktop PC compiling them
07:07 PM LeoNerd: my line 16 says: here is how to make the ELFFILE from the SOURCES
07:07 PM LeoNerd: line 18 then gives it; namely, invoke CC telling it to output to the ELFFILE, passing in all the SOURCES directly
07:08 PM HelloShitty: That looks simple but when I try it I always get it wrong
07:08 PM HelloShitty: anyway
07:08 PM HelloShitty: I'm about to go to bed now
07:08 PM LeoNerd: ok
07:08 PM HelloShitty: I have an appointment tomorrow at the dentist
07:14 PM HelloShitty: Well, in a last attempt to make this work I fixed most of the errors of makefile
07:14 PM HelloShitty: I end up with only one
07:14 PM HelloShitty: undefined reference to main
07:15 PM HelloShitty: not sure why but I have main() function in project.c file
07:15 PM HelloShitty: I'll finish this tomorrow
09:28 PM Raykin: Thanks Leonerd!
09:28 PM Raykin: The PWM with two timers and other one starting at different TCNT value worked.
09:43 PM enh: hi
09:43 PM enh: good night!
09:43 PM enh: 23:12 here
11:49 PM JanC is now known as Guest55020
11:49 PM JanC_ is now known as JanC