#avr Logs

Sep 24 2017

#avr Calendar

12:21 AM day__ is now known as daey
05:15 AM polprog: wow, myrouter is so old, it's mac adress starts with 00
05:16 AM remkooo1 is now known as remkooo
05:20 AM remkooo1 is now known as remkooo
07:20 AM Lambda_Aurigae: maybe McDonalds should branch out into the IT world...start making routers with BigMac addresses!
07:21 AM cehteh: DoubleWhopper instead Dual Stack? :)
07:21 AM Lambda_Aurigae: and the Fry Guys can do cable installs!
07:22 AM Lambda_Aurigae: and instead of calling people pirates for copying digital content we can call them Hamburglers!
07:56 AM JanC is now known as Guest52516
07:56 AM JanC_ is now known as JanC
08:12 AM polprog: Hamburglers lol
08:13 AM polprog: ill have two NASs, a large NAS, a switch with extra ports, ...
08:22 AM polprog: Emil: your youtube videos are getting more abstract with each new one
08:42 AM Emil: Noooo
08:42 AM Emil: Lies
08:42 AM polprog: also that subtle mtn dew bottle on the floor
08:42 AM polprog: lol
08:43 AM Emil: :DD
08:46 AM polprog: im thinking about that debugger setup i had yesterday
08:46 AM polprog: the only thing ddd couldnt do properly was it messed up the pointers
08:48 AM polprog: some reason it offset everything by 0x80000 and read the wrong part of memory, or whatever else happened there, but the memory dump's contents where the pointer pointed, didnt match with the actual value
08:48 AM polprog: but i can edit the variable values during runtime ;)
08:48 AM polprog: that means i can put ifs that would never execute unless i "trigger" them
08:48 AM polprog: hehe
10:14 AM enh: hi
10:16 AM polprog: afternoon
11:53 AM enh: Did you see the link I posted yesterday? Lots of useful resources in it. https://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf
11:53 AM enh: integer math code in the end
11:54 AM * LeoNerd was looking at log functions in integer maths the other day
11:54 AM LeoNerd: For my voltmeter I want to do relative measurements in dB, for which I need a 20 * log10(x) function
11:54 AM LeoNerd: Easy enough to make out of a table lookup as it turns out
11:57 AM Cracki: dB for sound is 20*
11:57 AM Cracki: because amplitude^2 is power
11:57 AM LeoNerd: Voltage too
11:57 AM LeoNerd: 1V to 10V => 20dB gain
11:57 AM Cracki: amplitude is voltage, but if you just wanna measure voltage, db is 10
11:58 AM Cracki: sound pressure level is power (current * voltage, and current ~ voltage at a resistor), that's why the square
11:58 AM Cracki: I better scroll up and read the context :P
11:58 AM Cracki: ah integer log
11:59 AM Cracki: count the bits and mul by constant factor
11:59 AM LeoNerd: No, not integer. I do want the full version
11:59 AM LeoNerd: It's more about doing it without noninteger maths, so everything is scaled
11:59 AM LeoNerd: to run on an AVR nicely
12:00 PM LeoNerd: If you have floats and multiplication but not a log function, it's easy to build a log function by repeated adjustment
12:00 PM Cracki: how fast? single floats on avr are good enough. a few hundred instructions for most ops
12:00 PM Cracki: or less
12:00 PM LeoNerd: If you don't have floats, you can basically make do with scaled integers
12:00 PM LeoNerd: since I know the limits of my measurement hardware I know how wide I have to deal with
12:01 PM Cracki: yes I've seen something that initializes using the exponent of the float, then iterates a few times
12:04 PM LeoNerd: Yah; the algorithm works by maintaining an invariant of A + log(K) starting with A=0 and K=x, and iteratively adding values to A while dividing k down.. or something. I forget quite the exact detail
12:04 PM LeoNerd: But since it's all just looked up in a table, you can precompute other functions like 20log(x) by just multiplying the table constants by 20 :)
12:06 PM LeoNerd: I can do it all in fairly simple scaled integers also, by noting that my actual function I want to compute is 20log(V/Vref) so I can pre-scale the ratio by repeatedly multiplying one or other voltage reading by 10 and adding/subtracting a result offset of 20dB, until the ratio is in the range 1 .. 10. Then my lookup table doesn't have to consider values outside of that
12:07 PM Cracki: what are you measuring anyway that's represented as voltage?
12:07 PM LeoNerd: It's literally just a bench voltmeter
12:08 PM LeoNerd: https://twitter.com/cpan_pevans/status/888534394859925504
12:08 PM LeoNerd: am adding a 'rel' mode button
12:08 PM LeoNerd: So I can display a relative reading either in +/- voltage offset, or percentage or dB ratio
12:09 PM enh: LeoNerd: These things cost thousands of dollars if we need them on a lab
12:09 PM LeoNerd: I'm not sure about "thousands".. a few hundreds maybe? Depends on the accuracy I suppose
12:11 PM enh: One thing that is much needed, but only produced by a few companies is an AC resistance bridge to measure tiny resistances with even tinier currents. They are used to measure sample resistivity in ultra low temperature measurements. If the current is not picoamps, the measurement warms up the entire system
12:11 PM LeoNerd: Hmm...
12:11 PM LeoNerd: Sounds cute, but not quite in the realm of what I usually do
12:12 PM LeoNerd: nanovolts
12:13 PM LeoNerd: Why does it need to be AC anyway
12:13 PM LeoNerd: ?
12:13 PM enh: Low temp labs pay like 10000 dollars for an AC bridge like the LakeShore LS370
12:14 PM LeoNerd: Yah that's not at all the realm I'm working in. :) I'm trying to work in the gap between your average $20 to $50 handheld cheap DVM, and your $1000 Keithley
12:14 PM enh: because DC measurements introduce some undesireable effect in the measurement, which i do not remember about
12:15 PM LeoNerd: Ion migration?
12:16 PM LeoNerd: It pisses me off no end to see all the "DIY soil moisture meter" Arduino projects that do DC measurements
12:16 PM enh: the companies charge a lot for these devices. And some (european, french) companies even tie the thing with LabView, turning it into an useless brick some very unfortunate times. I hate labview, by the way. Made my own set of control and acquisition software all for linux
12:16 PM LeoNerd: That's going to totally electroplate and ruin your sensor in months at best
12:17 PM enh: another great market is to calibrate ultra low temperature sensors. A calibrated sensor for mK range costs hundreds of dollars.
12:18 PM enh: a great source of revenue if you have a dilution refrigerator.
12:18 PM LeoNerd: Heh.. Again I feel you're aiming in a totally different market direction to me ;)
12:18 PM enh: or a few litres of He3 around
12:18 PM enh: Sorry.
12:18 PM enh: Maybe someone here wants to earn some money from science
12:19 PM LeoNerd: The sorts of things I'm making, if someone asks "What does it do that my Keithley doesn't?" my answer is "If you actually own a Keithley, then nothing ;)"
12:19 PM enh: If I knew how to, I would design an AC bridge for those labs.
12:20 PM enh: Or a lock-in amplifier
12:20 PM enh: avr based
12:21 PM LeoNerd: What I'm currently doing is making "building-block" equipment. The sorts of pieces that are kinda useful on their own, but really start to show their worth when you have a few of them connected together on a PC or something
12:21 PM LeoNerd: E.g. if you have a voltmeter, great. If you have a current source, great. If you have a voltmeter and a current source, well now you have a DC resistance meter
12:22 PM LeoNerd: If you have a smoothing filter and a signal generator, well now you have a scalar network analyser
12:22 PM enh: Modular thinking. Good.
12:22 PM LeoNerd: Add a fast enough voltmeter and suddenly you have a VNA. Give it simultaneous voltage+current detection and now you've an AC LCR meter
12:23 PM LeoNerd: Plus I reckon I could make an audio-frequency VNA for.. probably under $200
12:23 PM enh: I like modular stuff. Legolab
12:23 PM LeoNerd: Mhmm :)
12:23 PM enh: Hundreds of labs around the world would benefit from affordable science intruments
12:24 PM LeoNerd: Lego is undoubtedly the very best present you can give to a young proto-engineer
12:24 PM LeoNerd: Proper Lego, though. The kind that doesn't come with instructions, just pictures of suggestion
12:30 PM LeoNerd: Actually one thing I would like is an AC electronic load. Something that goes up to maybe a couple of MHz or so
12:30 PM LeoNerd: I may just have to build it myself again though
01:00 PM Tom_itx is now known as Tom_L
01:00 PM polprog: cool project
01:26 PM Emil: Hmm
01:26 PM Emil: I should also make a voltmeter
01:26 PM Emil: but so that it's floating and differential
01:31 PM cambazz: hello. i need to compile code with avr-gcc, and upload it into atiny85
01:31 PM cambazz: basically I want to compile this https://github.com/usedbytes/neopixel_i2c
01:32 PM cambazz: do i need a special programmer? i have the 8 pin atiny85 chip
01:32 PM cambazz: as well as a digispark module
01:35 PM Cracki: what is a digispark module?
01:36 PM cambazz: it has a atiny85 and usb connectivity, with no extra chip. one second i will find the link
01:37 PM Cracki: ah, builtin usb
01:37 PM Cracki: so you'll probably want to use the arduino IDE... or plain avrdude to talk to the board
01:37 PM Cracki: not sure what the protocol is, perhaps stk500 or stk500v2 or something like that
01:38 PM cambazz: well, i guess arduino is out of the question, since the digispark software is old.
01:38 PM cambazz: lets say i just have the 8pin atiny85
01:38 PM cambazz: how can i compile and upload this code at github
01:39 PM cambazz: will i need a special programmer or a regular ftdi will do it
01:39 PM cambazz: i am on ubuntu, and installing avr-gcc and avr libs and stuff now
01:39 PM Cracki: if the tiny85 is on a board, you'll need to respect the electrical hookup
01:39 PM Cracki: I'm trying to see what this digispark thing has for a bootloader
01:39 PM Cracki: likely something avrdude-compatible
01:40 PM Cracki: so serial connection (usb com port of the digispark module) should be enough
01:41 PM cambazz: ok, i will try in a second. just installing the tool chain
01:42 PM Cracki: ugh the bootloader on that digispark module is called "micronucleus"
01:42 PM Cracki: it might need a custom usb driver
01:42 PM Cracki: https://electronics.stackexchange.com/questions/161361/burn-micronucleus-bootloader-to-use-attiny85-via-usb-avrdude
01:43 PM cambazz: ok looking
01:43 PM Cracki: so... if your digispark module creates a virtual com port, you're ok. if not... not so good
01:43 PM cambazz: well for the plain atiny i need a special programmer though right?
01:44 PM Cracki: and for talking to the micronucleus bootloader, it seems you'll need to use a micronucleus upload tool
01:44 PM Cracki: for the plain attiny, you can use a proper programmer, or another arduino
01:44 PM Cracki: arduinos can be used for SPI/ISP programming
01:44 PM cambazz: ok, i got another arduino, and also plain ftdi
01:45 PM cambazz: well lsusb wont show it, and it wont start a /dev/ttyACMX and /var/log/syslog says it is not recognized
01:45 PM Cracki: ok
01:45 PM Cracki: that's expected from what I read
01:46 PM Cracki: it's been a while since I had to use another arduino for programming...
01:46 PM Cracki: there are guides out there.
01:46 PM Cracki: you program a sketch on the arduino that enables it to be a programmer.
01:46 PM Cracki: then you attach the relevant lines between arduino and target (tiny).
01:47 PM Cracki: then you'll need to talk to the arduino in some way to give it the programming commands. the arduino IDE uses avrdude for that.
01:47 PM Cracki: you can use avrdude standalone of course. that's what most people do
01:48 PM Cracki: (or you go with the intended digispark route: use the micronucleus driver and upload tool)
01:48 PM Cracki: https://github.com/micronucleus/micronucleus
01:50 PM Cracki: they seem to provide built binaries for windows
01:50 PM Cracki: (I'd recommend trying that first, installing the driver from the repo, and using the exe in the commandline dir)
01:51 PM cambazz: well i am googling for programming tiny85 with arduino, and i cant find guides because it shows the ones that programs tiny85 with arduino ide and language
01:51 PM cambazz: i want to use avrdude
01:52 PM Cracki: ok
01:52 PM Cracki: first, the tiny85 is ISP/SPI programmable, so that's good to know
01:52 PM Cracki: to use an arduino as a programmer, it needs a sketch on it that does this function
01:53 PM Cracki: arduinos usually provide a com port through their usb
01:53 PM Cracki: they all have a bootloader that receives commands from the serial port and programs the flash memory
01:53 PM Cracki: avrdude can take a firmware binary and send it to an arduino bootloader
01:54 PM cambazz: ok i have a mega, and it has a seperate icsp port
01:56 PM Cracki: the "ArduinoISP" sketch is a few hundred lines of code. you'll want to build this and send it to the arduino that'll act as programmer.
01:57 PM Cracki: I really recommend using the arduino ide for that. it also only just runs avrgcc and avrdude, so you can do that manually, but it's way more painless to let it figure out all the command invocations
01:57 PM Cracki: once you're there, you can use plain avrgcc and avrdude to talk to that arduinoisp for programming the tiny
01:58 PM Cracki: i'm checking if avrdude really can speak to arduinoISP
02:00 PM Cracki: https://learn.adafruit.com/arduino-tips-tricks-and-techniques/arduinoisp
02:00 PM Cracki: according to this, "avrdude -c arduino" seems to be be the right mode
02:00 PM Cracki: (way at the bottom)
02:16 PM Emil: cambazz: https://emil.fi/avr bottom of page.
02:19 PM Cracki: the avr-objcopy step is important too ;)
02:20 PM Cracki: but only if you want to talk to an arduino *bootloader*. if you want to talk to "arduino ISP", it's similar, but not quite the same
02:21 PM Cracki: or is that the same protocol...
02:21 PM Cracki: ah, it's the same protocol!
08:30 PM tendie: Good morning.
08:31 PM tendie: I am new to embedded programming and I have a question about Atmel's ARM microcontrollers. I was wondering if this was a good place to ask.
08:31 PM tendie: Are their any trade offs of using an ARM microcontroller vs AVR?
08:32 PM _ami_: tendie, well, it depends on what you want to do in your projects
08:33 PM _ami_: 8 bits avr are easier to understand and program as compare to ARMs
08:34 PM tendie: I am so new I have trouble articulating my needs. My project would be controlling multiple actuators and it would need to do so based on precise input provided by an end user.
08:36 PM tendie: Other than complexity are their any other negatives? Especially if I personally enjoy arm assembly? Is speed at all effected? I mean it is a microcontroller so it just runs my program and that is it right?
08:39 PM tendie: I apologize I am probably way over my head.
08:44 PM Lambda_Aurigae: ARM tends to be an order of magnitude or more faster than AVR
08:44 PM Lambda_Aurigae: AVR runs at top 20MHz, approaching 20MIPS
08:45 PM Lambda_Aurigae: depending on the arm you can get into the multiple gigahertz.
08:46 PM Lambda_Aurigae: AVR tends to be easier to work with overall...the instruction set is much simpler...the programming interface is generally easier to work with...
08:46 PM Lambda_Aurigae: there is a simple avr-libc implementation along with gcc and binutils.
08:47 PM tendie: Thank you Lambda_Aurigae.
08:47 PM Lambda_Aurigae: with ARM you have multiple HALs depending on the particular manufacturer.
08:47 PM tendie: HALS?
08:48 PM Lambda_Aurigae: hardware abstraction layer
08:49 PM Lambda_Aurigae: interface for your peripherals.
08:49 PM Lambda_Aurigae: ARM setup and configuration is much more complex than AVR
08:49 PM tendie: Simplicity would be beneficial but I am worried with what I am doing I would need the speed and extra memory space.
08:49 PM Lambda_Aurigae: so, overall, AVR is much simpler than ARM in my opinion.
08:50 PM Lambda_Aurigae: you have not said what you are doing so no way to tell what would be best.
08:50 PM tendie: Prosthetics akin to the open hand project.
08:50 PM Lambda_Aurigae: I work with pic, pic32, avr, 8052, occasionally msp430, and am futzing with arm.
08:51 PM tendie: They use an atmel arm based arduino though but I am not sure I would want to go their route. But if needed to use arm I suppose I should consider it.
08:51 PM * Lambda_Aurigae cringes
08:52 PM Lambda_Aurigae: ardweeny...ewwww.
08:52 PM tendie: I think they just used it because of it being readily available.
08:52 PM Lambda_Aurigae: yeah.
08:52 PM Lambda_Aurigae: the libs make it easy for anybody to write bloatware.
08:52 PM tendie: Arduino is certainly not what I would use but that is me.
08:54 PM Lambda_Aurigae: anyhoo...time for me to head for bed.
08:55 PM tendie: Thank you for the help Lambda_Aurigae.
08:55 PM tendie: Before you go I hear a lot of reccomendations of stm32 vs atmel's arm. What is your opinion?
08:56 PM Lambda_Aurigae: six of one half a dozen of the other.
08:56 PM Lambda_Aurigae: the arm chips I have are stm32.
08:56 PM Lambda_Aurigae: mostly because they come on these nifty little easy to use boards.
08:56 PM Lambda_Aurigae: as I hate soldering SMT stuff.
08:57 PM Lambda_Aurigae: other than speed, I really don't find ARM to be better than anything else I use.
08:57 PM Lambda_Aurigae: I actually prefer pic32 over arm by far.
08:57 PM Lambda_Aurigae: anyhoo,,,TTFN
08:57 PM Lambda_Aurigae: Time To Flippin Nap!
09:07 PM Cracki: join ##stm32 for some propaganda ;)
09:07 PM Cracki: I hear stm32 are a lot better supported with vendor software than other cortex M
09:07 PM tendie: I am just worried about software support. I use linux and openBSD for the most part.
09:08 PM Cracki: there's arm gcc, maintained by ARM itself
09:08 PM Cracki: openocd to talk to the things (akin to avrdude)
09:08 PM Cracki: arms have a lot mroe debug features
09:08 PM tendie: That is wonderful.
09:08 PM tendie: stm32 seems to be invite only.
09:08 PM Cracki: more or less fully featured eclipse environment
09:08 PM Cracki: huh?
09:08 PM Cracki: double #
09:09 PM tendie: Aaah. Thank you.
09:09 PM Cracki: on freenode, ## are "general" channels iirc
09:09 PM Cracki: be careful tho, ##stm32 is a bit trollish
09:09 PM Cracki: don't take bait if they offer any ;)
09:10 PM tendie: Thank you for the advise. I will take it to heart.
09:10 PM Cracki: you'd be working with libopencm3 probably
09:10 PM Cracki: it's a vendor-agnostic "HAL"
09:11 PM Cracki: you have the arm cortex m core, then you have the way all the vendor specific peripherals are mapped to memory
09:11 PM Cracki: "CMSIS" is also a thing
09:11 PM Cracki: (just throwing it out there)
09:12 PM Cracki: I think a decision for atmel/mcp SAM arms wouldn't be too bad either. atmel's support for their stuff seems to be good
09:12 PM Cracki: and if you have an arduino-like board, you don't need to use arduino libs anyway
09:13 PM Cracki: arms have bootloaders too, if you don't want to reach in through the SWD ("jtag") interface directly
09:13 PM Cracki: something new you'll see when coming from avr: you can load programs into an ARM's ram and execute from there
09:13 PM Cracki: (it's gone on reset)
09:15 PM tendie: This is very helpful info. Thank you.
09:18 PM Cracki: oh also the docs are more "distributed" than the single data sheet you're used to with AVRs
09:19 PM Cracki: for arm cortex m, you have the architecture, the vendor specific stuff, ...
09:19 PM Cracki: configuring a pin for GPIO is also a bit more ceremonial. you have a "clock tree" and need to enable clock to a block of pins first, etc
09:20 PM Cracki: you can probably configure drive strength (slew rate) of pins
09:22 PM _ami_: tendie, people at #libopencm3 are good
09:22 PM _ami_: i have been using libopencm3 for my stm32 boards and i like it
09:24 PM tendie: _ami_: Thank you.
09:24 PM tendie: It seems stm32 seems to be the place to go.
09:24 PM _ami_: tendie, do you use linux for development?
09:25 PM _ami_: tendie, this should give you a start: http://amitesh-singh.github.io/stm32/2017/04/09/setting-stm32-dev-environment-arch-linux.html
09:25 PM tendie: I do.
09:25 PM tendie: You guys are awesome.
10:14 PM enh: I have just reflowed an accelerometer 15 times, just to discover that it was not working due to a stupid software initialization problem.
10:15 PM polprog: i have a chip thats starts talking on the second spi transaction, no delays or anything helps.
10:15 PM polprog: bastard needs one spi transaction to start working :(
10:17 PM enh: which one?
10:17 PM tendie: Is the hate on stm32 on how they handle periphials justified?
10:18 PM enh: dunno. there is hate in stm32?
10:19 PM tendie: Less hate. Probably just hyperbole.
10:22 PM Snert: it's just likes and dislikes. Form thine own opinion.
10:23 PM Snert: there would not be an STM32 if it did not sell pretty good.
10:23 PM tendie: Excellent point.
10:25 PM Snert: availability of sample code for all kinds of sensors may be thinner.
10:25 PM Snert: what's to lose? 3dollars?
10:27 PM tendie: It has been a difficult harvest.
10:28 PM enh: 6 dollars
10:29 PM polprog: thats much
10:29 PM enh: stm32f303cc
10:29 PM polprog: if you mutiply it by the production amount
10:29 PM enh: yep
10:29 PM enh: expensive animal
10:29 PM polprog: ;)
10:30 PM polprog: i think the most expensive chip ive ever seen was 5000$
10:30 PM tendie: $6? What do they need $3 dollars for? They will hear from my lawyers over the $4 they owe me.
10:30 PM polprog: dont remember what it was though
10:44 PM enh: midnight here. I'll turn into a pumpkin soon.
10:45 PM enh: Dunno where i left my crystal shoes. Damn.
10:45 PM enh: Probably in the princess castle
10:46 PM tendie: East coast best coast.
10:46 PM enh: Maybe I'm mixing things too much. Time to go to bed.