#avr Logs

Sep 09 2017

#avr Calendar

12:25 AM day is now known as daey
02:53 AM wirts-leg: when sequentially reading multiple analog values on different ADC pins, how does one handle the pins not being used between reads?
02:54 AM wirts-leg: must special precaution be taken to disable them from affecting the device they are attached to?
02:58 AM Thrashbarg: why would the inputs affect the output of the device they're connected to?
03:18 AM wirts-leg: Thrashbarg, the atmega chip may ground the input pin for example. this is the sort of thing i want to avoid happening to the analog device.
03:22 AM wirts-leg: sorry that took so long for me to respond. baby woke up with a screaming cry.
03:25 AM wirts-leg: while not being read i want the analog device to be effective disconnected from any sink/source
03:26 AM wirts-leg: is there a way to put the atmega pins in an effectively "off" state where no current goes in or out?
04:09 AM antto: wirts-leg you could use something like an analog switch
04:16 AM Thrashbarg: wirts-leg: I thought if you set the pin as an ADC input (assuming it doesn't get changed) it'd remain high impedance
04:19 AM wirts-leg: yes Thrashbarg but i'm talking about a situation where i have some input on ADC0 and another on ADC1. when the program moves to read ADC1, then ADC0 will become a digital pin again right?
04:19 AM Thrashbarg: if you've set it as an ADC input it'll remain one
04:20 AM * Thrashbarg checks the datasheet to be sure
04:24 AM wirts-leg: in my case ADC0 it is set as an ADC input by: ADMUX = 0 and then i take a sample.
04:25 AM wirts-leg: After this I do ADMUX = 1 and take another sample to get the reading for ADC1 pin
04:25 AM polprog: wirts-leg: ADMUX is the muxer, you need to look at the DDR settings
04:25 AM Thrashbarg: wirts-leg: What ATmega are you using? I'm looking at the '168 datasheet. Have a look at the description for the DIDR0 register. Also if you set the data direction register of the port to inputs and the data port to zero it'll remain high impedance
04:25 AM polprog: if it's set a input iw will remain HiZ, (unless tou turn on the pullup via PORT)
04:27 AM wirts-leg: oh so pretty much the first thing I want to do in my initial setup is DDRC = 0 and PORTC = 0
04:28 AM polprog: most likely yes
04:28 AM wirts-leg: atmega168 is the one
04:29 AM wirts-leg: good tip about the DIDR0. thank you.
04:30 AM polprog: heh, havent heard of a DIDR register before
04:30 AM polprog: interesting
04:31 AM polprog: they dont have those on the avrs i use
04:47 AM wirts-leg: the really sad thing is i used to know all of this about 5 years ago. but bumblebrain got sidetracked for too long and forgot how I made all the really neat things I used to toy with.
04:49 AM wirts-leg: for about two years prior, my time was basically spent reading datasheets and tinkering with wires and code.
04:52 AM wirts-leg: but it's mostly gone from my head after such a long time not using it.
04:52 AM polprog: believe me, it will come back as soon as you start again.
04:54 AM antto: tell that to my forgotten password
04:57 AM wirts-leg: lol antto
04:57 AM polprog: antto: try hunter2
04:57 AM polprog: or swordfish
04:57 AM antto: wut that?
04:57 AM polprog: those work fo me
02:44 PM enh: I need help to listen to UART via USB on a mac, but using interrupts. Anybody here has done that?
03:00 PM enh: Got this http://www.webalice.it/fede.tft/serial_port/serial_port.html on #C++
03:06 PM NoHitWonder: use Qt
03:17 PM Casper: interrupt on avr side or mac side?
03:30 PM enh: mac side
03:30 PM enh: SIGIO signal
03:31 PM enh: apparently it is a bug on MAC OS since beginning of times
03:34 PM polprog: dual boot some less retarded unix
03:34 PM polprog: ;)
03:34 PM enh: I believe I'l have to put my Pi to work
03:35 PM polprog: that's a good idea :P
03:35 PM polprog: actually programming uart where the pc is "slave" to the micro is non trivial
03:35 PM enh: I programmed the MCU to send telemetry periodically.
03:36 PM enh: Instead of me calling it and messing the control cycle
03:36 PM polprog: i will have to crack this in c# on windows soon
03:37 PM enh: I have a serial library that works fine on mac os, c++. But it is synchronous. When modifying it to known working async examples, it does not work.
03:38 PM enh: MacOS apparently routes SGIO to the toilet
03:38 PM enh: SIGIO
03:38 PM polprog: if i were you i'd keep the tty open and check for data perodically
03:38 PM enh: That is a possibilty
03:38 PM enh: I wanted a callback, but not all I want I can get.
03:42 PM enh: I banned all floats from the sensor, servo control and communication modules. Thanks to cehteh sugegstions.
03:43 PM enh: But I do not think I'll be able to ban them from the flight control one.
03:43 PM polprog: flight control needs to be pretty fast and realtime
03:44 PM enh: Many PIDs. If I can make the PIDs work just with integers it will be fast
03:44 PM cehteh: pids with integers only are really easy
03:44 PM polprog: what is that gonna be eventually?
03:44 PM cehteh: there isnt much complex math
03:44 PM cehteh: actualy there is no complex math
03:45 PM cehteh: only wary of integer overflows
03:45 PM enh: Amazingly, banning floats did not increase much the speed. Dunno why.
03:45 PM cehteh: thats wher floats are more forgiving
03:45 PM cehteh: because of C++? :)
03:45 PM cehteh: and whats the size of the program before/after?
03:46 PM cehteh: ah you still have floats, no size saved
03:46 PM cehteh: and the math should be considerably faster else you do something wrong
03:46 PM enh: no more floats on the code. 1k less.
03:46 PM enh: more or less
03:47 PM cehteh: note about the integer overflow thing, when that happens and is not handled by you bad things happen
03:47 PM enh: I'll kepp that in mind
03:48 PM cehteh: 16bit * 16 bit == 32 bit result .. at worst
03:48 PM cehteh: but often that can be mitigated because you dont use the full range on both operands
03:52 PM enh: tricky stuff to solve soon
03:52 PM polprog: good luck
03:52 PM polprog: have fun
03:53 PM enh: Now I'm trying to read the telemetry, which is being sent in binary packs. Reading that is not simple too.
04:02 PM Moarc: Hello.
04:04 PM Moarc: I'm going around in circles trying to figure out what I'm doing wrong: I tried porting a program from tiny85 to tiny2313, found out the corresponding register settings etc., and yet it doesn't work.
04:04 PM Moarc: the original program was https://pastebin.com/qqSPqmKP (with its heart and brain ripped out from https://github.com/balthamos/shuttavr/blob/master/main.c)
04:05 PM Moarc: and it worked properly, sending the right sequence of 38kHz flashes every n seconds
04:05 PM Moarc: after further changes it became https://pastebin.com/zMEYyAVk
04:24 PM polprog: most likely the timer part needs to be redone
04:24 PM polprog: the timer may have similar registers but be of a different type
04:25 PM polprog: since it's a different peripheral set those two chips have
04:27 PM Moarc: I've accounted for all the differences I could find - but obviously I must have missed something.
05:03 PM Moarc: huh
05:06 PM Moarc: when I changed all the OCR1B = n statements to = 1, I seemed like the code is mostly working - obviously with bad timings, but it waits 2 seconds on OCR1A, makes interrupts come from OCR1B, goes through the on-off stages, and goes back to waiting two seconds
05:40 PM Moarc: damn
05:41 PM Moarc: for some reason TIMSK &= ~_BV(OCIE1A); wasn't disabling the OCR1A interrupt
05:41 PM Moarc: and execution was jumping back to the same place all the time
05:42 PM Moarc: all figured out now, fortunately
06:29 PM HelloShitty: Hello guys...
06:29 PM HelloShitty: The AVR chips have any limit of flash erase cycles?
06:29 PM Tom_itx: yes
06:30 PM Tom_itx: but they'll probably outlive you
06:30 PM HelloShitty: 10000 flash for AtMega328p
06:30 PM HelloShitty: ok, I seen it on the datasheet
06:30 PM HelloShitty: heheh
06:30 PM HelloShitty: Maybe I find the immortality remedy
06:30 PM Tom_itx: better hurry up
06:31 PM HelloShitty: I'm still young
06:31 PM HelloShitty: well, not that much
06:32 PM HelloShitty: I'm from the eighties... So I should hurry up
06:32 PM HelloShitty: xD
06:37 PM Lambda_Aurigae: in theory, 10K erase/reflash cycles...in practice, double that or so.
06:37 PM Lambda_Aurigae: eighties...kids.
06:37 PM Lambda_Aurigae: I was in the military in the eighties!
06:38 PM Tom_itx: is the write cycles higher on ssd memory?
06:39 PM Lambda_Aurigae: probably not much but they do wear leveling to make it seem more.
06:39 PM Lambda_Aurigae: a 128GB ssd will probably have half again that much memory in actuality.
06:39 PM Lambda_Aurigae: which will allow for wear leveling.
06:41 PM Tom_itx: i wish i could figure out what about this MB is different from the one i swapped it for to cause dos shell programs not to work
06:41 PM Tom_itx: both are gigabyte boards
06:42 PM Tom_itx: seems like none of my 16bit will run from a cmd window
06:42 PM Tom_itx: didn't notice anything in the bios
06:43 PM Lambda_Aurigae: uefi b
06:43 PM Lambda_Aurigae: oard
06:43 PM Lambda_Aurigae: ?
06:43 PM Tom_itx: yeah but i think i turned that off
06:43 PM Tom_itx: B250M-DS3H
06:44 PM Tom_itx: compared to a H110M-S2H-GSM
06:44 PM Tom_itx: former being the new board
06:44 PM Lambda_Aurigae: I haven't bought a new motherboard in 4 or 5 years.
06:45 PM Tom_itx: same
06:45 PM Tom_itx: until now
06:45 PM Lambda_Aurigae: https://drive.google.com/drive/folders/0BxaP1wMEe_6ad3AyWU80NUpNZGc?usp=sharing
06:45 PM Lambda_Aurigae: that's today's project.
06:47 PM Tom_itx: water powered?
06:47 PM Lambda_Aurigae: water and compressed air.
06:47 PM Tom_itx: yep those are fun
06:47 PM Lambda_Aurigae: little ryobi handheld 18V air compressor.
06:47 PM Lambda_Aurigae: take them up to 90psi and pull the rope to launch.
06:48 PM Lambda_Aurigae: with the right water level I can launch a 20oz bottle rocket about 80 meters
06:48 PM Lambda_Aurigae: and a 2 liter I can get close to 150 meters.
06:49 PM Tom_itx: should i switch 'other pci devices' to legacy?
06:49 PM Tom_itx: i don't have anything plugged in pci right now
06:49 PM Lambda_Aurigae: probably.
06:50 PM Tom_itx: storage boot option is legacy as well
06:52 PM Tom_itx: nope, still hangs
06:53 PM Tom_itx: when i execute it, sitting idle the cpu goes up to 15%
06:54 PM Tom_itx: on 4 threads
06:54 PM Lambda_Aurigae: odd.
06:54 PM Lambda_Aurigae: what OS
06:54 PM Lambda_Aurigae: ?
06:54 PM Tom_itx: windows 7
06:55 PM Tom_itx: soon as i close the cmd window it drops to near nothing
06:55 PM Lambda_Aurigae: fully patched?
06:55 PM Tom_itx: updates?
06:55 PM Tom_itx: i don't think so
06:55 PM Lambda_Aurigae: yeah.
06:55 PM Tom_itx: i've kinda been avoiding that
06:56 PM Tom_itx: it was fine on the other MB
06:56 PM Tom_itx: and i tried the same CPU
06:56 PM Tom_itx: just to check
06:56 PM Lambda_Aurigae: sounds like a patch to me.
06:57 PM Tom_itx: it may be, just checked and this is running SP1
06:58 PM Tom_itx: i wonder if i can get them in a single bundle
06:58 PM Lambda_Aurigae: dunno.
06:58 PM Lambda_Aurigae: I don't run windows myself
06:58 PM Lambda_Aurigae: for work I have to but IT handles the updates.
06:58 PM Tom_itx: i know
06:59 PM Tom_itx: i'll work on it this evening
07:06 PM Tom_itx: huh, they only list 1 service pack for win7
07:11 PM Tom_itx: last update installed: Never :)
07:11 PM Tom_itx: i doubt this will fix it but meh
07:28 PM Lambda_Aurigae: worst case scenario,,,,
07:28 PM Lambda_Aurigae: it catches fire and burns the building down.
07:28 PM Lambda_Aurigae: or, maybe that's best case..
07:28 PM Lambda_Aurigae: something like that.
07:34 PM Tom_itx: after the updates ran the cmd again and this time the cpu useage jumped to 25%
07:35 PM Lambda_Aurigae: kewl.
07:35 PM Lambda_Aurigae: so it changed at least!
07:35 PM Lambda_Aurigae: hehe
07:35 PM Tom_itx: heh
07:35 PM Tom_itx: still didn't run the app
07:35 PM Lambda_Aurigae: some dos apps won't run on windows 7
07:35 PM Tom_itx: but it did with the old MB
07:35 PM Lambda_Aurigae: I have one that actually locks the whole thing completely.
07:35 PM Tom_itx: i didn't change anything else
07:35 PM Lambda_Aurigae: in fact, it locks everything not dos 3.3.
07:36 PM Lambda_Aurigae: right up to and including windows 10...and os2/warp
07:36 PM Lambda_Aurigae: is this a fresh windows install or just motherboard change?
07:36 PM Tom_L: https://support.microsoft.com/en-us/help/4012982/the-processor-is-not-supported-together-with-the-windows-version-that
07:37 PM Tom_itx: get that message now
07:37 PM Lambda_Aurigae: oh.
07:37 PM Lambda_Aurigae: that's part of mickysoft's forced upgrade system.
07:37 PM Tom_itx: but it still didn't work with a gen6 cpu either
07:39 PM Tom_itx: i've got a laptop that came with 10 and i really don't care for it
07:39 PM Lambda_Aurigae: upgrade windows...maybe os2/warp
07:40 PM Tom_itx: i'll just use these apps on the old mb
07:40 PM Tom_itx: i wanted a MB that used the M.2 slot
07:41 PM Tom_itx: i'm actually ok with the no update thing. i wish they'd just leave me alone about it...
07:53 PM Tom_itx is now known as Tom_L
10:45 PM enh: The modulus operator slows down the avr by a great factor
10:46 PM tpw_rules: yup. it's done in software
10:47 PM enh: like 100 times slower
10:57 PM tpw_rules: sounds about right
10:57 PM tpw_rules: it probably takes 100 instructions to perform a modulus