#avr Logs

Jun 06 2017

#avr Calendar

12:13 AM day_ is now known as daey
12:27 AM rue_house: Brando753,
12:27 AM rue_house: why attiny?
12:30 AM Emil: Do you really need 6 harfware pwms?
12:30 AM Emil: software wont do?
12:35 AM polprog: you can always use an external pwm driver
12:35 AM polprog: just sayin
12:36 AM polprog: more free cpu time
12:39 AM HighInBC: 2801s are handy for chaining as muchof PWM
12:39 AM HighInBC: as much PWm as you want
12:39 AM HighInBC: if you are not picky about freq etc
12:39 AM HighInBC: ws2801 that is
12:40 AM HighInBC: though there are probably better options
01:14 AM Brando753: polprog: well I want to minimize IC components
01:14 AM Brando753: Emil: well I want to minimize power consumption
01:14 AM Brando753: rue_house: well I wanted something and an Atmega seemed over the top for just needing 6 pwm pins :/
01:14 AM Brando753: need it in DIP form factor
01:15 AM Brando753: I mean the Atmega48 cold do I guess, but wanted to know if an Attiny fits the description first
01:15 AM rue_house: well how many channels are on the tiny26 again?
01:26 AM Emil: Brando753: go mega/arm
01:27 AM rue_house: stm32F1 had 12 pwm channels
01:40 AM rue_bed: still does rue
01:42 AM rue_bed: right, tiny26 is the adc chip
01:42 AM rue_bed: one of theautomotive versions of something had a crazy pwm count
01:42 AM rue_bed: whats the mega328p
01:44 AM rue_bed: its got 6
01:44 AM rue_bed: again, the point about software pwm is at hand
01:44 AM rue_bed: if you dont need more than about 1khz or so, software pwm is doable
01:59 AM Emil: Even 10k can be fine
02:00 AM rue_bed: how many bits?
02:00 AM rue_bed: 8 bit? 6 bit?
02:00 AM rue_bed: I dont think you can get 8 bit at 10k
02:00 AM rue_bed: software
02:01 AM Emil: what f_cpu?
02:01 AM Emil: and do you do what else
02:01 AM Brando753: Emil: yea looking at arm but I did want a dip package my group could solder, I can solder QFN24 easy enough but not everyone can
02:01 AM rue_bed: 16Mhz
02:02 AM Brando753: rue_house: well yea I would just use EFM32ZG which has 6 PWM pins
02:02 AM Emil: rue_bed: yeah software 8 bit doable just fine
02:02 AM Brando753: but was curious if Attiny would fit the bill :I
02:03 AM Emil: Brando753: what pwm requirements do you have?
02:03 AM Brando753: well I would prefer the CPU be idle as much as possible
02:03 AM Brando753: i.e. low power state
02:03 AM Brando753: Emil: its just powering RGB lights
02:03 AM Emil: Calculating?
02:03 AM Emil: Or just shouting data at them
02:04 AM Emil: "data"
02:04 AM Brando753: its got different data cycles on how it lights up but nothing to intensive, software PWM would work, but the CPU would be constant on no?
02:05 AM Jartza: depends how you implement sw pwm
02:05 AM Jartza: and what is the required pwm frequency
02:05 AM rue_bed: use that code of mine
02:05 AM rue_bed: its the fastest sofware pwm you can get
02:06 AM rue_bed: lights? heez, 100hz is fine
02:06 AM Brando753: 100hz without any flicker?
02:06 AM Brando753: even when its in motion?
02:06 AM rue_bed: see me here in 18 hours and I';l help
02:17 AM daey: 100hz isnt fine
02:38 AM noHitW_work: morning
03:08 AM polprog: if you dont want any flicker, smooth out the pwm with a cap and connect it to a VCCS
03:09 AM polprog: voltage controlled current source, literally a mosfet/bjt and a resistor
03:32 AM Thrashbarg_ is now known as Thrashbarg
04:33 AM xentrac: 100Hz is fine for some things, but not others
04:34 AM Brando753: but from all this talk I take it no Attiny exists with 6 PWM pins?
04:34 AM Brando753: and I will need at minimum a Atmega48 if I want a hardware PWM for all 6 pins?
04:34 AM Brando753: or an arm like the nice EFM32ZG
04:40 AM Emil: polprog: I think I figured it out
04:40 AM Emil: I didnt set the spi pins as outputs
05:00 AM Tom_L: one of em
05:01 AM Emil: Tom_L: Iirc you also have to set the mosi and sck pins
05:01 AM Tom_L: on a slave anyway
05:01 AM Emil: ss too
05:01 AM Tom_L: master is different
05:02 AM Emil: Well, it doesnt seem to work and I have not set them as outputs
05:05 AM Tom_L: you got the right phase and polarity set?
05:09 AM Emil: yeah
05:10 AM Emil: http://www.ti.com/lit/ds/symlink/tlv5620.pdf
05:10 AM Emil: https://emil.fi/jako/koodi/tlv5620.c
05:14 AM Tom_L: i don't see CPOL in the setup
05:14 AM Tom_L: and i gotta run...
05:15 AM Emil: because sck should idle low
05:16 AM Emil: when cpol is set sck idles high
07:42 AM Tom_L: Emil, i generally put them in a known state even if it's cleared
07:47 AM twnqx: dear gcc... WTF ARE YOU DOING
07:47 AM cehteh: compiling :D
07:47 AM twnqx: avr-gcc -c -mmcu=at90can128 -I. -gstabs -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Werror -Wstrict-prototypes -Wa,-adhlns=main.lst -std=gnu99 -DF_OSC=16000000UL -DF_CPU=16000000UL -fno-builtin-printf -MD -MP -MF .dep/main.o.d main.c -o main.o
07:47 AM twnqx: main.c:1:0: error: -fPIC is not supported [-Werror=PIC]
07:47 AM twnqx: #include <string.h>
07:47 AM twnqx:
07:47 AM twnqx: main.c:1:0: error: -fPIE is not supported [-Werror=PIE]
07:47 AM twnqx: i wish.
07:48 AM twnqx: there is no -fPIC or -fPIE
07:49 AM Tom_L: you forgot to pick up the token in the treasure chest behind the mystery door along the path to enable it
07:49 AM twnqx: i don't even WANT to enable it
07:49 AM cehteh: does some other option or the spec include PIC/PIE?
07:49 AM twnqx: it's bloody ROM, it needs no PIC or PIE
07:50 AM twnqx: so instead of breaking it less, the update broke it more
07:52 AM twnqx: yeah, it's obviously a new default
07:53 AM twnqx: but... WHY on a µC compiler...
07:53 AM Emil: what do those flags mean?
07:53 AM twnqx: -fno-pie -fno-pic works
07:53 AM twnqx: position independent executable / position independent code
07:53 AM Emil: lololo
07:53 AM twnqx: exactly
07:54 AM twnqx: /usr/libexec/gcc/avr/ld: -pie not supported
07:54 AM twnqx: argh
07:55 AM twnqx: ok, -no-pie to LDFLAGS solves that
07:56 AM twnqx: but it doesn't solve the avr-libc fail
07:56 AM twnqx: /usr/libexec/gcc/avr/ld: cannot find -lat90can128
08:36 AM mark4: is there any practical difference between "ldi rn, 0" and "xor rn, rn" or "sub rn, rn" ?
08:36 AM mark4: erm maybe its eor in avr i ferget lol
08:37 AM LeoNerd: There might be minor differences in what SREG flags are affected by each operation
08:37 AM LeoNerd: Typically loads/stores don't affect the flags as much as arithmetic ones do
08:39 AM mark4: aha good point.
08:39 AM mark4: ldi rn, 0 is also probably more descriptive than the sub/xor methods
08:41 AM LeoNerd: I very rarely write at assmebly level though, I haven't given it much thought
08:41 AM LeoNerd: I only have one piece, being the WS2812 driver I wrote
08:42 AM cehteh: on some processors loading a constant is slower and needs more space, biggier instruction
08:43 AM cehteh: dunno avr
08:43 AM cehteh: but its common that setting to zero is optimized to xor or sub by compilers
08:43 AM LeoNerd: I belive LDI is the same single-width one-clock instruction as XOR or SUB are
08:43 AM polprog: yeah, i noticed that
08:43 AM Emil: LDI is single.clock
08:44 AM polprog: for some reason ldi r18, 0x00 was changed to clr 0x00
08:44 AM polprog: clr r18 *
08:44 AM mark4: not so on the avr for cretain immediate values. the ldi opcode encodes the immediate value in the single byte opcode
08:44 AM polprog: by the compiler
08:44 AM Emil: polprog: interestin
08:44 AM polprog: Emil: radare. awesome tool
08:44 AM mark4: 1110-KKKK-dddd-KKKK where d is the destination register and K is the constant
08:44 AM Emil: polprog: I should learn that
08:45 AM polprog: Emil: it's quite sophitsticated and the book is not much use
08:45 AM polprog: but it's worth it
08:45 AM polprog: and it has a web interface i you get pissed off by the CLI
08:46 AM mark4: radare is a disassembler yes?
08:46 AM mark4: not quite as good as IDA Pro but slightly cheaper :)
08:48 AM mark4: the ebuild for radare2 is b0rked, cant install it
09:12 AM Emil: polprog: ooh
09:12 AM Emil: polprog: I can self host it the
09:12 AM Emil: n
09:13 AM polprog: it installed without any problems both on debian then and now on arch
09:14 AM polprog: but i believe that IDA pro has a slightly better interface
09:14 AM polprog: the web interface is not fully capable of what the CLI can do
09:14 AM polprog: it's mainly a hex editor with disassembler
09:15 AM polprog: the most useful is the disasembler and the "visual mode" which draws nice graphs, call- and subroutine- ones
09:16 AM polprog: the builting help is wonders though... it's all keyboard controlled :P
09:19 AM polprog: https://puu.sh/wcxpm/bf5db92125.png
09:19 AM rue_house: whats interesting enough to dissassemble?
09:19 AM polprog: https://puu.sh/wcxqh/805534f2fe.png
09:19 AM polprog: whatever. i use it to check the assembled code
09:20 AM polprog: infortunately you need an .o file, i dont know how to convert a .hex to an .o
09:20 AM polprog: mainly for the flow. The graphs are the bees knees. Literally, ive spotted a couple flow mistakes that way :P
09:20 AM rue_house: funny that looks like my 595 library :)
09:21 AM polprog: funny, but the 595 lib i wrote is later there
09:21 AM polprog: :P you can see the init method on the bottom of the second picture
09:22 AM rue_house: it would be intersting to see what libraries everyone writes
09:22 AM polprog: i can post my sotware implementation for 595,
09:22 AM rue_house: 595, hd44780, servos
09:23 AM polprog: would be nice to update github xD it's been a year since i pushed :D
09:23 AM rue_house: I'm due to use the DMA on an stm32 sometime to simulate a ring counter for me
09:34 AM rue_house: which disassembler is it?
09:36 AM polprog: radare
09:36 AM polprog: generally, it's nice. Better than avr-objdump
09:37 AM rue_house: its technically a hex editor?
09:37 AM polprog: if i knew how to onvert a hexfile to an object file i'd be thankful
09:37 AM polprog: yeah, technically
09:37 AM rue_house: the hex file is missing stuff the object file has
09:37 AM polprog: i guess so, but the runtime code is still there
09:38 AM polprog: it cant just go away :P
09:38 AM rue_house: but if you had another object of the same family, you might be able to fudge it
09:38 AM polprog: what do you mean
09:38 AM rue_house: well, for any avr object file, its probably going to be the same
09:39 AM rue_house: so you just need to splice in your hex data (+- pointers, sizes, checksums, etc)
09:39 AM polprog: what is the hex file exactly
09:39 AM polprog: becuase it's definitely not an image
09:39 AM rue_house: its a memory map of whats written to the microcontroller
09:40 AM polprog: you should be able to decompile it, at least to the assembly listing
09:40 AM rue_house: want a program I wrote for dumping hex files?
09:40 AM rue_house: into binary
09:40 AM polprog: sure, i thougt it's what avrdude can do
09:40 AM rue_house: dunno
09:40 AM polprog: ill happily mess around with it
09:41 AM rue_house: 260 programs to search thru, gimma a min
09:41 AM rue_house: oh and I'm almost out of time to go to work
09:41 AM polprog: impressive collection
09:41 AM polprog: if youre in a hurry, it's ok
09:41 AM polprog: i dont need it right now
09:43 AM rue_house: heh, hardcoded to test.hex
09:43 AM Emil: I should write a disassembler
09:43 AM Emil: Shouldnt be hard at all
09:43 AM rue_house: there might be another version, I'll dump this on you
09:43 AM polprog: id say rewrite the whole unix kernel, go big Emil
09:43 AM polprog: :P
09:44 AM rue_house: http://paste.debian.net/970160/
09:44 AM rue_house: there is no .h file
09:44 AM polprog: thanks very much
09:44 AM Emil: polprog: pls
09:45 AM polprog: rue_house: so what should i do with that include
09:45 AM rue_house: remove it
09:45 AM rue_house: it dosn't exist...
09:45 AM rue_house: aparently
09:45 AM polprog: ill try and poke around until i get it working, thanks again :)
09:46 AM rue_house: there must be another version, this just writes it out for ya
09:47 AM polprog: i understand i have to uncomment main, rite?
09:47 AM rue_house: http://paste.debian.net/970162/
09:47 AM rue_house: oh
09:47 AM rue_house: ? wtf?
09:48 AM rue_house: yea, cause its a library dev folder, thts what going on
09:48 AM polprog: ill manage,
09:52 AM rue_house: oooh, I rewrote ihex2txt from the eep24c package...
09:52 AM rue_house: its a pile of files, I'll post later
09:52 AM polprog: lol
09:52 AM polprog: hmm, doesnt compile. ill fix it later
09:56 AM rue_house: it looks like it didn't have the normal development life
09:56 AM rue_house: there are anomolies with ihex2bin
09:57 AM polprog: wut
09:57 AM polprog: it just exported an ascii hexdump
09:57 AM polprog: at leas that...
09:58 AM polprog: your program doesnt compile, the read() method is undefined
10:00 AM rue_house: http://ruemohr.org/~ircjunk/programming/c/ihex2bin.tgz
10:00 AM rue_house: quick, I tested, that works
10:00 AM rue_house: bye!
10:01 AM polprog: bye!
10:36 AM polprog: are there any certain assembly naming conventions? how would i call an .equ constant referring to and address in sram?
11:16 AM mark4: if root= is no longer required why does genkernel and genkernel next tell you not to forget to add them
11:16 AM mark4: wrong channel
11:17 AM Casper: don't use genkernel?
11:19 AM * twnqx agrees with Casper's sentiment
11:20 AM twnqx: i also am getting frustrated with gentoo's crossdev
11:26 AM Casper: I want to go home... I'm sick...
11:27 AM twnqx: and now
11:27 AM twnqx: i'll never figure out why it installed libat90can128.a this time
11:29 AM twnqx: also, silly avr-gcc doesn't let me put a volatile void * point to rom :(
11:30 AM xentrac: haha
11:31 AM xentrac: why would you want a volatile void*? volatile affects what happens when you dereference it, right? or is that something like void * volatile?
11:42 AM mark4: twnqx, crossdev for avr?
11:42 AM mark4: and genkernel is fine
11:43 AM day_ is now known as daey
11:43 AM xentrac: polprog: a lot of people just use C naming conventions in assembly
11:44 AM xentrac: because usually they aren't writing the whole program in assembly!
11:55 AM twnqx: mark4: probably some issue with updating avr-libc with gcc 5 while avr-libc 2 only works correctly with gcc6 or something
11:55 AM twnqx: i unbricked my install
11:57 AM mark4: supprised there are more gentoo users in here, i thought i was the only heretic
11:59 AM DKordic: polprog: `objcpy' from `avr-binutils' should be able to convert betweeb `.bin', `.o' (ELF) and `.hex' ([[https://en.wikipedia.org/wiki/Intel_HEX][Intel HEX]]). Intel HEX is essentialy a FLASH dump (`.bin') and _practicaly useless_.
11:59 AM polprog: DKordic: thanks
12:00 PM polprog: xentrac: im trying to write a simple up/down clicker in asm but i cant get it to work,
12:00 PM polprog: if it wont work ill write the button handling part in C
12:01 PM polprog: https://paste.debian.net/970234/
12:01 PM polprog: any idea, any mistakes spotted?
12:01 PM polprog: if not im rewriting that in c
12:02 PM polprog: the button handling part, the 595 part is working well
12:17 PM * DKordic looks.
12:22 PM DKordic: You could ``#define PIN(n) (PORT(n) -2)'', ``#define DDR(n) (PORT(n) -1)'', ``#define PORT(n) (3* n)'', ``#define B 2'' :) .
12:23 PM polprog: i dont understand how that would work
12:28 PM DKordic: Never mind :) . Obviously change line 18 to ``.equ hc595DDR, DDRB''.
12:28 PM polprog: yeah...
12:29 PM DKordic: Line 26: There should be directives for reserving SRAM for global variables.
12:29 PM DKordic: And defining SRAM labels.
12:30 PM polprog: didnt know about them
12:30 PM polprog: it's either the sram storing/restoring
12:30 PM polprog: or the whole get-which-button-is-presed bit magi
12:30 PM polprog: c
12:33 PM polprog: it worked before... now i want to make it update a byte on the 7 seg when one of the buttons is pressed (inc/dec)
12:34 PM DKordic: What should be L39?!
12:35 PM polprog: line 39?
12:36 PM DKordic: Yes.
12:36 PM polprog: 39-41 loads an adress into x register and stores 0x0f (should be 00 but thats not a problem) to the adress at 0x0F[a_counter_state]
12:37 PM polprog: originally r27 was loaded with 0x00 and reused in line 41
12:37 PM polprog: fixed that bug now :P r18 is loaded x00 and next line is st x, r18
12:41 PM DKordic: I would change line 34 to ``ldi tmp ,0xFF''. `YL' is `r28' and `XH' is `r27'!
12:41 PM DKordic: And of course remove stupid ccomments.
12:43 PM polprog: lol, what a stupid mistake
12:44 PM polprog: and the comments... i started to write this file when i started learning assembly a month ago
12:44 PM polprog: and why ldi tmp? is tmp a valid register name?
12:46 PM DKordic: `tmp' can be defined somewhere as an alias of `r18'.
12:46 PM polprog: how?
12:46 PM DKordic: `.equ' directive might do it.
12:46 PM polprog: ah, simply equ
12:46 PM polprog: lemme do it
12:48 PM polprog: damn
12:56 PM polprog: this is odd... the leds should show either 0x01 or 0x02, and here they dont
12:56 PM polprog: i just put .equ tmp, 0x18
12:56 PM polprog: and it stopped working
12:57 PM polprog: because .equ tmp, r18
12:57 PM polprog: produced an error: "constant value required"
12:59 PM polprog: what a tupid mistake
01:00 PM polprog: 0x18 is r24... thanks disassembler
01:51 PM polprog: ive got two registers
01:51 PM polprog: and i need to branch only when a bit in the first register's bit is 1 and the same bit in the 2nd reg is 0
01:58 PM mark4: you coding in asm or in c?
01:58 PM polprog: asm
01:58 PM polprog: its bread and butter in c :P
01:59 PM mark4: look at bld and bst. transfer the bit from the register to the T register
01:59 PM mark4: then use a branch on t bit set
01:59 PM polprog: nice
01:59 PM polprog: let me try that
01:59 PM mark4: look up the opcodes in the opcode ref :)
01:59 PM polprog: i have the opcode table printed out and in my hand
01:59 PM mark4: there is a branch on bit N set/clear in the status register
02:00 PM mark4: you dont just have brcc brcs etc. brbs and brbc i think they are
02:00 PM mark4: brbs 7 is branch if bit 7 of psw is set
02:00 PM mark4: i forget which bit is the T bit
02:00 PM mark4: 6 or 5
02:00 PM polprog: i've got it
02:11 PM DKordic: How about ``#define Carry 0''?
02:16 PM cehteh: try #define while if preferably in someone else's source :)
02:41 PM Emil: https://www.youtube.com/watch?v=cYgjcDbSyRE
02:41 PM Emil: Hehehhe
02:54 PM bss36504: Emil: That is quite a nice enclosure
02:54 PM bss36504: Though was this really better than just buying a decent soldering station?
03:10 PM Emil: of corse it was
03:10 PM Emil: Bonk must flow
03:19 PM cehteh: dfox
03:19 PM cehteh: oops
03:20 PM cehteh: no not a password :D ... just tried to start firefox in dmenu
03:20 PM Emil: yeaaaaaaaaaaaah
03:20 PM Emil: We'll go with that
03:38 PM polprog: whuch de used dmenu
03:38 PM polprog: i3?
03:44 PM Emil: Hmm
03:45 PM Emil: Don't avrs have defines for things like
03:45 PM Emil: MOSIPIN
03:45 PM Emil: and SPIPORT
03:45 PM Emil: or something like that
03:46 PM Tom_L: in the config file for the chip
03:46 PM Tom_L: in the asm directories of studio
03:46 PM Emil: Hmm
03:46 PM Emil: iomg328pb.h or iom328p.h didn't have such
03:47 PM Tom_L: maybe in a newer studio
03:47 PM Tom_L: i don't have such
03:48 PM Emil: Hmm
03:48 PM Emil: Some iom files do have them
03:48 PM Emil: and iot files
03:49 PM bss36504: maybe check the xmega or D20 files?
03:49 PM cehteh: polprog: yes i3
03:49 PM bss36504: Those are much more recent than the megas, obviously
03:50 PM Emil: I could have swore that m328p also had those definitions
03:50 PM Emil: guess I was wrong
03:50 PM bss36504: I'd think not, since the pb is supposed to be like the 328 "plus", and I'd assume they'd want people's old code to work on that
03:51 PM bss36504: The Xmegas are completely different, so it was appropriate to update the API for them and for the new SAM chips
03:51 PM bss36504: That's my perception anyway
04:21 PM Emil: no
04:21 PM Emil: some megas and tinys have those definitions
04:22 PM Emil: and some people have used them for tutorials, too
04:24 PM xentrac: what's the "plus"?
04:35 PM Emil: Holy shit the datashit for the atmega328pb by Microshit is känser
04:35 PM Emil: So many errors
04:35 PM Emil: So many copy paste shit problems
04:40 PM DKordic: For example?
04:49 PM learath: uh. why does microsoft.. oh. never mind.
04:49 PM atk is now known as Arch-TK
04:49 PM Arch-TK is now known as atk
04:50 PM ohsix: so that still isn't settled even after one got acquired by the other eh
04:52 PM kre10s: Game idea. title: "Bay Watched" You are a hungry shark. Devour unsuspecting beachgoers and devour lifeguards. gain points and use them to update your shark arsenal!
04:52 PM ohsix: Emil: this one? http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf
05:03 PM Emil: DKordic: interrupt table for example
05:04 PM Emil: ohsix: no
05:04 PM Emil: http://ww1.microchip.com/downloads/en/DeviceDoc/40001906A.pdf
05:04 PM Emil: This one
05:06 PM Emil: LeoNerd: do you have the atmel time datasheet for the m328pb?
05:06 PM LeoNerd: "time"?
05:07 PM Emil: hah
05:07 PM Emil: found it
05:07 PM Emil: http://www.atmel.com/images/atmel-42397-8-bit-avr-microcontroller-atmega328pb_datasheet.pdf
05:07 PM Emil: Nah
05:07 PM Emil: it also has the shit errors
05:08 PM Emil: Well, I prefer the Atmel style anyways
05:09 PM Emil: Hot damn, I'm always forgetting to call sei()
05:12 PM xentrac: heh
05:12 PM xentrac: C++ can help with that btw
05:12 PM xentrac: it can't make sure you call sei() at the right time but it can ensure you don't forget to call it before returning
05:18 PM LeoNerd: Straight-up C can do it with gcc and the avr-libc stuff
05:18 PM LeoNerd: There's wrappers for basically the sorts of things added in C++ to do that reliably, only in C too
05:20 PM cehteh: note that you want cli/sei with correct memory barriers, better use the macros provided by avr-libc
05:28 PM xentrac: really? what does that look like, LeoNerd?
05:28 PM ohsix: Emil: o noes they swapped grey/red for blue/light blue! :p
05:29 PM xentrac: cehteh: so the optimizer doesn't reorder your memory loads and stores across cli()/sei() calls?
05:30 PM xentrac: I thought it wasn't supposed to do that anyway if you use them in the normal way because a statement separator was a sequence point?
05:31 PM LeoNerd: xentrac: the ATOMIC_BLOCK { ... } stuff
05:31 PM cehteh: yes
05:35 PM xentrac: LeoNerd: aha! nice! ... also how the heck does that work? :)
05:35 PM * xentrac apt-get source avr-libc
05:40 PM xentrac: aha, I see
05:41 PM xentrac: the part it uses from C99 is just the ability to declare variables in a for-loop header; GCC's __attribute__((__cleanup__(vomit))) is the magic that restores SREG on exit from the block
05:41 PM LeoNerd: Yup
05:42 PM xentrac: and there's possibly a little bit of inefficiency related to the for-loop variable and conditional jumps, if GCC's optimizer isn't clever enough, and a potential macro hygiene problem with the variable __ToDo (but that's reserved for avr-libc anyway)
05:43 PM xentrac: this will definitely solve Emil's problem
05:45 PM xentrac: probably specing will now vaguely explain that Ada also has the ability to restore the interrupt-enable flag on exit from a block, but not actually explain what Ada language facilities could hypothetically be used in such a way or how, since they've never actually done it
05:46 PM * DKordic . o O ( __cleanup__(vomit) )
05:46 PM specing: I like that you like me liking Ada while not liking anyone who might start to liking it
05:48 PM specing: and I don't know how to do that, not deep enough into ada to do so
05:56 PM xentrac: yeah, Scheme would definitely work. but writing interrupt handlers in Scheme sounds horrible! :)
05:57 PM xentrac: have you tried PICBIT? I don't think it supports dynamic-wind but there's no reason it shouldn't
05:57 PM xentrac: most of the time if you want to have interrupts disabled in a dynamic context you would probably also want to disable escaping from that dynamic context by invoking a saved continuation or resuming that dynamic context by saving a continuation from it and using it later
05:59 PM Emil: ohsix: mate
05:59 PM Emil: ohsix: pls
06:01 PM Emil: Hmmm
06:01 PM julius: hey
06:02 PM Emil: Any idea why my opamps and dacs behave like this
06:02 PM Emil: https://emil.fi/jako/kuvat/2017-06-07_01-31-45_q3y4hwxn.png
06:02 PM julius: my landlord is fucking up my sleep...now im awake :(
06:02 PM Emil: The 16 bit value is the ADC reading and the 8 bit value is the dac setting
06:02 PM julius: yeah, i have no clue what that picture shows
06:03 PM julius: ah
06:03 PM Emil: https://emil.fi/jako/kuvat/2017-06-07_01-33-20_GxRHqhxI.png
06:03 PM Emil: This one's probably better
06:04 PM julius: maybe try #electronics
06:04 PM Emil: Especially since this is not how it's supposed to be behaving :/
06:04 PM Emil: http://www.ti.com/lit/ds/symlink/tlv5620.pdf
06:04 PM julius: i know the feeling
06:05 PM Emil: I'll try changing some resistors
06:05 PM xentrac: Emil: it would probably be useful to see what your voltmeter says too
06:05 PM xentrac: are you connecting the ADC input to the DAC output?
06:05 PM xentrac: (I assume that's what you're doing but I want to be sure; where does the opamp come in?)
06:05 PM cehteh: whats the schematic?
06:06 PM Emil: xentrac: yeah. There's a a buffer with 2x gain on the dac output and there's a buffer with divide by 2 on the adc input
06:07 PM Lambda_Aurigae: cehteh, a schematic is a piece of paper with little squiggly lines all over it used to train electrons how to behave.
06:07 PM xentrac: what kind of dac are you using? I assume the ADC is just the ADC on an AVR, but AVRs don't have DACs
06:07 PM xentrac: heh
06:08 PM cehteh: Lambda_Aurigae: https://imgur.com/i8MEXct
06:09 PM xentrac: heh
06:10 PM xentrac: the solder-as-wire thing should actually work under many circumstances, no?
06:10 PM cehteh: solder has quite some resistance, but should work when you manage to connect it well
06:11 PM Lambda_Aurigae: cehteh, old pic..
06:11 PM cehteh: was it 6 times or what more than copper? .. solder resistance
06:11 PM xentrac: yeah, but for a lot of these small-signal circuits where you don't even know if the β of your transistor is 50 or 250, an extra 50 ohms isn't going to make any difference in most places
06:12 PM cehteh: so tinning traces is almost futile when you want to thicken them up for more ampage
06:12 PM xentrac: EEVBlog did a thing about that a couple of years back and found that it worked pretty well
06:12 PM cehteh: better solder some coper wire on the trace
06:12 PM xentrac: the key is that you thicken them up by a lot more than 6×
06:13 PM cehteh: yes wont matter and tinning traces to make the better solderable and protect the copper from corrosion actually helps
06:13 PM Emil: xentrac: the linked
06:13 PM cehteh: its not that uncommon
06:13 PM cehteh: but for current you add copper
06:14 PM xentrac: in https://www.youtube.com/watch?v=L9q5vwCESEQ what's-his-name tests the just-adding-solder approach with an ohmmeter
06:14 PM Emil: xentrac: voltmeter agress with results
06:15 PM xentrac: Emil: which results, the DAC numbers or the ADC numbers?
06:15 PM xentrac: Dave
06:15 PM Emil: SPI -> DAC -> 2x amplifier buffer -> buffer and divison by 2 -> ADC
06:15 PM xentrac: Dave is his name
06:15 PM Emil: Hmm
06:16 PM Emil: I'll try changing the resistor values tomorrow
06:16 PM xentrac: aha, okay. so the voltmeter says the ADC results are right and the voltages coming through the opamps are all cattywompus?
06:16 PM Emil: See if it's acting up for some reason
06:17 PM xentrac: cehteh: dude is using "standard 35μm one-ounce copper" PCBs. it's pretty easy to get more than 6× 35μm thickness of solder
06:18 PM xentrac: I think it wouldn't be hard to get 1500μm of solder on top of your copper?
06:19 PM Emil: hmm
06:20 PM Emil: it seems the DAC is not outputting what it should
06:20 PM Emil: xentrac: yes, yes it would
06:20 PM Emil: 1.5mm is _ALOT_
06:21 PM Emil: That's around as thick as your standard PCB
06:21 PM xentrac: yup
06:21 PM xentrac: he measures a long copper trace at 51mΩ, then after he covers it with one layer of solder it measures 43mΩ, and after another layer of solder he got 26mΩ
06:23 PM xentrac: so he was able to double the conductance of the trace by adding solder all over it
06:25 PM Emil: yes?
06:26 PM cehteh: sure
06:26 PM xentrac: if you're using lead-free solder, you're getting the extra conductance from silver (albeit all screwed up with tin) and so it's coming at a fairly high materials cost
06:27 PM cehteh: but compare that to double or triple the copper
06:27 PM xentrac: copper actually costs less than a third what silver does I think
06:28 PM Emil: Any idea why that DAC is outputting a minimum of 0.91 volts
06:28 PM Emil: instead of the 0 it promisers
06:28 PM cehteh: solder works somewhat of course, but when you want to yank a lot current somewhere you better make sure there is enough copper to start with
06:28 PM xentrac: Dave in the video suggests that if your board is all high-current power-supply stuff then you should just go with a 2-ounce 70μm copper layer
06:29 PM cehteh: Emil: something wrong connnected? does the output float? is that ok?
06:29 PM xentrac: but I guess that means you can't put traces as close together for low-current parts of the board
06:29 PM Emil: cehteh: I think the problem is the output resistors
06:29 PM Emil: yeah
06:30 PM Emil: well
06:30 PM Emil: maybe
06:30 PM Emil: cehteh: and everything is rightly connected
06:30 PM Emil: Output does not float
06:31 PM Emil: Hmm, I wonder if I should call TI
06:31 PM xentrac: are you maybe sinking a massive amount of current into the DAC's output from its output buffer feedback network?
06:31 PM Emil: No
06:32 PM xentrac: I mean normally they wouldn't be connected but there are topologies where they are
06:32 PM Emil: The DACs have a pulldown to provide minimum load
06:32 PM Emil: 10k
06:32 PM Emil: and dac output is also taken to op amp +
06:32 PM Emil: and opamp out and - are in a 2x setting
06:32 PM xentrac: yeah, that's what I would have expected
07:56 PM kre10s: xentrac: because that enables pull ups?
08:14 PM JanC is now known as Guest15321
08:14 PM JanC_ is now known as JanC
08:18 PM xentrac: kre10s: exactly. although if you have a strong drive from somewhere else you won't be able to tell with a voltmeter