#avr Logs

Sep 27 2017

#avr Calendar

12:17 AM day__ is now known as daey
02:06 AM erossi_ is now known as erossi
06:45 AM mmfood: not entirely sure this is the right channel for this but what the heck, is the rigol 1054Z still hackable to get 100MHz? And either way, is it still a good bang for buck scope or has it been superceded by another scope?
07:11 AM daey: mmfood: do you do much analog stuff? i rarely use mine at all
07:28 AM mmfood: some, but I also would like to have something to debug signals and stuff.
07:30 AM noHitW_work: we participated in the Alakajam 2017 last week end
07:31 AM noHitW_work: my frined did gfx and i coded, this is what we got together in 48 hours https://alakajam.com/1st-alakajam/74/al-the-chemist/
07:39 AM MrCircuitMatt: mmfood: I think it's excellent bang for buck but I don't know about the hack. I never owned a low-end scope though, so I'm just judging from videos and from what I've been told by other people
07:55 AM daey: mmfood: well if you dont do anything excessive, you will rarely have signal issues. i found my 10eur logic analyzer much more useful.
08:09 AM MrCircuitMatt: I guess it really depends what he wants to do. If I have the choice between a scope and a LA then I'll take the scope for sure but I agree in that it depends what you actually want to do. Hard to give advice in that regard without knowing that
08:12 AM mmfood: well, for one thing, I want to debug my analog scope ^^
08:34 AM Cracki: well I like the recording depth and ease of navigating logic traces on a real computer
08:34 AM Cracki: I'd love to have that for analog signals, sure, but eh...
08:34 AM Cracki: pulseview is gaining that ability
08:41 AM merethan: Hi all
08:45 AM Cracki: Mahlzeit
09:08 AM Jartza: hello
09:18 AM NoHitWonder: hi
09:18 AM polprog: hi
09:22 AM polprog: i remember i once managed to make pulseview talk to my rigol
09:22 AM LeoNerd: Me too
09:22 AM polprog: but it kept crashing every minute or so
09:22 AM LeoNerd: But PV isn't really built for doing analog stuff, so I didn't find much use in it in the end
09:22 AM polprog: yes
09:29 AM rue_house: small bursts of serial data between things you can zoom in on and get your numbers
09:30 AM LeoNerd: That's digital, though
09:30 AM LeoNerd: PV is really good at digital stuff - its many layers of decoding totally whip the pants off *anything* else I've ever seen
09:30 AM LeoNerd: But for analog? Meh
09:30 AM Cracki: ^^ it's not there yet
09:31 AM Cracki: they have too few core devs
09:31 AM LeoNerd: Last time I looked you can't even add a trivial simple level-based discriminator decoder to turn analog signals into digital ones
09:31 AM Cracki: that's now implemented
09:31 AM LeoNerd: Oh? Ah.. nice :)
09:31 AM Cracki: it's a function of analgo signals tho, not a decoer
09:31 AM LeoNerd: Mm?
09:31 AM Cracki: with and without hysteresis, any level, or average+-15%, or standard logiv levels
09:32 AM Cracki: decoders are still on digital inputs, or stacked on top of other data types
09:32 AM LeoNerd: Right; but is its *output* a digital value?
09:32 AM Cracki: yes
09:32 AM LeoNerd: So that you can stack something like I²C or SPI decoder on that?
09:32 AM Cracki: of course
09:32 AM LeoNerd: Right.. then yes that's exactly the thing I meant :)
09:32 AM LeoNerd: OK so I'll now adjust my statement: PV is *almost* useless on analog signals, except for those encoding digital data
09:33 AM Cracki: I'm guessing as soon as someone with an analog capable device starts asking for things, they'll happily give all the assistance
09:33 AM Cracki: hehehe
09:33 AM LeoNerd: So now you can at least use an analog scope as an LA
09:33 AM Cracki: I'd love PV to evolve to be a realtime scope display
09:33 AM Cracki: might even contribute some opencl kernels for that phosphorus effect
09:33 AM LeoNerd: I'd like to see -real- analog features, like all the level/time analysis stuff even my cheapie DS1054Z has on the measure buttons
09:34 AM LeoNerd: Voltage [max, min, peak, range, 10%, 90%, ... that sort of thing]
09:34 AM Cracki: yes yes, that too of course, once the analog signal stuff has been made sense of
09:34 AM LeoNerd: Time analysis - settling, frequency, etc..
09:34 AM LeoNerd: Slopws
09:34 AM LeoNerd: *Slopes
09:34 AM Cracki: eyes
09:34 AM LeoNerd: Get something nice like some FFTs in there and you can start doing spectrum analysis or harmonic distortion
09:35 AM LeoNerd: Rightnow I'd settle for some sort of frontend (doesn't have to be PV) that gives me a one-touch button to change the trigger source channel on the 1054
09:35 AM LeoNerd: Its internal menus are tediously long
09:35 AM Cracki: heh
09:35 AM LeoNerd: PV is great at *looking* at stuff, but I've not seen it make any inroads into control
09:35 AM Cracki: can it even be controlled from outside?
09:35 AM LeoNerd: Sure
09:36 AM LeoNerd: I can send a one line SCPI command to change it
09:36 AM Cracki: ah scpi
09:36 AM LeoNerd: It's just that PV isnt' built to be control. It's built to be an observer
09:36 AM Cracki: something like labview or simulink, but open source, might be good
09:36 AM LeoNerd: Yes
09:36 AM LeoNerd: I'm sortof working on such, but starting with the far simpler [in my mind anyway] goal of just controling bits of equipment I've made myself
09:37 AM LeoNerd: So then I don't have to fight with badly implemented control protocols or missing features
09:37 AM rue_house: I have a scope project
09:37 AM rue_house: I got a tektronics front end amp for it
09:37 AM rue_house: have a few adc's in a pile
09:38 AM rue_house: came up with a protocol
09:38 AM * rue_house looks at a large heap of paperwork
09:38 AM rue_house: might need to do that again tho
09:38 AM LeoNerd: Mmm.. Yah; I'm doing a few things, though mine are either digital, or low-frequency (maybe up to audio or 1MHz or somesuch) analog. So far I'm avoiding the HF analog end
09:38 AM Cracki: TPS sheets <3
09:38 AM LeoNerd: There be dragons, etc
09:39 AM rue_house: it'd be nice to even start off with just an avr adc
09:39 AM LeoNerd: *shudder* Those things are terrible
09:40 AM LeoNerd: There's a lot of switching residual in those
09:40 AM rue_house: most of the digital scope I need is for slow signals, like servo responce times
09:40 AM LeoNerd: Any time you change -any- setting, even the MUX, you have to make a reading and discard the result. Otherwise you get a lot of bleedthrough
09:41 AM LeoNerd: Even the MUX is affected, which means a multichannel scanner ends up being at least half if not worse as slow than you'd expect from a single channel
09:41 AM rue_house: I wonder how it compares to a serial adc
09:42 AM LeoNerd: The ADS1115 is my cheap ADC of choice for MCU work these days. 16 bit, 4 channels, every reading is instantly trustable even immediately after settings change
09:42 AM rue_house: price vs quality
09:43 AM LeoNerd: Eh; the 1115 is hardly expensive as ADCs go :P
09:44 AM rue_house: the cheapest is the tiny26 12 channels, 10 bit
09:44 AM rue_house: but like you say
09:46 AM rue_house: pretty close to 1ksps for a 16 bit adc...
09:49 AM MrCircuitMatt: LeoNerd: looks like I have to give PV another go. Last time I tried to use it as a replacement for OLS client and it was not stable at all :-(
09:49 AM rue_house: trickey way to get 4 addresses out of 1 pin
09:53 AM LeoNerd: I've seen some MCP chips do 8 with a flash ADC
09:53 AM LeoNerd: You put a resistor divider on it to set a voltage
09:55 AM rue_house: hmm
09:55 AM rue_house: actonary system
09:55 AM rue_house: octonary system
10:11 AM ayjay_t: hey so i was looking at this guide online for hacking a USBASP into an atxmega programmer, with patched programs and circuit diagrams and all
10:12 AM ayjay_t: but when i went through avr dude, it looks like avr dude had options for atxmega parts without being patched or anything
10:12 AM LeoNerd: xmega via the usbasp though?
10:12 AM ayjay_t: yeah that's right
10:12 AM LeoNerd: usbasp is *basically* just a (V-USB) attached SPI driver
10:13 AM ayjay_t: http://community.atmel.com/projects/atxmega-programmer-050
10:13 AM ayjay_t: he does some weird things
10:13 AM ayjay_t: i don't really understand how connecting sck to data would do anything good for anybody
10:14 AM LeoNerd: Ohdeargod that's...
10:14 AM * LeoNerd struggles to find words
10:14 AM ayjay_t: good enough?
10:14 AM ayjay_t: XD
10:15 AM LeoNerd: "Among the most fragile things I've ever seen"
10:15 AM LeoNerd: And this is me who wrote a NOP-threaded WS2812 driver merged with a DMX512 receiver
10:16 AM ayjay_t: so what do you think should i give it a try
10:16 AM ayjay_t: i just got my first usbasp, i have an xmega, and i havea n arduino
10:16 AM ayjay_t: so i'm going to try to program my asp with this arduino (which is actually a atmega xplained)
10:16 AM ayjay_t: and then program the atxmega which i haven't even assmebled yet with the asp
10:17 AM LeoNerd: I'd really suggest trying to do this with a 32U4 chip instead, to be honest
10:17 AM LeoNerd: Real hardware USB
10:17 AM LeoNerd: Then you've got ample CPU to be talking PDI properly
10:17 AM LeoNerd: The only reason the USBASP doesn't use it is that chip is literally much newer
10:17 AM ayjay_t: the 32U4?
10:17 AM LeoNerd: A modern design would use the 32U4 or even the older cheaper 32U2
10:18 AM ayjay_t: so i should buy a development board, programm with is usbasp, and then try to program the xmega with avrdude?
10:18 AM LeoNerd: I think the market definitely has a gap in it
10:18 AM LeoNerd: That gap is an open source software+hardware real (not V-) USB AVR programmer that can talk ISP and PDI
10:18 AM _ami_: ayjay_t: you could build your own avr programmer: https://hackaday.io/project/21189-fastusbasp-programmer-for-avr/
10:19 AM LeoNerd: And if you wanted to dedicate your attention somewhere, filling *that* gap would be well worth it
10:19 AM LeoNerd: I have the real USB pololu programmer, but that a) is ISP only, no PDI, b) doesn't power the target board, c) is PIC-based
10:19 AM LeoNerd: d) is commercial and not open software or hardware
10:19 AM ayjay_t: to be honest i'm more of an arm guy
10:20 AM ayjay_t: <_< >_>
10:20 AM LeoNerd: There's probably an ARM that'll do it just as well then
10:20 AM LeoNerd: Possibly overkill here
10:20 AM ayjay_t: well yeah, i have a couple next to me
10:20 AM ayjay_t: i can't remember if my cheapest has USBHS
10:20 AM LeoNerd: The nice part about building an AVR programming tool *using* an AVR is that the toolchains are going to be familiar to people
10:21 AM LeoNerd: Anyone needing an AVR programmer is likely familiar enough with the AVR ecosystem that they can modify and maintain their AVR-implemented tooling
10:21 AM LeoNerd: To me, a programmer built on PIC or ARM would be a blackbox
10:21 AM ayjay_t: yeah
10:21 AM _ami_: Well, its just the protocol. not much difference to me.
10:22 AM ayjay_t: wel i'm trying this asp thing first
10:22 AM ayjay_t: i'm a bit surprised i have to set stuff upt o update it though
10:22 AM ayjay_t: i figured it would use LUFA or something
10:22 AM ayjay_t: but then i guess it has software usb
10:24 AM ayjay_t: so do i have to make a programmer out of my arduino to update the usbasp?
10:24 AM LeoNerd: You can do if you've nothing else
10:24 AM LeoNerd: One suggestion: you *really* want to pull the firmware image off the chip before writing a new one on
10:24 AM LeoNerd: Just in case the new one doesn't work there (like mine didn't)
10:24 AM ayjay_t: oh in case i break it eh
10:25 AM ayjay_t: its one of those chinese usbasp made for quadcopters
10:26 AM _ami_: meh, i never had much problem with usbasp. works better than those chinese ch340g serial chips :P
10:26 AM LeoNerd: Actually looking at the hardware requirements, I wonder if an FT232H-based PDI programmer would be nicer
10:26 AM LeoNerd: The FT232H is really quite a nice chip
10:27 AM LeoNerd: _ami_: it depends verymuch on the computer end. There are USB hubs, root ports, entire operating systems that just don't work with V-USB
10:27 AM LeoNerd: My usbasp does not work via -any- hub I own, it has to go in the root port on the laptop directly
10:27 AM LeoNerd: I also know of (mostly Windows) people who say it plain does not work on their laptop at all
10:28 AM _ami_: LeoNerd: worked for me on hub as well.
10:28 AM LeoNerd: I think Windows is a bit picker about adherence to spec. V-USB has to break spec in various places to make it work at all
10:28 AM _ami_: but mine is not from china.
10:28 AM LeoNerd: Yah; probably depends on the hub
10:28 AM _ami_: i bought it from a reputed indian robotics shop.
10:33 AM _ami_: LeoNerd: the funny thing is that the same hub which detects usbasp programmer without any problem does not detect ch340g interface boards :P
10:34 AM LeoNerd: Yah; possibly both are out of spec and just trigger, or not, various cornercases in hub implementations
10:34 AM _ami_: e.g. lolin board (nodemcu v3) does not get detect on that usb hub.
10:34 AM _ami_: may be! :)
10:37 AM _ami_: LeoNerd: recently i made a usb to 2 serials device using stm32f103. good alternative to any other USB to serial
10:37 AM _ami_: it uses cdc acm spec
10:38 AM _ami_: so driver is not needed and on connection to PC, it exposes two ACM ports.
10:38 AM _ami_: /dev/ttyACM0/1
10:39 AM _ami_: it can also be used to program AVRs surely.
10:39 AM LeoNerd: Cute
10:39 AM LeoNerd: Yah; the pololu device exposes a UART as well
10:39 AM LeoNerd: Can be handy. AVR programming + serial console in one USB device
10:39 AM _ami_: yes, indeed.
10:39 AM _ami_: that was the idea behind this project.
10:39 AM LeoNerd: Just a shame it doesn't do power
10:40 AM LeoNerd: I think the v2 version might
10:40 AM _ami_: will make it opensource soon.
10:40 AM LeoNerd: I have the v1. Not only doesn't it supply power, but it also doesn't work properly with 3.3V targets, only 5V :/
10:40 AM _ami_: LeoNerd: blue pill has 5v pin
10:40 AM _ami_: can power it.
10:40 AM _ami_: can power other devices
10:41 AM _ami_: and expect ADC pins on stm32f103, other pins are 5v tolerant
10:41 AM LeoNerd: I have one of those $4 STM32F103 boards. Yet to really know what to do with it
10:41 AM LeoNerd: Or how to start
10:44 AM _ami_: LeoNerd: u have blue pill or other version of it?
10:45 AM _ami_: blue pill is <2$
10:45 AM LeoNerd: Not heard of it. Also that's a terrible name to google for ;)
10:45 AM _ami_: may be you bought it long time back
10:45 AM _ami_: lol
10:45 AM avrdude: ayjay_t: use avrdude
10:45 AM LeoNerd: avrdude: you're biased :P
10:45 AM avrdude: no way.. (a)
10:45 AM _ami_: ayjay_t: just because avrdude says :)
10:46 AM ayjay_t: avrdude, isn't... isn't avrdude just software
10:46 AM ayjay_t: i gotta admit, the pwm fading heartbeat on the arduinoisp is pretty cool
10:46 AM ayjay_t: just got that set up, now i need to see how to pull the firmware off this asp
10:47 AM _ami_: LeoNerd: http://amitesh-singh.github.io/stm32/2017/04/09/setting-stm32-dev-environment-arch-linux.html -> you could refer this guide to kickstart your stm32 journey
10:47 AM _ami_: LeoNerd: blue pill -> https://www.aliexpress.com/item/Arm-cortex-m3-stm32f103c8t6-stm32-core-board-development-board/1539984258.html
10:48 AM ayjay_t: the references on this usbasp are difference though, is jp1 what jp2 used to be?
10:50 AM LeoNerd: _ami_: Oh thatboard, yes I have one
10:50 AM _ami_: then you got blue pill :D
10:51 AM LeoNerd: OK
10:51 AM LeoNerd: Ah, is it not USB-programmable?
10:52 AM _ami_: LeoNerd: well, you can use any usb to serial module to flash it.
10:52 AM _ami_: it has a tiny serial bootloader running
10:53 AM LeoNerd: Those are two contradictory statements
10:53 AM LeoNerd: Can it be programmed by installing some amount of software on my laptop and then connecting *only* a USB cable to the board?
10:53 AM _ami_: you would need stm32flash utility on linux
10:53 AM LeoNerd: That's software
10:53 AM ayjay_t: lol the make file error is a bunch of "you need const to have in progmem" ;-P
10:53 AM _ami_: Install stm32flash utility on linux. Connect any usb to uart converter device and connect PA9 to RXD and PA10 to TXD and connect GND.
10:53 AM LeoNerd: Since I'm only playing with "do I like this?", I don't want to buy any physical pieces of hardware to play with it yet
10:54 AM LeoNerd: But installing software out of debian is fine
10:54 AM LeoNerd: Oh. So it's programed over UART and not its own USB connector?
10:54 AM _ami_: you can program it via usb too but you need a bootloader.
10:55 AM NoHitWonder: they have serial bootloader built in
10:55 AM LeoNerd: That's what I thought the boot jumpers were for
10:55 AM LeoNerd: To activate it
10:55 AM _ami_: NoHitWonder: yeah, thats what i told to LeoNerd. but he is like.. meh!
10:55 AM LeoNerd: You probably didn't say it clearly enough then
10:55 AM ayjay_t: wait how did you guys get into stm?
10:56 AM LeoNerd: You said two contradictory statements
10:56 AM ayjay_t: i thought this was an avr channel
10:56 AM LeoNerd: 1) it has a USB serial bootloader, 2) you have to connect an external USB-UART bridge to its UART pins.
10:56 AM LeoNerd: Surely if 1 was true you wouldn't need 2
10:56 AM NoHitWonder: this is an electronics/embedded channel
10:56 AM _ami_: btw, someone from stm32duino community wrote a usb dfu bootloader
10:56 AM Emil: _ami_: been around a long time
10:57 AM LeoNerd: Compare to: the ATmega32U4 - that one can always be programmed over USB
10:57 AM _ami_: LUFA is ugly!
10:57 AM _ami_: i tried it and its ugly to use
10:57 AM _ami_: that was the main reason for me to not use m32u4
10:58 AM LeoNerd: Perhaps. But it's also blackbox, installed, and reliably works :)
10:58 AM ayjay_t: jeez irc is a wild place
11:01 AM _ami_: LeoNerd: if someone sells stm32f103 board with usb bootloader installed, i could say the same thing which you just said abt m32u4 being programmed over usb. :)
11:02 AM LeoNerd: Right
11:02 AM LeoNerd: So then my question I suppose becomes: is this board likely to already have that?
11:02 AM LeoNerd: Or an easy way I can tell?
11:02 AM _ami_: No, it does not have.
11:02 AM LeoNerd: Ah boo :/
11:02 AM _ami_: you would need to install usb bootloader if u want to program via usb :)
11:03 AM _ami_: LeoNerd: come on.. its 1.6$ price board :)
11:03 AM LeoNerd: So is that bootloader installable over UART?
11:03 AM _ami_: Yes, ofcourse
11:03 AM LeoNerd: OK. So, progress
11:05 AM ayjay_t: whats the command to download firmware?
11:05 AM LeoNerd: ?
11:05 AM _ami_: ayjay_t: open browser and type google.com and then write your query
11:05 AM ayjay_t: THANKS SO NICE OF YOU _ami_
11:06 AM LeoNerd: vague question is vague
11:06 AM ayjay_t: you must be a poplar
11:06 AM _ami_: i think google would know whats in your mind without typing :)
11:06 AM LeoNerd: Give more details. More words. What are you doing?
11:06 AM ayjay_t: sorry i was just remember what... you said about backing up the usbasp
11:06 AM LeoNerd: Ohright; reading out from an AVR chip?
11:06 AM LeoNerd: That'll be one of the avrdude modes
11:06 AM _ami_: avrdude --help
11:06 AM LeoNerd: r: most likely
11:07 AM ayjay_t: so flash:r:output:i
11:07 AM _ami_: sudo avrdude -c usbasp-clone -p m16 -U flash:r:flash.bin:r
11:07 AM _ami_: it was for my programmer
11:07 AM _ami_: though
11:08 AM ayjay_t: yeah whats the r tho?
11:08 AM LeoNerd: ... why are you sudo'ing that?
11:08 AM LeoNerd: read
11:08 AM ayjay_t: because _ami_ has bad udev rules duh
11:08 AM LeoNerd: As opposed to w: for write or v: for verify
11:08 AM LeoNerd: as I'm sure the manpage explains
11:08 AM ayjay_t: no the last r
11:08 AM _ami_: ah, i just copied from my website link
11:08 AM _ami_: not typed it.. its for people who does not have udev rules.
11:08 AM ayjay_t: i see the first r, but ladyada says to use i at the end
11:08 AM _ami_: ayjay_t: dude, i have patches in linux kernel
11:09 AM ayjay_t: well why the hell are your udev rules so bad then
11:09 AM ayjay_t: ;-)
11:09 AM _ami_: LeoNerd: copied from http://amitesh-singh.github.io/stm32/2017/05/21/FASTUSBasp-programmer-avr.html
11:09 AM _ami_: look at what i said earlier
11:09 AM LeoNerd: The :i at the end sets the output format; in this case Intel hex I believe
11:10 AM ayjay_t: yeahhh that i like but i was wondering what the r was instead
11:10 AM _ami_: its for dumb people who does not know what the fuck is /dev/* thingy
11:10 AM LeoNerd: Oh the second :r at the end? Some other output format I expect
11:10 AM LeoNerd: I'd use :i
11:10 AM ayjay_t: so _ami_ which driver did you work on?
11:10 AM * LeoNerd would read man avrdude but can't be bothered; it's your question, you read it
11:11 AM _ami_: gonna sleep
11:11 AM _ami_: 12.40 am! here
11:11 AM _ami_: nn
11:12 AM ayjay_t: no wait tell me so i can disconfigure it
11:12 AM ayjay_t: :-P
11:12 AM ayjay_t: just kidding
11:43 AM ayjay_t: :-(
11:55 AM antto: 12:40AM? that's a weird thing to say
12:06 PM ayjay_t: well now the usbasp is at least giving back a device signature, although it's not the one its supposed to be
12:12 PM ayjay_t: oh wow those verbose flags help a lot
12:12 PM ayjay_t: and so did baud!
12:13 PM ayjay_t: weird it pulls a bunch of information from the ASP, like what chip it is, but it mixes the verbose output in with a bunch of sync errors at the same time
12:13 PM ayjay_t: i dont really understand how it could be pulling in info and yet having sync errors- which my understanding is a programmer error, not a target error
12:52 PM ayjay_t: this is SO finicky, i can't figure out how i fixed it i just moved it around a bit and now it works /shrug
12:57 PM Emil: _ami_ stop. with. the. am/pm. bullshit
12:58 PM Casper: ???
12:58 PM Casper: unless I missed something, what's wrong with am/pm?
12:59 PM antto: what's 12:40AM exactly?
12:59 PM antto: is it 00:40PM?
01:00 PM antto: 40 minutes past noon?
01:01 PM Emil: Casper: surely you are joking, Mr.?
01:02 PM Emil: AM/PM is the cancer that is ruining this earth
01:03 PM LeoNerd: Give me ISO8601 or give me death
01:03 PM Emil: That standard is stupid, also
01:03 PM antto: it's 20:29 right now here.. see how simple that is?
01:03 PM Emil: using T as a separator all my wot
01:03 PM LeoNerd: Eh, it's not so bad. I dislike it because it doesn't strictly allow YYYY/MM/DD as a day separator though
01:03 PM DKordic: :) There is an XKCD about ISO8601.
01:04 PM antto: shouldn't it be YYYY-MM-DD ?
01:05 PM Emil: The standard is YYYY-MM-DDTHH:MM:SS with some additional
01:05 PM Emil: possibilities
01:05 PM LeoNerd: Yes; it doesn't really like / as a separator, only -. But I quite like /
01:06 PM Emil: Personally, I'm okay with any sensible separator as long as the data is in a good order
01:06 PM antto: yeah, not scrambled like MMDDYY x_x
01:07 PM Emil: yup
01:07 PM LeoNerd: My response to people writing such silly dates is to write times in HH:SS:MM
01:07 PM Emil: also am/pm cancer must go
01:07 PM Casper: Emil: then you will say that the earth is flat?
01:07 PM Emil: LeoNerd: lol
01:07 PM DKordic: Hi sebbish :) .
01:07 PM sebbish: hello
01:07 PM Emil: Casper: wot
01:08 PM antto: Casper it's made out of many flat polygons ;P~
01:09 PM Casper: anyone happend to know gnuplot well?
01:09 PM sebbish: Q: what´s the best approch to meausure frequency ? on a pin... i´ve set up an interrupt on my pin PCINT8... and the interrupt works, but should i do the calculations in the interrupt or outside? ..
01:09 PM Emil: sebbish: freq?
01:09 PM Emil: sebbish: ICP
01:10 PM Emil: ICP is love, ICP is life
01:10 PM sebbish: icp?
01:10 PM Emil: Input capture
01:10 PM sebbish: ;)
01:10 PM Casper: sebbish: good practice is to do as little as possible in the interrupt, so good practice is outside. HOWEVER, if you have time to spare and accept the risk of missing interrupt, then you can do it in the interrupt
01:10 PM sebbish: okey...
01:10 PM Casper: remember that division is extremelly slow
01:11 PM Emil: sebbish: matey
01:11 PM Emil: sebbish: first of all, why are you using PCINT and not INT?
01:11 PM sebbish: okey... i will have an pulse from 600hz to 1500hz...
01:11 PM Emil: And secondly use ICP
01:11 PM sebbish: because it´s taken ;)
01:11 PM sebbish: i use all the pins... this request came late, and the pcb is already made..
01:11 PM Emil: And third, don't unnecessarily change your base with calculations.
01:12 PM Emil: You get a cycle count: keep it in the cycle count
01:12 PM Emil: Only when you need to print to a screen that you also control with the same device change the base
01:13 PM Emil: If you push to a computer let the computer do the calculations, also
01:14 PM Emil: If you know your environment and you don't get random events that require immediate addressing then it doesn't matter if you do the calculations in the ISR or outside
01:15 PM sebbish: okey... it´s an rpm feedback, at 1200rpm the freq is 640hz and at 3800rpm the freq is 1470ish.... but i have been trying to get the period between two rising edges, but it´s been a mess... ( googleing ICP ;))
01:16 PM Emil: What device?
01:16 PM LeoNerd: Rather than google, why not search in the datasheet for your part
01:16 PM Emil: 328p?
01:16 PM Emil: also what LeoNerd just said
01:17 PM sebbish: yes... 328au
01:17 PM Emil: 328p-au?
01:17 PM sebbish: yepp
01:17 PM Emil: Is PB0 taken?
01:18 PM LeoNerd: Mmm... the 328P. My second-favourite AVR chip
01:18 PM sebbish: yes... all the pins are taken ;)
01:18 PM Emil: LeoNerd: what's your favourite?
01:18 PM LeoNerd: 328PB :)
01:18 PM sebbish: it´s packed ;)
01:18 PM Emil: LeoNerd: lol
01:18 PM LeoNerd: Two UARTs, mmmm
01:18 PM Emil: LeoNerd: absolutely true
01:19 PM LeoNerd: Also two SPI and two I²C, making it possible (and desirable) for me to do the generic isolated board
01:20 PM Emil: sebbish: set up timer, set up pcint, whenever you get a trigger record timer value and zero the timer. Shift left once to get the actual hz since you are triggering on any edge (pcint doesn't allow anything else)
01:21 PM Emil: s/hz/T
01:21 PM Emil: period*
01:21 PM LeoNerd: Is the duty cycle definitely exactly 50%? What I'd do is keep an odd/even counter, and capture every *other* transition
01:21 PM sebbish: okey... but if i read the pin inside the ISR, then i get the rising edge ? right?
01:21 PM LeoNerd: Thne it doesn't matter what the duty cycle is
01:21 PM Emil: LeoNerd: good point
01:21 PM LeoNerd: (or maybe capture/zero on both edges and add two results; better for overflow prevention)
01:22 PM sebbish: no the duty cycle is not 50% all the time...
01:22 PM Emil: Then you need to skip every other interrupt
01:22 PM Emil: easily done with a static variable
01:22 PM Emil: like LeoNerd said
01:23 PM Emil: sebbish: why would you read a pin?
01:23 PM Emil: that's unnecessary
01:23 PM enh: " Fujipoly® introduces a new thermal interface material that also absorbs a wide range of unwanted electromagnetic energy. The tacky, gel-like consistency of Sarcon® EGR-11F makes it easy to handle and apply without requiring additional adhesive. "
01:24 PM LeoNerd: Depending on the sensor technology, you might also want to ignore the interrupt if the count is smaller than some value, to filter out bouncing
01:24 PM enh: I wonder which part of the spectrum it absorbs. Can it make a plane invisible to radar?
01:24 PM sebbish: to get the rising edge.... in the isr, when it is triggered, i read the pin, if it´s high then it´s a rising edge ? or am i thinking wrong ?'
01:24 PM Emil: sebbish: you don't need to select between the edges
01:25 PM Emil: either one is okay
01:25 PM Emil: rising or falling
01:25 PM Emil: hmm
01:25 PM Emil: but actually it's faster to select based on the edge
01:25 PM Emil: instead of having a static
01:25 PM Emil: yeah do that instead of having a state machine
01:25 PM LeoNerd: Mmm true
01:25 PM sebbish: hmm... but if i get the rising edge of a pulse and the falling edge of the same then i won´t be able to measure the period ?
01:27 PM Emil: sebbish: with state machine you skip every other cycle
01:27 PM Emil: but determining it with the pin value is best
01:28 PM JanC_ is now known as JanC
01:30 PM Emil: ISR(PCINTy_vect){if(PINx&MASK){global_period=TCNTx; TCNTx=0;}}
01:30 PM Emil: s/TCNTx/TCNTz/
01:30 PM sebbish: so, if i get an interrupt, i read the pin, if it´s high, i´ll take the time... then i wait for the next interrupt and do the same thing store the second time in another variable... then do the math ? What´s the best way to do this let´s say every 500ms... use a time ?
01:31 PM LeoNerd: You don't want to meaasure the time between one edge and the opposite.
01:31 PM LeoNerd: You want to measure the time between one edge and the *same* edge the next time
01:31 PM LeoNerd: Otherwise you're only measureing half of it, and duty cycle will affect you
01:31 PM LeoNerd: E.g. between two risings, or two fallings. Doesn't matter which pair, as long as consistent
01:31 PM Emil: That spipped above does it for you
01:31 PM Emil: snippet*
01:32 PM sebbish: yeah...i get that, but if i check if the pin is high in the ISR, then i get only the rising edges?... Emil i will check that
01:32 PM Emil: ...
01:32 PM Emil: Yes you wanted only the rising edges
01:32 PM Emil: or if falling then just !(PINx&MASK)
01:35 PM sebbish: that´s acually exactly what i´m doing right now... but i think i´ve got it wrong whit the timer... need to look in to how i´ve set it up.
01:35 PM sebbish: with
01:35 PM Emil: You want to also trigger on overflow
01:35 PM Emil: so that you know you've overflown
01:35 PM LeoNerd: You may need to capture a bigger count for overflow
01:35 PM LeoNerd: ... what Emil said, basically
01:36 PM Emil: If you need bigger resolution then you can do that with software counting the overflows
01:36 PM Emil: But I'd just addjust the divisor
01:37 PM sebbish: i need the freq to be updated every 500ms... no more than that.
01:37 PM Emil: Wellthen setup a task that calculates the freq for you every 500ms
01:37 PM Emil: You can do the required math every 500ms
01:38 PM Emil: actually
01:38 PM Emil: You can keep an internal counter
01:38 PM Emil: and everytime you get a cycle subtract the time from that counter
01:38 PM Emil: that way you don't need to do much and it just works
01:38 PM Emil: (it's not exaclty 500ms then but that does't matter)
01:40 PM sebbish: okey, perfect.... here´s the board if you guys are intrested. http://wagonpack.com/board.jpg
01:40 PM Emil: whatchaneed that huge cap for
01:40 PM polprog: nice
01:41 PM Emil: your site is broken as fuq
01:41 PM polprog: Emil: i think some super filtration, next to it there's an LDO (?) and an huge smd inductor
01:41 PM Emil: filtering*
01:41 PM sebbish: i didn´t get the right one... i have another cap on the second board... ii lower one..
01:41 PM polprog: yes filtering
01:42 PM polprog: *
01:42 PM Emil: filtration is conceptually same but for different thing
01:42 PM sebbish: yes.... but´s a 100uF...
01:42 PM Emil: sebbish: whatcha need that much capacitance for?
01:42 PM sebbish: i have big surge from the vin rail
01:42 PM Emil: eh?
01:44 PM Emil: If your VIN rail is dirty I'd just use a diode and a cap
01:45 PM Emil: inductors as vcc filters are annoying af because you must always calculate the values or it might oscillate or have super annoying voltage spikes
01:46 PM Emil: Sure it gives a sort of a soft start
01:47 PM polprog: i heard a funny anecdote about a bodged on inductor crapping out a satellite subsystem
01:47 PM polprog: very interesting story
01:47 PM Emil: share it with us bro
01:48 PM Emil: Sounds like Aalto-2
01:48 PM polprog: another satelite
01:49 PM sebbish: it´s not an inductor... it´s a VDR
01:49 PM polprog: a couple of people were developing an instrument to be mounted on a satellite
01:50 PM Emil: sebbish: the heck do you need a VDR for? don't say as a fucking polyfuse :DD
01:50 PM polprog: i dont really remember waht it was, some 20-odd GHz multi-band spectrometer i believe
01:51 PM polprog: sometime partway through the integration process (when all the teams send out prototypes to be mounted on a prototype satellite, to check if everything's allright), they noticed their instrument was injecting noise into the power rails of the sat
01:52 PM polprog: it's a big problem since this can make other instruments malfunction, and you cant really send out a field tech to fix a satellite
01:53 PM polprog: Another team suggested they put some inductance on the power input
01:53 PM Emil: lol, idiots designing their circuits without adequate filtering, trusting that the vcc is always same ("It simulated just fine!!!11!1!"
01:53 PM Emil: )
01:53 PM sebbish: the board will be controlling 2 big motors... 2-3A @ 13V....
01:53 PM polprog: that worked and long story short the satellite launched
01:54 PM Emil: polprog: but then it stopped working inorbit?
01:54 PM polprog: as you may or may not know, nearly every instrument on a satellite has a cold spare, shut down and connected to another set of power rails
01:54 PM polprog: Emil: lemme finish ;)
01:54 PM polprog: you're right, all of a sudden the instrument ceased to operate
01:55 PM polprog: luckily they had a cold spare but they werent going to enable it until they knew what killed the first unit
01:56 PM polprog: for several months they were examining the schematics, docs, code etc.
01:56 PM Emil: At that moment I'd just blame bad luck instead of exposing myself
01:58 PM polprog: the found that a programmer left some test code that shuts all the subsystems at once. usually the susbsystems are brought up and down in a sequence, and it takes about 20 minutes to shut everything down.
01:58 PM Emil: lolwat
01:58 PM polprog: the programmer left the subroutine so he could call it while testing on ground. they finished the tests way before they mounted that inductance though. and the subroutine was never called in "production" code
01:59 PM polprog: but it was there, residing in the ROM
01:59 PM polprog: it turned out, a charged particle has ripped through the rad-hard silicon, flipping a single bit in the JUMP instruction
02:00 PM Emil: I callbullshit
02:00 PM Emil: that's exactly the kind of bad luck they'd blame
02:00 PM polprog: and the CPU faithfully jumped and executed the immediate power cut procedure
02:00 PM Emil: "Idid nothing wrong! Okay this function is there but it's never called! It's just bad luck!"
02:00 PM Emil: "I guess we can never know"
02:00 PM polprog: they removed the subroutine and reflashed the rom
02:01 PM polprog: then they borught up the spare and it worked till the end of a mission
02:01 PM Emil: You know how I can tell it's bullshit
02:01 PM Emil: because if a charged particle managed to flip a bit then a) fixing the code matters not since it's just bad luck
02:02 PM Emil: and b) if it happens often your entire satellite is already shit
02:02 PM polprog: they removed the actual subroutine
02:02 PM Emil: and c) and you should experience jumps all the time
02:02 PM Emil: polprog: a jump can jump anywhere
02:02 PM polprog: well that was just bad luck then
02:02 PM Emil: yes
02:02 PM Emil: exactly the kind of story they'd make up
02:02 PM Emil: for execs
02:03 PM Emil: But still
02:03 PM Emil: that's a cool story
02:03 PM Emil: and teaches us to never add bodge shit if it's already expensive
02:03 PM Emil: just order a spare
02:03 PM polprog: the whole space electronics is cool
02:03 PM Emil: with a new design
02:04 PM polprog: ever wanted a CPU with each register tripled in HW?
02:04 PM Emil: They probably require some poropietari compiler and tools
02:04 PM Emil: if I can't easily sell them I do jack shit with them :D
02:05 PM Emil: If they accept FOSS tools then sure
02:05 PM Emil: sounds interesting
02:05 PM polprog: it says here it's a GPL design unless you want to send it to space in a commercial product: https://en.wikipedia.org/wiki/LEON
02:05 PM polprog: and you can implement it on an FPGA
02:05 PM Emil: sebbish: okay, then that cap size is approved
02:08 PM sebbish: lol... thanks ;)
02:09 PM Emil: polprog: mindless noise but fun to listen to: https://www.youtube.com/watch?v=fIgm6lxvUfQ
02:11 PM polprog: dear lord
02:12 PM polprog: you know Kraftwerk?
02:17 PM Emil: "heard" but not heard
02:17 PM polprog: they are cool
02:25 PM polprog: Emil: something like your ascii art drawings on the avr beginner guide https://github.com/hsoft/icemu
02:30 PM polprog: i had a dead pci NIC.
02:30 PM polprog: pullled the socket, some led indicator and a 1k spi flash
02:55 PM astor: How do I go about finding a good wifi controller, need lower power, medium range (200ft) and ability to broadcast and connect.
03:01 PM polprog: Emil: https://www.youtube.com/watch?v=okhQtoQFG5s
03:11 PM Emil: polprog: except mine's better ;)
03:11 PM Emil: astor: esp8266
03:11 PM Emil: astor: that's the cheapest and easiest option
03:12 PM Emil: or esp32
03:13 PM Emil: polprog: that looks pretty cool
03:13 PM Emil: s/better/prettier
03:17 PM Emil: polprog: also, ah Kraftwerk, yeah I had heard and listened to some of their work
03:17 PM Emil: But it's too industrial and harsh
03:24 PM polprog: Emil: more into trance?
03:34 PM avrdude: uhm, they seldom have cold spares for entire instruments, thats way too costly both in mass/space/cost budget
03:34 PM polprog: i didnt mean they put two separate instruments, just two separate mainboards
03:39 PM mudkip908_ is now known as mudkip908
04:45 PM day__ is now known as daey
11:36 PM day__ is now known as daey