#avr Logs

Dec 07 2019

#avr Calendar

12:08 AM day__ is now known as day
12:48 AM rue_mohr: I wonder if I can use an avr to load a SDRAM based fsm and set it loose
12:48 AM rue_mohr: I wonder how much overhead the new SDRAM chips need
03:39 AM polprog: [07:40] rue_mohr: iirc you need to send them commands to tell them to do refresh and stuffs
03:39 AM polprog: isn't that dram?
03:43 AM rue_mohr: yup
03:43 AM rue_mohr: iirc the S DRAM can do the guts of the refresh itself, but needs to be told to do it
03:45 AM rue_mohr: https://hackaday.com/2016/03/15/sdram-logic-analyzer-uses-an-avr-and-a-dirty-trick/
03:45 AM rue_mohr: I found that link since I mentioned
03:45 AM rue_mohr: https://hackaday.io/project/4159-sdramthing45-logic-analyzer
03:45 AM rue_mohr: he's using a FSM loop
03:46 AM rue_mohr: the SDRAM is latched, so you dont need much external hardware
03:46 AM rue_mohr: I want to play/think
03:46 AM rue_mohr: but I got this scope to get selected and I dont know what to do
03:46 AM rue_mohr: I'm pretty sure I'm going for a TDS754 now
03:47 AM rue_mohr: their old, but the ones that are still alive will probably go for quite a bit longer, and I can repair them
03:47 AM rue_mohr: the new tek scopes have things like http services that wont be usable in another 4 years
03:47 AM rue_mohr: (as browsers go to insisting on 1024 bit encrypted pages)
03:48 AM rue_mohr: its something you see on old DVRs, the webpages off them are unusable now
04:00 AM rue_mohr: ...
04:00 AM rue_mohr: can I have another desktop please? this ones full..."
04:50 AM rue_bed2: / --- divide by 33.333, 16 bits ----
04:50 AM rue_bed2: o = 0;
04:50 AM rue_bed2: i >>= 5; // shift dividend right.
04:50 AM rue_bed2: o += i; // Add dividend to accumulator (dividend /32.000000)
04:50 AM rue_bed2: i >>= 5; // shift dividend right.
04:50 AM rue_bed2: o -= i; // Subtract dividend from accumulator (dividend /1024.000000)
04:50 AM rue_bed2: i >>= 2; // shift dividend right.
04:50 AM rue_bed2: o -= i; // Subtract dividend from accumulator (dividend /4096.000000)
04:50 AM rue_bed2: i >>= 3; // shift dividend right.
04:50 AM rue_bed2: o -= i; // Subtract dividend from accumulator (dividend /32768.000000)
04:50 AM rue_mohr: ok, newer code is same answer
04:52 AM cehteh: mhm
04:54 AM rue_mohr: my old code couldn't abort after hitting 0 error for some cases
04:55 AM cehteh: i wonder is some x * a / b in 32 bit would be more efficient when you can arrage that /b becomes a single shift
04:55 AM cehteh: a shift, not single
04:55 AM rue_mohr: zippo:/files/programming/c/constdiv# ./a.out
04:55 AM rue_mohr: fractional number to multiply by? 0.03
04:55 AM rue_mohr: precision? for target 0.030000 32
04:55 AM rue_mohr: o = 0;
04:55 AM rue_mohr: i >>= 5; // shift dividend right.
04:55 AM rue_mohr: o += i; // Add dividend to accumulator (dividend /32.000000)
04:55 AM rue_mohr: i >>= 5; // shift dividend right.
04:55 AM rue_mohr: .
04:55 AM rue_mohr: .
04:55 AM rue_mohr: .
04:55 AM rue_mohr: no
04:56 AM rue_mohr: Final error: 0.000000 would require 1/3834792212.244898 th of dividend to be added to accumulator
04:56 AM rue_mohr: :)
04:56 AM cehteh: ok
04:56 AM rue_mohr: but at 32 bits the error is REAAALLLLY small
04:58 AM rue_mohr: I was trying to find optimizations for my code that prints numbers in decimal
04:58 AM rue_mohr: cleaning up my lcd library
04:58 AM rue_mohr: every time I use it I add soemthing
04:58 AM rue_mohr: and the copies have split up
04:59 AM rue_mohr: so each one can do something the rest cant
05:01 AM cehteh: i plan to add support for fixed point to my io library, one just tells where a decimal point should appear when printing digits
05:09 AM rue_mohr: oooh, I put what I'm looking for in the serial library, not the lcd...
05:10 AM cehteh: yes serial here as well, eventually it may become a generic io
05:11 AM rue_mohr: mmm I should break this up so my high level routes can push the characrters to lcd or serial using the same base
05:11 AM cehteh: yes
05:12 AM cehteh: maybe even drawing instructions for lcd
05:12 AM rue_mohr: ?
05:13 AM * cehteh uses some tagged/compressed queue for io, that saves a lot ram and can eventually contain device specific codes like brightness or graphics
05:13 AM cehteh: the queue for pusing data finally can be very small few bytes only or little more
05:14 AM cehteh: pushing data to hardware i mean
05:14 AM rue_mohr: tiny13
05:14 AM cehteh: thats pretty limited :(
05:14 AM rue_mohr: switch(places){
05:14 AM rue_mohr: case 10:
05:14 AM rue_mohr: y=x/1000000000;lcd_putch(y+0x30);x-=(y*1000000000);
05:14 AM rue_mohr: case 9:
05:14 AM rue_mohr: y=x/100000000;lcd_putch(y+0x30);x-=(y*100000000);
05:14 AM rue_mohr: .
05:14 AM rue_mohr: .
05:14 AM rue_mohr: .
05:15 AM rue_mohr: yea, I'm not sure this is a good idea
05:15 AM cehteh: the txqueue implementation needs a bit flash space, not overly much when you dont use every feature but full blown its about 2k alone
05:15 AM cehteh: but it saves shitloads of ram which is even more important on tinys
05:17 AM cehteh: the tagged queue hold binary data and pointers, always in the smallest possible representation
05:20 AM rue_mohr: I think
05:20 AM rue_mohr: each fn in the library should be declared static too
05:20 AM rue_mohr: iirc that gets it removed if its never called
05:25 AM rue_mohr: I have an lcd on a PCF8574
05:25 AM rue_mohr: I once bent a lcd library to work on a 74CH595
05:25 AM cehteh: only declare static what you dont want to export, the liner can remove unused functions anyway
05:25 AM rue_mohr: so, I'm trying to clean it up so I can bend it again
05:25 AM cehteh: and turning on lto does even more magic sauce
05:26 AM rue_mohr: Idont trust all the magic
05:26 AM cehteh: lol
05:26 AM cehteh: try it, it can do much more than you can do by hand
05:26 AM cehteh: reduces my program size by a factor of 5 or so
05:27 AM cehteh: https://git.pipapo.org/?p=muos;a=blob;f=hw/atmel/avr.mk;h=a49b76936b3ece757690bbc1283228bd4710ffcf;hb=refs/heads/devel
05:27 AM cehteh: you can play a bit with the cflags, some may or may not help
05:28 AM cehteh: 48 LDFLAGS += -Wl,--relax,--gc-sections
05:29 AM rue_mohr: I'll ask again next time I have a working program I want to try it on
05:29 AM cehteh: --gc-sections is for the linker to throw away any unused sectiion
05:31 AM rue_mohr: ok 3:30am,
05:32 AM rue_mohr: my ability to think is starting to faulter
05:32 AM rue_mohr: I think I have what I need to start with using this i2c lcd
05:33 AM rue_mohr: the voices are getting louder
05:34 AM rue_mohr: I think the nearby pot grower lost another ballast, man those stink
05:35 AM rue_mohr: and my cat is missing
05:36 AM rue_mohr: hope he's ok
07:02 PM djph: rue_mohr: he was. best chicken meow-mein i've had in a while.
08:49 PM rue_mohr: :/
08:49 PM rue_mohr: he came in later
11:04 PM rue_shop1: Program: 4688 bytes
11:04 PM rue_shop1: yowie, thats not gonna fit on a tiny13