#avr Logs

Mar 21 2017

#avr Calendar

12:38 AM anonnumberanon: julius, basically the curly braces have no effect
12:41 AM anonnumberanon: fadeLed() is never executed
12:41 AM anonnumberanon: UNLESS it is called by an interrupt and then the infinite loop will be interrupted
12:55 AM z3t0: im having an odd issue where an interrupt (int1) that is set to run in LOW, is always hit and always LOW even though it shouldnt be low
12:59 AM z3t0: i think a timer is interfering or something
01:13 AM daey_ is now known as daey
05:11 AM julius_: hi
05:12 AM Emil: morning
05:12 AM Emil: zopsi: you have level triggering on probably
05:13 AM Emil: z3t0:
05:13 AM Emil: rtfm ;)
05:14 AM julius_: a friend asked me if it would be possible to record video with some chip inside a fire alarm casing....i thought rpi zero would be a good fit but the current draw at idle with 60ma is to much over the long run (battery). also detecting motion with a avr and then waking up the rpi would take to long.....boot time isnt that fast. but there must be h264 encoder chips that can be used by avr i thought...google gives a few answers but none of them is available
05:14 AM julius_: via aliexpress.
05:14 AM julius_: isnt there a common video encoder option for the avr? no specific format needed, just some compression would be nice
05:14 AM Emil: mate
05:14 AM Emil: just dont :D
05:15 AM Emil: If you need video, use CHIP/RaspberryPi/OrangePi/Odroid/whatever
05:15 AM Emil: tweak the startup settings to get faster boot
05:35 AM polprog: julius_: the biggest culprit of slow boot time on raspi is the sd card
05:35 AM polprog: you can also disable some systemd components if you have debian/arch installes
05:35 AM polprog: installed*
05:36 AM julius_: im currently only owning a rpi2 with a rathe rexpensive sdcard. it kinda boots quickly....but since i want to record someone entering a door even 10 seconds would be to long
05:36 AM polprog: there are some motion activated cameras on ali, don't reinvent the wheel
05:36 AM julius_: yes there are
05:37 AM julius_: but i did not find one that would allow the video to be uploaded "live"
05:37 AM polprog: oh
05:37 AM julius_: i could be wrong though
05:37 AM julius_: recording to a sd card is certainly possible at a very nice price..
05:37 AM julius_: but for that they also would have to use some kind or decoding chip....wouldnt they?
05:38 AM julius_: s/or/of/
06:55 AM skz81: <polprog> git commit -a and done for today :D >> git commit -a is generally a bad pratice / habit....
06:56 AM polprog: why?
06:59 AM skz81: because you juste stage / commit you work of the day. Commit histories are not meant to be sliced "daily", but should have some "unity" (logically speaking), and should be simple
07:01 AM skz81: if you did only one thing the entire day, and it's finished, then, it's ok, but manually adding files to stage allow to realize, for example, you also modified the .gitignore for an entirely different purpose, so it should not be staged together
07:01 AM polprog: oh you mean that...
07:02 AM polprog: i commit on breakthroughs and major edits, for example when i got leds working
07:02 AM polprog: i thought using -a is a bad pratice
07:02 AM polprog: :P
07:08 AM skz81: <polprog> i thought using -a is a bad pratice >> that's what I said. People that use "git commit -a", 99% of time, are using the SCM as a backup copy. You can do this in background, no need to explicitely call a shell command to acheive that
07:09 AM skz81: If you use git as a good SCM, you want to rebase branches or cherry-pick commits
07:09 AM skz81: better to have commit that are as little and logically united as possible
07:10 AM skz81: If your commit includes some modif (but not all) for a feature you're trying to implement, plus some fixes for the previous commit you pushed
07:10 AM skz81: It's just unusable for a merge request
07:11 AM polprog: i need to read on git then
07:12 AM polprog: currently it's for reverting mistakes
07:13 AM skz81: indeed if you're alone on your repo/project, what I say in not accurate :p But always better to adopt good habits even in small / personnal context
07:14 AM skz81: (also code repo for AVRs are not really big, so merges are often easy even all-by-hand... Not true on thousand-class / million lines code base)
07:16 AM polprog: sure
09:52 AM julius_: skz81, -am 'dsfdsf' is my default ;)
10:17 AM mohsen_: Hi guys, I successfully turned on the light of my room by connecting one of the digital pins of my avr to a relay and then connecting the relay to the button of the light, now I want to know, what is the proper way to make multiple lights automatically turned on or off?
10:18 AM mohsen_: Is it good practice to attach a wifi and an avr to each light's button?
10:19 AM cehteh: wifi without avr rather :D
10:20 AM cehteh: esp8266 wifi chips (the most common ones) are much more capable than avr's on their own
10:21 AM mohsen_: cehteh: Are they the only programmable wifi chips?
10:21 AM cehteh: dunno .. i bet not
10:22 AM cehteh: but they are cheap and used everywhere with a dozen or more free software stacks to program them
10:22 AM mohsen_: cehteh: I expected more suggestions, is wifi really the only solution? what about transmitters or something
10:22 AM cehteh: you asked about wifi?
10:22 AM cehteh: otherwise, IR might be a solution for line of sight and 433mhz things
10:23 AM cehteh: also powerline where you modulate the conroll signal on the mains, but i think thats going to be expensive
10:23 AM cehteh: infrared is prolly the cheapest
10:24 AM cehteh: (and not the worst if you want to control things within the room)
10:25 AM * cehteh would even think about putting IR receivers everywhere and make one single wifi to ir brigde with a esp per room when cross room control is needed
10:27 AM mohsen_: Is IR the abbreviated term of a specific device? and by 433mhz you mean the transmitters?
10:27 AM cehteh: IR infrared .. like your TV remote
10:28 AM mohsen_: Oh
10:29 AM cehteh: and 433mhz yes there are these cheap transmitters/receviers for serial data, never used them, until some time ago they where widespread but the esp stuff replaced them in a lot places
10:32 AM cehteh: problem with most of this stuff is that it is pretty insecure unless you add some authentication and so on
10:32 AM cehteh: see recent problems where IoT things turned into a botnet
10:33 AM Casper: the main issue with the IoT botnet issue is... stupid linux script...
10:33 AM cehteh: careless programmers
10:33 AM cehteh: and exposing their shit to the internet
10:33 AM Casper: ex: system("cd %s", $_POST["dir"]); <=== can you see the massive issues here?
10:34 AM mohsen_: Casper: Ah, that's the simplest mistake a programmer can do
10:34 AM Casper: I see 2 problems here already
10:34 AM mohsen_: I only see one, letting the sender to run any command
10:34 AM cehteh: the first one is that the device is exposed to the internet
10:35 AM cehteh: doesnt make the 2nd one less problematic, but still
10:35 AM Casper: first, it won't work with space in path, not a security issue per say, but one bug
10:35 AM Casper: then
10:35 AM Casper: missing the interception of ";"
10:35 AM cehteh: even ; wont help you
10:36 AM cehteh: you need to filter a lot more shit .. or actually doing the whole thing differently, not even passing any user supplied strings to system()
10:36 AM cehteh: parse POST and only run your own code
10:36 AM Casper: won't fully fix it, but still... most common one
10:37 AM cehteh: not fully fixing it is like not fixing it at all
10:37 AM cehteh: an attacker will come through the hole, nowhere else
10:37 AM Casper: true, but not doing anything at all is even worse
10:37 AM cehteh: its not
10:37 AM mohsen_: Not validating and using user data can lead to a bug in any program
10:38 AM Casper: cehteh: atleast if the programmer did something, you can say he atleast tried
10:38 AM cehteh: thats void ,, he tried and failed
10:38 AM skz81: <Casper> missing the interception of ";" >> if you catch ";" i'll throw "&&"
10:38 AM cehteh: just make a list/array whatever of dirs one is allowed to change into
10:39 AM cehteh: then lookup POST[dir] in that array, if exists then cd
10:39 AM cehteh: if && doesnt work || may .. if that doesnt work then `` will and $() as well
10:40 AM Casper: cd "%s" intercept "&;|\` and a few more
10:40 AM Casper: oh and !
10:40 AM cehteh: i would disallow any 'punct' characters in such a string if i cant avoid the whole case altogether
10:40 AM cehteh: with / being whitelisted
10:40 AM Casper: also, it would help if they would chroot and drop root
10:40 AM skz81: maybe read about : man 3 chdir
10:41 AM cehteh: anyway .. never trust user input
10:41 AM Casper: yup, never trust user input, always assume the user want to hack
10:41 AM cehteh: but i seen even worse where the format string comes from user input as well :)
10:41 AM skz81: using system() is one of the bigger "hole". If no bash (or other interpreter behind) => mitigated problems !
10:42 AM Casper: yup
10:42 AM cehteh: anyway, be aware of this shit when you make your own connected devices
10:42 AM Casper: but the main issue with IoT seems to be exactly that... system()
10:43 AM Casper: but anyway
10:43 AM Lambda_Aurigae: Casper, "Tried and failed?" 'Tried and died....'
10:43 AM Casper: Lambda_Aurigae: yup, but atleast there is a locked door... the window beside it might be open, but hey! it have a door!
10:44 AM cehteh: its not system/popen per se .. just never ever pass unveriefied (whitelisted) user input to it .. if at all, better construct the commands to be executed by yourself
10:44 AM Casper: may be enought to prevent some hackers from succeding, so delay it enought for most to give up
10:45 AM Lambda_Aurigae: Casper, you recognize my misquote?
10:46 AM Casper: and mohsen_, for wifi, you may want to take a look at esp8266, it is a microcontroller with build in wifi. I currently have a love/hate relationship with it, mostly due to me that decided to go with the lua route... I'll move to the ardiono route probably
10:46 AM Casper: Lambda_Aurigae: nope
10:46 AM Casper: bbl, I have work to do...
10:46 AM mohsen_: Casper: Thanks for your suggestion
10:47 AM mohsen_: So, I guess I have to read up on some things that cehteh suggested, but I have one left question
10:48 AM mohsen_: Are transmitters able to identify a specific receiver and send data to it?
10:49 AM mohsen_: ie sending turn off/on command to a specific button of a light for
10:49 AM Casper: 433, no
10:49 AM cehteh: depends what you use
10:49 AM Casper: ir, no
10:49 AM Casper: wifi, somewhat
10:49 AM cehteh: usually you implement that by yourself
10:49 AM Casper: you do want to implement an ID in the protocol
10:49 AM Casper: and add checksum
10:50 AM Casper: and ideally error detection and recovery
10:50 AM cehteh: when you want to do that right you add some challenge/response auth if the thing is bidirectional
10:50 AM Casper: (which may be as simple as transmitting everything twice and hope that one of the two come throught fine)
10:50 AM cehteh: yes .. and checksum and resend ot correction
10:50 AM cehteh: echo everything back and transmit again if the echo was incorrect
10:51 AM cehteh: plenty of ways
10:51 AM cehteh: IR is a bit different as usually one makes that one-directional only
10:51 AM cehteh: but if you want to query the status you can make bidir IR as well
10:52 AM mohsen_: I was thinking about a box that contains an avr and a transmitter and a receiver and a wifi, through the wifi its connected to a router and receives commands from other devices connected to the router, then parses those command to see what light they correspond to, and then sending a request to that specific light through it's transmitter
10:52 AM cehteh: with wifi things you have the whole lore of internet protocols
10:52 AM mohsen_: Is this generally possible?
10:53 AM cehteh: too much. like i saied when you have wifi esp8266 you dont need an avr
10:53 AM cehteh: the esp is *much* more capable than any avr
10:53 AM cehteh: its a 32 bit core running at 40(or more?) Mhz with much more memory and ram than any avr
10:54 AM cehteh: the only thing where avr's make sense is if you want some more complicated control which stays active even when the ESP gets updated/reboots
10:54 AM cehteh: like PWM output or such
10:55 AM mohsen_: cehteh: Hmmmmm
10:55 AM specing: cehteh: stm32 makes more sense then
10:55 AM cehteh: simple on/off can be latched with some logic ic already
10:55 AM mohsen_: They're also cheap enough to make forget that implementation
10:55 AM cehteh: stm32 doesnt have wifi buildin
10:55 AM specing: cehteh: neither does AVR
10:56 AM cehteh: and esp cost $5 or so .. not much more than acr on a board
10:56 AM cehteh: some software stacks come with some interpreter language and a http server
10:57 AM cehteh: plug'n'go you dont even need complex C development and can upload software over the air
10:57 AM cehteh: and edit it on the flx
10:57 AM cehteh: y
10:57 AM cehteh: well gtg .. bbl
10:57 AM mohsen_: cehteh: Thanks alot
11:03 AM Lambda_Aurigae: Casper, Dune.
11:07 AM Casper: mohsen_: with wifi, you are only limited by the tight ressources you have
11:07 AM Casper: but it's not hard to do what you want
11:08 AM Casper: like the esp8266, even lua can do that (but I advice you to go straight arduino)))))
11:08 AM Casper: my current lua code... it connect to the router, then get the time of day from a ntp server
11:09 AM Casper: then (todo) will look for an update of any of the files
11:09 AM Casper: I could have a web server if I wanted
11:09 AM cehteh: ..re :D
11:09 AM cehteh: i'd rather go lua than arduino
11:09 AM Casper: it can also send data to any device, including the internet
11:09 AM Casper: udp and tcp
11:09 AM cehteh: or some other framework
11:10 AM Casper: cehteh: the problem with lua is the very tight space
11:10 AM Casper: lik, 42kB ram, which include the loaded scripts and all the variables
11:10 AM Casper: very very easy to run out of ram
11:11 AM Casper: lua has not been made for such limitations...
11:11 AM mohsen_: What do you guys mean by lua? I only know about the programming language..
11:13 AM cehteh: yes that
11:14 AM cehteh: Casper: for switching a light on and off that should be plenty
11:14 AM Casper: yes
11:14 AM cehteh: if lua cant do it, arduino often bloats worse :D
11:14 AM cehteh: lua at least is nicer
11:14 AM cehteh: one of my favorite programming languages
11:15 AM mohsen_: You guys run lua on avr?
11:15 AM Lambda_Aurigae: not I
11:15 AM Casper: mohsen_: not on avr, on the esp8266
11:16 AM Casper: https://www.aliexpress.com/item/D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266-by/32661918901.html?spm=2114.13010608.0.0.oOgUgU
11:16 AM cehteh: my 'ideal' setup for a living room automation would be like a single ESP somewhere central, with IR transmitter and then the devices each have an attiny with IR reveiver and SSR
11:19 AM Casper: not sure that I'ld go with IR
11:19 AM Casper: a full esp setup might be quite more reliable....
11:19 AM mohsen_: cehteh: Can an IR transmitter identify a single receiver and send data to it?
11:19 AM Casper: and probably not bigger
11:20 AM Casper: mohsen_: if you put the source 'address' in the data you send, of course?
11:20 AM mohsen_: Maybe more secure, because wifi is newer technology than IR?
11:20 AM Casper: the only reason why wifi know the sender is because the data contain the source address
11:20 AM cehteh: mohsen_: thats up to your programming
11:20 AM mohsen_: Casper: Oh, because as I heard, transmitters are used to broadcast data, a data that all the receivers receive
11:21 AM mohsen_: Casper: But with wifi a data is not broadcasted ?
11:23 AM cehteh: air is a shared medium everyone receives everything
11:24 AM cehteh: its about the receiver to filter what is interesting
11:24 AM cehteh: with wifi a lot software stack is already there to do that
11:24 AM cehteh: with other technologies you are mostly on your own
11:25 AM mohsen_: Hmmm, you're right
11:27 AM cehteh: which isnt much of a problem either
11:27 AM bss36504: Alright I have a question about schedulers
11:28 AM bss36504: you have some sort of a function pointer to your task function, how do you call it the first time? Do you just set the PC to the address of the function?
11:36 AM skz81: bss36504, first context switch is still a switch. Just prepare a new context for you new task, and switch
11:37 AM bss36504: Ok then how do you enter that context to begin with?
11:37 AM skz81: Do you just set the PC to the address of the function? >> When I wrote one, scheduler was an ISR, and I used to swap the return adress in the stack
11:37 AM skz81: "switch" actuallty performed by IRET
11:38 AM bss36504: Oh interesing
11:38 AM bss36504: interesting*
11:38 AM cehteh: bss36504: its all up to you
11:38 AM bss36504: But I'm talking about the first time the task is called
11:38 AM cehteh: in my mµOS i just schedule functions as well
11:39 AM cehteh: no special tricks, ISR only for the timer
11:40 AM cehteh: no contexts as in stack and state, cooperative, a function must return, then the next one is scheduled, or it may call the scheduler recursively
11:40 AM bss36504: I'm talking in a preemptive scheduler
11:40 AM cehteh: on avr?
11:41 AM bss36504: not strictly speaking, no
11:41 AM cehteh: because thats quite limited by ram
11:41 AM cehteh: ok
11:42 AM bss36504: You need to be able to call the function at least once before you have a "context" to store, right? so that first time the scheduler wants to run a task you'd need a way to jump to the beginnning of said function. I assumed you'd do something like set the interrupt return address to the function address or set the PC to the function address, just t
11:42 AM bss36504: hat first time
11:42 AM bss36504: consider this hypothetical architecture to be AVR-like in the core, but with unlimited memory
11:42 AM cehteh: also much more complicated, you need to allocate the stack for a thread at least and whatever is needed for the context
11:42 AM Emil: wg #nginx
11:42 AM Emil: Oops
11:42 AM bss36504: That's taken care of, and seems comparatively easier
11:42 AM bss36504: Just allocate an array as part of the TCB (task control block) structure
11:43 AM bss36504: at least in the case of a statically allocated stack
11:43 AM bss36504: then you can just set your SP to the array address, at least if your stack and RAM exist in the same memory space
11:43 AM cehteh: dunno you can do different ways there
11:43 AM bss36504: so really my missing link in understanding is that initial call to the task function
11:44 AM bss36504: is it as simple as just setting the return address of the interrupt (or PC) to the function address?
11:44 AM Emil: bss36504: you just set it
11:44 AM cehteh: like you can start a new thread with a partial context only and using the current stack, and if it finishes early (before a context switch) you safed a lot management stuff
11:44 AM cehteh: if thats worthwile
11:45 AM bss36504: sure. In this hypothetical sense I'm not concerned with efficiency
11:45 AM cehteh: or you allocate a complete context at thread creation time and put it on a "runable" list where it become scheduled eventually
11:45 AM bss36504: Emil: so like I said then?
11:45 AM bss36504: cehteh: Yeah that's more or less what I envision
11:45 AM bss36504: However, I cant really see how you'd make a
11:45 AM cehteh: when you have unlimited memory then you can pre-partition the memory into infinite blocks for inifite theads :D
11:46 AM bss36504: "complete" context without first running the function, *unless* you can set that context's initial PC to the addr of the function itself, which is what intuitively makes sense to me. I'm just trying to confirm
11:46 AM cehteh: that wouls be awesome :D
11:46 AM bss36504: that was a continuation of my previous message, btw :)
11:46 AM bss36504: that would be awesome
11:47 AM cehteh: the 'complete' context is setup in a way how you enter your function
11:48 AM cehteh: return address and maybe few parameters already in the stack PC to the start of the function, registers initialized to something what makes sense
11:48 AM bss36504: Ah yes ok
11:48 AM cehteh: no need to run the function initially
11:48 AM bss36504: right that's kinda what I thought
11:49 AM cehteh: but needs some understanding of the hardware platform, not easy to do in plain C
11:49 AM bss36504: logically it made sense that if I had a function pointer (and therefore address), I could just set the PC to that pointer
11:49 AM bss36504: yes of course, some sort of platform stuff is necessary
11:49 AM cehteh: somewhat like that, but you have to follow the ABI rules of that platform
11:50 AM cehteh: a function call for example expects the return address on the stack (or in some register)
11:50 AM bss36504: fair enough
11:50 AM bss36504: I imagine you could just set the return address, for example, back to main or some stub function that just infinitely loops
11:51 AM bss36504: maybe not the start of main, but where you left off
11:51 AM cehteh: more a cleanup function which frees the context and ends the thread
11:51 AM bss36504: that would make more sense I suppose
11:51 AM cehteh: if you want a thread pool you proilly do that a level higher
11:52 AM bss36504: sure
11:52 AM bss36504: This has been helpful
11:52 AM cehteh: loop which waits for work to be done and executes it
11:52 AM bss36504: I had like 90% of the details, just that one thing was confusing me for some reason. It's one thing to be like "yeah just call it" it's another to answer the "how do I call it?" question
11:54 AM cehteh: look like others do it
12:02 PM pitastrudl: hi
12:02 PM pitastrudl: im wondering if the BRNE can be used after an EOR that clears the register
12:03 PM pitastrudl: e.g. EOR r1,r1
12:03 PM pitastrudl: since EOR sets the Z flag, and BRNE tests the Z flag it should right?
12:03 PM pitastrudl: but in the documentation it is written that it only does it when CP,CPI, SUB or SUBI are used
12:03 PM pitastrudl: http://i.imgur.com/30zUPb8.png
12:03 PM pitastrudl: so im not sure if it would work or not
12:05 PM pitastrudl: ah wait, BRNE tests if its cleared
12:05 PM pitastrudl: soooooo all is ok :)
12:16 PM Jartza: pitastrudl: if you use EOR r1,r1 you always know it's zero, why test anything?
12:16 PM Jartza: eor r1,r1 is same as clr r1
12:17 PM pitastrudl: i know
12:18 PM Jartza: but why use brne then?
12:19 PM pitastrudl: becuase i didnt design the problem :p
12:20 PM Jartza: what?
12:20 PM pitastrudl: it's part of a quiz question
12:20 PM pitastrudl: and it's some really stupid problems that make no sense
12:20 PM Jartza: sounds like stupid question
12:20 PM pitastrudl: indeed
12:20 PM Jartza: brne never jumps anywhere after clr
12:25 PM Jartza: luckily avr asm is easy
12:26 PM pitastrudl: indeed, it's not hard
12:41 PM Jartza: reminds me of 6502
01:09 PM JanC_ is now known as JanC
02:33 PM darsie: Do I need a linux driver for an USBasp programmer with avrdude?
02:34 PM darsie: says avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
02:34 PM darsie: the programmer has these IDs.
02:35 PM darsie: New USB device found, idVendor=16c0, idProduct=05dc
02:37 PM Casper: no driver required
02:37 PM Casper: however
02:38 PM Casper: you may need to change the permission of the device or run avrdude as root
02:38 PM darsie: ok
02:38 PM Casper: also, what command line did you used?
02:38 PM darsie: avrdude -c usbasp -p m328p
02:38 PM darsie: I didn't define it in .avrduderc
02:40 PM darsie: ok, works as root. I'll see where to change permissions. thx.
02:42 PM Casper: udev somewhere...
02:42 PM Casper: unless you use systemd...
02:43 PM darsie: there are a few systemd processes.
02:43 PM darsie: e.f. /lib/systemd/systemd-udevd
02:43 PM darsie: e.g.
03:04 PM x29a: darsie: something like http://www.avrfreaks.net/comment/519232#comment-519232
03:06 PM C745H: ping
03:06 PM bss36504: pong
03:24 PM catphish: is there a way to bind a short int variable to a register pair? i have a program that revolves heavily just a couple of numbers, one char and one short, endlessly loading and storing the same variable seems quite wasteful
03:24 PM catphish: (using gcc)
03:26 PM darsie: x29a: thx, but this didn't work.
03:33 PM x29a: darsie: which did you try?
03:34 PM darsie: SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="05dc", MODE="0660", GROUP="plugdev"
03:34 PM x29a: when you plugin the programmer, does "dmesg" show a device that is created?
03:34 PM darsie: filename 45-USBasp
03:34 PM x29a: the hexcodes relate to what lsusb shows?
03:36 PM x29a: darsie: also, is your user a member of the plugdev group?
03:36 PM x29a: the command "groups" will show you
03:36 PM darsie: syslog: http://pastebin.com/iaQUiDBy
03:36 PM darsie: I'm in plugdev, yes.
03:36 PM x29a: and restarted udev?
03:37 PM darsie: I 'reloaded'.
03:37 PM x29a: give it a restart
03:37 PM x29a: although thats voodoo
03:38 PM darsie: nope
03:38 PM x29a: udevadm control --log-priority=info
03:38 PM x29a: then replugin and check if the log shows something
03:38 PM darsie: Currently I use SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="05dc", MODE="0666"
03:38 PM x29a: sysfs is deprecated, see at bottom of https://learn.adafruit.com/usbtinyisp/avrdude
03:39 PM darsie: Is it ok to have both rules active simultaneously for the same device?
03:40 PM x29a: id comment one out
03:40 PM darsie: I deleted the other one.
03:40 PM x29a: hopefully the log will tell you when udev is unhappy
03:40 PM x29a: http://unix.stackexchange.com/a/36255/16764
03:41 PM darsie: nothing new with --log-priority=info
03:42 PM darsie: I have to eat ... bbl
04:08 PM darsie: re
04:15 PM x29a: darsie: btw, did you name your file 45-USBasp or 45-USBasp.rules?
04:17 PM darsie: 45-USBasp
04:17 PM darsie: But now I have 99-USBasp.rules
04:18 PM x29a: and restarted udev and still nothing?
04:18 PM darsie: mhm
04:19 PM polprog: logouy and login!
04:19 PM polprog: logout*
04:19 PM x29a: full reboot!
04:19 PM darsie: lol, no?
04:19 PM polprog: seriously
04:19 PM x29a: did you have to add yourself to the group?
04:19 PM darsie: logout/in helps with group id.
04:19 PM polprog: i fixed avrdragon rules like that
04:19 PM x29a: then relogin is necessary
04:19 PM darsie: No, I already was in plugdev.
04:19 PM x29a: ok
04:20 PM polprog: udevadm control --reload
04:20 PM polprog: or something like that
04:20 PM x29a: just do it and when it works we will all say "aaah, turning it off and on again, like always, works"
04:20 PM darsie: I relogined at the text console. didn't help.
04:21 PM polprog: have you reloaded the udev rules?
04:21 PM darsie: yes
04:21 PM polprog: it can also be incorrect syntax
04:21 PM darsie: /etc/init.d/udev restart/reload and udevadm control --reload
04:22 PM polprog: check arch wiki on udev topic, there is a section about avr programmer rules
04:22 PM darsie: I'm using debian.
04:22 PM polprog: doesnt matter
04:26 PM polprog: it can be i fixed that yesterday
04:26 PM polprog: in the udev rule file you can either use ATTR{..} or SYSFS{..}
04:26 PM polprog: check both
04:27 PM darsie: ATTRS
04:27 PM polprog: yes ATTRS or SYSFS, my bad ;)
04:28 PM darsie: yay, works with ATTRS :)))
04:28 PM darsie: thx :)
04:28 PM polprog: :)
04:29 PM x29a: darsie: how does it differ to https://learn.adafruit.com/usbtinyisp/avrdude "at very bottom" now?
04:30 PM darsie: SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", MODE="0666"
04:30 PM x29a: ah, so ATTRS for idvendor, maybe we should ping adafruit on that
04:32 PM darsie: this works, too: ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", MODE="0660", GROUP="plugdev"
04:32 PM polprog: maybe a diferent version of usbtinyisp?
04:32 PM darsie: hmm?
04:32 PM polprog: in that case both lines should be in the file
04:32 PM x29a: but its ATTRS and the howto says ATTR
04:32 PM polprog: that's surely a typo there
04:33 PM darsie: Now I might want a firmware update ... avrdude: warning: cannot set sck period. please check for usbasp firmware update.
04:33 PM polprog: it was always a pain to get that sorted
04:33 PM polprog: darsie: i had that problem too
04:34 PM polprog: in my case it was too old firmware on the asp
04:34 PM polprog: my solution was to continue with the parport programmer
04:35 PM darsie: Why not update firmwar?
04:35 PM polprog: it was my only avr programmer
04:35 PM darsie: too risky?
04:35 PM polprog: i didnt know how to do a firmware update on it
04:36 PM darsie: ah
04:36 PM darsie: Mine has a program self jumper.
04:36 PM polprog: i sticked to my crude parport cable
04:36 PM polprog: if your has the jumper you can try
04:37 PM darsie: lacks the slow clock jumper, so I thought it would support software clock rate. But well, it detects the chip so maybe it autosets the lock rate.
04:37 PM polprog: to be honest you fixed that udev problem quicker than i did yesterday
04:37 PM darsie: With your help.
04:38 PM darsie: That's culture.
04:38 PM polprog: you're welcome
04:38 PM darsie: We progress :).
04:38 PM polprog: :)
04:40 PM polprog: you can try the firmware update
04:40 PM darsie: I wonder if I should as it works now.
04:40 PM darsie: Haven't programmed anything, yet, though.
04:40 PM polprog: but does avrdude say it's ok?
04:41 PM polprog: there was something about the clock rate
04:41 PM darsie: yeah, can't set clock rate, but the rest is normal.
04:42 PM polprog: connect it to the chip and run it with -p (chip)
04:42 PM darsie: I did
04:42 PM polprog: and it works?
04:43 PM darsie: yes: http://pastebin.com/6n4wcEPH
04:43 PM polprog: brilliant ;) have fun with avrs
04:43 PM darsie: Probably uses a default clock rate, or the firmware automatically selects a working clock rate.
04:44 PM darsie: I think I still have DIV8 fuse set.
04:44 PM polprog: the message was about the programmer's clock rate
04:45 PM polprog: it's not the chip's clock frequency
04:45 PM darsie: yes, but the default programmers clock used to be too high for 1 MHz chips (8 MHz + DIV8).
04:46 PM polprog: i dont understand
04:46 PM darsie: CKDIV8 fuse
04:46 PM darsie: the avr needs to sample the programmers signals. If it's too slow it can't.
04:46 PM polprog: maybe... i never changed those fuses
04:47 PM darsie: The CKDIV8 fuse makes the avr select 8 as clock prescaler, so turns 8 MHz RC oscillator clock to 1 MHz.
04:47 PM polprog: i know what it does, i just didn't know it has it's effect on programming
04:48 PM darsie: Yeah. With the fuse disabled the avr uses 8 MHz.
04:49 PM Lambda_Aurigae: slow down the main clock and you slow down the top programming speed.
04:49 PM polprog: TIL
04:50 PM darsie: My programmers quartz case has a dent.
04:50 PM xentrac_: quartz doesn't dent; it shatters
04:50 PM darsie: The case.
04:50 PM darsie: metal can.
04:51 PM polprog: 2 pin or 4 pin can?
04:51 PM darsie: 2 pin
04:51 PM xentrac_: I wonder if it's even more painfully slow if you run it off the 128kHz RC oscillator
04:53 PM Lambda_Aurigae: xentrac_, well, it is possible to program one running off of a 555 timer for the clock source at 500kHz.
04:53 PM darsie: should be
04:53 PM Lambda_Aurigae: and it is also possible to use a 555 timer in one shot mode with a push button for the trigger and some other switches to program one manualy.
04:54 PM polprog: but why
04:54 PM xentrac_: heh
04:54 PM xentrac_: indeed
04:54 PM Lambda_Aurigae: doubt a usbasp will be able to slow down enough to program it running on a 128kHz clock.
04:54 PM polprog: the one shot clock cycle might be useful for debugging
04:54 PM Lambda_Aurigae: polprog, for the fun of it.
04:54 PM darsie: Lambda_Aurigae: debounce properly.
04:54 PM Lambda_Aurigae: darsie, hence the 555 in 1-shot mode.
04:54 PM Lambda_Aurigae: that's my button debouncer.
04:55 PM darsie: k
04:55 PM darsie: When all computers are broken and you need to reboot society with an avr ;).
04:55 PM Lambda_Aurigae: set to 1/2 second cycle.
04:55 PM polprog: haha, programming avrs like the altair
04:55 PM Lambda_Aurigae: polprog, bingo..or like an old mini
04:56 PM polprog: there was a question on stackexchange, "what would happen if we lost the compilers"
04:56 PM Lambda_Aurigae: ti-980B was my first introduction to loading program to computer with toggle switches.
04:56 PM darsie: polprog: We might find out they were backdoored :).
04:56 PM Lambda_Aurigae: back in 1987.
04:57 PM darsie: Sometimes I output status signals with beeps, even numbers as high/low beep bits.
04:58 PM Lambda_Aurigae: never done that...just use LEDs for such things.
04:58 PM xentrac_: polprog: I've participated in some fun discussion threads along those lines
04:58 PM Lambda_Aurigae: many-a-motherboard did that though.
04:58 PM xentrac_: http://github.com/kragen/stoneknifeforth is part of my answer
04:58 PM darsie: I use a piezo speaker for it.
04:58 PM Lambda_Aurigae: back in the day we memorized the beep sequences for many brands of motherboard manufacturers.
04:59 PM polprog: Lambda_Aurigae: im too young for that, the only switches i flipped on a computer was an old mobo i was changing the frequencies
04:59 PM xentrac_: have you measured the outputs of piezo speakers, darsie? like approximately how much acoustic power they can put out, or what their efficiency is?
04:59 PM polprog: failed attempt of overclocking an old amd athlon
04:59 PM darsie: xentrac_: no
04:59 PM xentrac_ is now known as xentrac
05:00 PM Lambda_Aurigae: polprog, I'm from the vic-20 era as a teenager...I go waaay back.
05:00 PM Lambda_Aurigae: piezo speakers can put out a lot of noise.
05:00 PM Lambda_Aurigae: piezo buzzers too.
05:01 PM xentrac: the particular thing I'm interested in is whether I can use them to vibrate a powder chute to fluidize the powder
05:01 PM xentrac: so I'm wondering how big of a piezo buzzer I need to be able to get, say, 10mW of output acoustic power
05:02 PM darsie: They can also take quite high voltage.
05:03 PM darsie: And higher frequency means higher power, too.
05:03 PM Lambda_Aurigae: xentrac, shouldn't take much...you moving toner or something?
05:05 PM hetii: hi :)
05:05 PM polprog: hi
05:05 PM hetii: Q: for this small question, http://pastebin.com/C2Zhdi1Q
05:05 PM hetii: why I cannot redirect stdout by using function
05:06 PM hetii: I don`t get any compile time error it just don`t print anything.
05:06 PM xentrac: similar size to toner, but it's quartz powder, glass powder, stuff like that — ideally I could treat the surface to make it as slippery as toner, because I'm having a lot of trouble with it clumping up
05:06 PM xentrac: vibrating it by hand helps a lot
05:08 PM Lambda_Aurigae: toner uses carbon black as an anti-clumping agent...sometimes some other chemicals too.
05:11 PM darsie: "A modern Chinese USBASP will set the SCK period automagically. There is NO reason to upgrade the firmware. Just ignore the warning." http://www.avrfreaks.net/forum/avrdude-warning-cannot-set-sck-period-please-check-us
05:14 PM arij is now known as arij_work
05:15 PM Lambda_Aurigae: darsie, good luck with that.
05:15 PM darsie: thx
05:16 PM Lambda_Aurigae: xentrac, was just thinking, if you have stuff that is as fine as toner, be very very careful with high frequency sound like you are talking about...that stuff can get airborne very easily.
05:16 PM darsie: hmm, programming verify fails at byte 0. hangs on restoring lfuse.
05:17 PM darsie: I'll try powering it alternatively...
05:17 PM Lambda_Aurigae: not sure if the plethora of problems with usbasp is because of problems with usbasp or just how many of them are out there.
05:17 PM Lambda_Aurigae: I have never had a problem with my stk200 clones...
05:18 PM darsie: my usbasp was just 1.15 EUR, free shipping, aliexpress.
05:19 PM polprog: the only programmer that JustWorks (tm) is the paralell cable
05:20 PM Lambda_Aurigae: polprog, that's what the stk200 is basically
05:20 PM polprog: usbasp, dragon, they all do weird stuff
05:20 PM Lambda_Aurigae: darsie, mine was built from parts in my junk pile...no cost.
05:20 PM Lambda_Aurigae: it is 16 years old and works with most attiny and all atmega chips.
05:21 PM Lambda_Aurigae: for the strange tiny and xmega I have a usb programmer I bought from tom_itx
05:21 PM polprog: i notorously fight my dragon as it fails to communicate
05:21 PM polprog: it always works eventually but im sick of it
05:22 PM polprog: yesterday was flawless, oddly
05:22 PM Lambda_Aurigae: I use my dragon for HVSP or HVPP only.
05:22 PM Lambda_Aurigae: and that very rarely.
05:23 PM Lambda_Aurigae: haven't fired it up in over a year
05:24 PM Lambda_Aurigae: on the rare occasion that I hose the fuses I just drop the chip into the fuse doctor and wipe it.
05:25 PM polprog: i never used HVSP
05:26 PM darsie: Is it good to short USB ground with USB plug shield? I want the 85 V mains leak from my 3-12 V wall plug to dissipate before any data pins connect.
05:27 PM Lambda_Aurigae: you probably shouldn't short them while it's plugged in.
05:27 PM Emil: wat
05:27 PM Emil: you can connect gnd with usb gnd
05:27 PM Lambda_Aurigae: if you are that paranoid, use a 10Kohm resistor to short them and wait 5 minutes.
05:27 PM darsie: but programming didn't work with the wall wart powering the avr, anyways.
05:27 PM Lambda_Aurigae: oh..duh...I missed that..
05:27 PM Emil: and if your wallwart leaks high voltage then dont use it
05:27 PM Emil: idiot
05:27 PM Lambda_Aurigae: I thought he said USB gnd with vcc.
05:28 PM darsie: short usb ground with usb plug shield.
05:28 PM Emil: Yes and most do
05:28 PM Lambda_Aurigae: they should be the same.
05:28 PM Emil: but
05:28 PM darsie: k, making the short on the usbasp...
05:28 PM Emil: IF YOUR WALL WART LEAKS HIGH VOLTAGE INTO THE VCC DONT USE IT
05:28 PM Lambda_Aurigae: although some don't connect the shield to anything.
05:29 PM Lambda_Aurigae: I bet your walwart isn't regulated at all.
05:29 PM Lambda_Aurigae: no clue if your ardweeny board has regulation on it or not.
05:29 PM polprog: i hope it's isolating
05:29 PM Lambda_Aurigae: err...usbasp..
05:29 PM darsie: Emil: Vcc is 3 V relative to gnd. But they both are at 85 V AC.
05:29 PM polprog: throw that shite away
05:29 PM Emil: -.-
05:30 PM Lambda_Aurigae: your wall wart is leaking 85vAC?
05:30 PM Lambda_Aurigae: that's just.....BAD
05:30 PM Emil: darsie: your wallwart is not isolating. Do not use iy
05:30 PM darsie: yes. high impedance.
05:30 PM darsie: 1 uA AC to mains ground.
05:30 PM Lambda_Aurigae: it is junk
05:30 PM Lambda_Aurigae: throw it away
05:31 PM Lambda_Aurigae: or watch a chip or three fry then throw it away
05:31 PM polprog: i guess you could fix that grounding the 0V but just throw it away
05:31 PM polprog: for the sake of safety
05:31 PM darsie: It's safe for humans.
05:31 PM polprog: i wouldn't say so
05:32 PM polprog: it leaks 1uA now but if something happens it may drastially lower it's impedance and it won't be funny then
05:36 PM Lambda_Aurigae: polprog, then it will be very funny!
05:36 PM Lambda_Aurigae: if it is caught on video and posted to youtube anyhow.
05:36 PM polprog: electric boogaloo!
05:37 PM Lambda_Aurigae: my workbench currently has a nice store-and-forward AC isolation system.
05:37 PM polprog: i wanted to build one, with isolation transformer and an RCBO
05:37 PM polprog: i've got a couple of things to fix
05:37 PM Lambda_Aurigae: no transformer...well, except in the buck converter to drop 12V to 5.5V and 3.3V
05:38 PM Lambda_Aurigae: my workbench is powered by 4 old car batteries.
05:38 PM polprog: a nixie tube frequency meter
05:38 PM polprog: baterries are the safest :)
05:38 PM Lambda_Aurigae: they charge up when I fire up the generator but mostly I work with the generator off.
05:38 PM Lambda_Aurigae: well, kinda.
05:38 PM Lambda_Aurigae: shorting my batteries can give some fun sparks!
05:39 PM polprog: my acid lead battery also makes cool sparks
05:39 PM Lambda_Aurigae: they are all kinda weak...won't start the trucks they came out of very well in the winter.
05:39 PM Lambda_Aurigae: but provide enough power to run the light and bits-n-pieces on my bench.
05:40 PM polprog: do you live in a remote location or just no mains?
05:40 PM Lambda_Aurigae: recently got a new soldering iron that runs from a 12V wall wart...just made a plug for it straight to the batteries.
05:40 PM Lambda_Aurigae: no mains in the shop other than generator.
05:41 PM Lambda_Aurigae: it's across the street from the house and I don't feel like paying for a separate power feed and the county won't let me dig a trench under the road to run an extension cord.
05:41 PM polprog: i need to get a shop because im running out of space in my room
05:41 PM Lambda_Aurigae: and, I live in the middle of nowhere more or less.
05:41 PM polprog: :)
05:42 PM Lambda_Aurigae: https://www.google.com/maps/place/1729+Marble+Rd,+Union,+IA+50258/@42.1733003,-93.0957565,552m/data=!3m1!1e3!4m5!3m4!1s0x87efb535b9207049:0xa224e959427fd913!8m2!3d42.1732963!4d-93.0935678
05:42 PM Lambda_Aurigae: my house is on the northwest corner of that intersection. my shed is on the southwest corner.
05:44 PM polprog: i live in southeast part of warsaw
05:44 PM polprog: there's a cool place in warsaw that runs since the 80's where people sell electronic odditioes
05:44 PM Lambda_Aurigae: I have a very good friend who lives near warsaw.
05:44 PM polprog: oddities*
05:45 PM Lambda_Aurigae: I think its warsaw.
05:45 PM Lambda_Aurigae: now i need to check.
05:45 PM polprog: i always wanted to visit the states
05:48 PM Lambda_Aurigae: yup..he is in warsaw.
05:48 PM Lambda_Aurigae: working at the American Embassy.
05:49 PM Lambda_Aurigae: I've never been to Poland myself.
05:49 PM Lambda_Aurigae: closest was Ramstein Germany.
05:49 PM Lambda_Aurigae: and I was there for less than 24 hours.
05:52 PM polprog: my aunt was to states once, visiting a relative
05:52 PM polprog: she says it's cool
05:53 PM Lambda_Aurigae: it's not bad here.
05:54 PM Lambda_Aurigae: we probably have the highest standard of living in the world.
05:54 PM Lambda_Aurigae: our forefathers worked their asses off for it too...
05:54 PM Lambda_Aurigae: today we are too lazy and will likely lose it in the next generation or two.
05:54 PM polprog: don't worry, it's the same here
05:55 PM Lambda_Aurigae: at least we are following the rest of the world in electing ashats to our highest levels of government.
05:55 PM Lambda_Aurigae: asshats
05:56 PM polprog: :^) that rings a bell
05:56 PM Lambda_Aurigae: and throws a trump card too!
05:56 PM Jartza: evening
05:56 PM polprog: evening
05:56 PM Lambda_Aurigae: morning Jartza
05:57 PM Lambda_Aurigae: "Our leader is more of an idiot than your leader!" now has a special meaning....
05:58 PM learath: Lambda_Aurigae: that would explain things....
05:58 PM learath: someone has a bet on who can elect the world's stupidest leader
05:58 PM Lambda_Aurigae: probably
05:58 PM learath: too bad kim jong il doesn't count
05:58 PM Lambda_Aurigae: and it's probably somewhere around 5 pesos..
05:58 PM Lambda_Aurigae: yeah..he wasn't elected.
05:59 PM Lambda_Aurigae: it is just about time for the USA to lead a UN group into North Korea and turn them into a democracy.
05:59 PM learath: hah :)
06:00 PM Lambda_Aurigae: Since we don't have a democracy here and everybody wants it but can't figure out how to make it happen in our country we need to force it on other countries!
06:01 PM polprog: i think i'll try to sleep now. i may come back today
06:02 PM Lambda_Aurigae: sleep well.
06:16 PM Jartza: I should sleep, but can't
06:16 PM Jartza: need to wait for the 3D printer to extrude some parts first
06:19 PM darsie: I give up on the asp. Back to parport ...
06:27 PM darsie: Hmm, I colud try a different firmware.
07:17 PM darsie: parport programmer works
07:19 PM arij_work is now known as arij
07:35 PM rue_house: buffered parallel programmers always seem to work
07:36 PM Lambda_Aurigae: yup.
07:36 PM Lambda_Aurigae: unbuffered work ok too if you are careful.
07:37 PM rue_house: its 50/50
08:08 PM Lambda_Aurigae: I should build and sell my pic16f1454 based avr programmers.
08:08 PM Lambda_Aurigae: heck, I should expand it to work with pic chips too.
08:09 PM darsie: I'll buy one for 1.15 EUR including shipping.
08:09 PM Lambda_Aurigae: yeah, not.
08:09 PM Lambda_Aurigae: the chip costs about that.
08:10 PM darsie: mine has an atmega8
08:10 PM Lambda_Aurigae: yeah.
08:10 PM Lambda_Aurigae: and bitbanged usb via the v-usb firmware.
08:10 PM darsie: mhm
08:11 PM darsie: I thought maybe the usb is the problem.
08:11 PM Lambda_Aurigae: the pic15f1454 has hardware usb and can run without an external crystal..syncs the clock to the usb with a pll.
08:11 PM Lambda_Aurigae: it can be sometimes.
08:11 PM Lambda_Aurigae: I have several computers that don't play well with v-usb.
08:11 PM darsie: maybe plug it directly to my PC, not via usb extension cable.
08:11 PM Lambda_Aurigae: one where it works on some ports and not others.
08:11 PM Lambda_Aurigae: use a powered usb hub.
08:11 PM darsie: no
08:11 PM Lambda_Aurigae: older one is best.
08:12 PM Lambda_Aurigae: don't use usb3.0 ports either...those are the ones I've had the most problem with.
08:12 PM Lambda_Aurigae: v-usb makes some assumptions and takes some shortcuts to get low speed usb working.
08:12 PM Lambda_Aurigae: it's a fun toy but not something I would want to rely on.
08:14 PM Lambda_Aurigae: hmm.. $1.44 USD for the pic16f1454 chip.
08:16 PM Lambda_Aurigae: I should port that to the pic32mx chip and see how much of the program I can buffer.
08:19 PM Lambda_Aurigae: or maybe add an spi nvram to the pic16 version!
08:21 PM Lambda_Aurigae: 1Mb serial sram can hold 128KB of hex file then write it out to the avr...hmmmmm...HMMMMM...
08:22 PM Lambda_Aurigae: add a header to the hex file with the chip to be programmed set in it then cat it out to a virtual com port...
08:22 PM Lambda_Aurigae: just wish pic chips could be programmed as easily as avr chips.
08:47 PM dgriffi: Lambda_Aurigae: being able to use C dor AVR really clinches it for me.
08:48 PM darsie: what?
08:48 PM darsie: for