#avr Logs

Jan 20 2020

#avr Calendar

12:00 AM day__ is now known as day
01:48 AM rue_bed: https://tomverbeure.github.io/2019/09/15/Loading-a-Spartan-6-bitstream-with-openocd.html
02:28 AM rue_bed: anyone awake?
03:31 AM nuxil_ is now known as nuxil
03:51 AM crazy_imp: hi
03:51 AM rue_bed: hi
03:51 AM nuxil: good day
03:51 AM rue_bed: its 1:35am, I have to get up for work at 6:15
03:51 AM rue_bed: am
03:52 AM rue_bed: but on the bright side by number resolving library works!
03:52 AM nuxil: what you working on ?
03:52 AM rue_bed: its a library for collecting values from strings
03:52 AM rue_bed: like "4.7k"
03:53 AM rue_bed: or "3k2"
03:53 AM nuxil: resistor values?
03:54 AM rue_bed: or capacitor, or current, or whatever
03:54 AM rue_bed: I also wrote a standard value finder library
03:54 AM rue_bed: you can give it a value like 7439, with a series, like E42, and it'll find the closest value
03:56 AM nuxil: i see,
03:56 AM crazy_imp: i've got a problem with resetting a board. if i use the reset pin, everything behaves as expected, if i trigger a soft-reset through the watchdog, i've got a 50/50 chance that it behaves like an external reset - i even put a sleep as first step in the main to prolong the "everything is floating" state, without much change :/. what should i look for?
03:56 AM nuxil: do you include tolerance too ?
03:57 AM rue_bed: no, it tells you the closest for the series(s) that you ask for
03:57 AM rue_bed: crazy_imp, stm32?
03:58 AM crazy_imp: avr, atmega128a
03:58 AM rue_bed: hmm
03:58 AM nuxil: arduino code ?
03:58 AM crazy_imp: c
03:58 AM nuxil: or pure C
03:58 AM nuxil: oki
03:59 AM nuxil: fuses enabled??
04:03 AM nohit: *c++
04:03 AM rue_bed: there is a flag
04:03 AM rue_bed: that determines how the soft reset behaves
04:04 AM rue_bed: iirc
04:04 AM crazy_imp: yes, the avr works as intented, the reset however does not regarding the rest of the circuit. the avr gets 5v from a 12v rail, there's a display and a ftdi (both powered from 5V-usb). the only connections between the those rails are through the avr. the display has 50% chance to stay light up if i do a software reset. if i short the reset on the avr, it's off as intended if there's no usb power. so in the e
04:04 AM crazy_imp: nd it's an electrical problem. but i would like to understand why a hard reset works as intented and a soft reset does not
04:05 AM rue_bed: iirc the software reset can do 1 of two things depending on the value of a register
04:05 AM crazy_imp: ok, i'll look at the datasheet :)
04:05 AM rue_bed: if I wasn't supposed to be asleep 5 hours ago, I'd help more
04:08 AM rue_bed: sv = stdResClosest(E24, v = 5.2 );
04:08 AM rue_bed: sv: 5.100000 error: 0.100000
04:12 AM crazy_imp: hm, only thing i can find in the fuses are BOOTRST (from the high fuse) which would affect the reset behaviour, by enterting a bootloader
04:12 AM rue_bed: if you dont have a bootloader its jumping to random code
04:13 AM rue_bed: but
04:13 AM rue_bed: there should be something else
04:13 AM rue_bed: cause, you can detect on reset, what caused the reboot
04:13 AM nohit: what you building reu ?
04:13 AM nohit: *rue
04:13 AM rue_bed: an empire!
04:14 AM rue_bed: with a foundation of lack of sleep
04:14 AM rue_bed: I'm in bed
04:14 AM nohit: is that gonna run on stm32 ?
04:14 AM rue_bed: all I need is tiredness
04:14 AM crazy_imp: wouldn't there be empty flash that's hopefully like a nop slide to the start of the normal code?
04:14 AM rue_bed: no, its for the utilities I keep making
04:14 AM nuxil: crazy_imp, section 15.4. a hole section about the watchdog http://ww1.microchip.com/downloads/en/devicedoc/atmel-8151-8-bit-avr-atmega128a_datasheet.pdf
04:14 AM rue_bed: I have a program called ohm that does ohms law stuff, but with power too
04:15 AM rue_bed: root@fast-laps:/files/programming/c/StandardResistor# ohm -r 0.0033 -i 20
04:15 AM rue_bed: Wattage is: 1.320000
04:15 AM rue_bed: Current is: 20.000000
04:15 AM rue_bed: Voltage is: 0.066000
04:15 AM rue_bed: Resistance is : 0.003300
04:15 AM rue_bed: I'd love to say 3.3m
04:16 AM nohit: nice
04:16 AM nohit: but kinda useless
04:16 AM rue_bed: na
04:16 AM rue_bed: say you need to know how many volts are across a 20w motor with a resistance of 1.4 ohms
04:17 AM rue_bed: ohm -p 20 -r 1.4
04:17 AM rue_bed: Wattage is: 20.000000
04:17 AM rue_bed: Current is: 3.779645
04:17 AM rue_bed: Voltage is: 5.291502
04:17 AM rue_bed: Resistance is : 1.400000
04:17 AM rue_bed: no thinking required
04:17 AM nuxil: lazy bastard ;p
04:17 AM rue_bed: totally
04:18 AM rue_bed: it skips solving junk over and over again when I want to know the answer for whatever else I'm doing
04:18 AM rue_bed: dont know how many times I had to re-isolate a P=IV with V=IR to get some stupid combo right
04:18 AM crazy_imp: nuxil: 15.1 states any reset source should behave the same (besides setting a different reset source)
04:19 AM rue_bed: hmm
04:19 AM rue_bed: I have to try to sleep again
04:19 AM crazy_imp: i enable and set the watchdog with wdt_enable(WDTO_15MS); and enter a for(;;){} loop, otherwise the watchdog is disabled during normal operation
04:19 AM crazy_imp: gn8 rue_bed
04:19 AM rue_bed: *HRRRRRRRRRR* *HRRRRRRRR*
04:20 AM nohit: crazy_imp: consider joining #avrs
04:20 AM nohit: we have bot that spits out AVR datasheets
04:20 AM nohit: just type "!mcu atmega128" and boom
04:21 AM crazy_imp: nohit: but i already have the datasheet :P
04:21 AM nohit: destroy it
04:22 AM nuxil: man. my laser project is a big faliure. what a waste of time.
04:22 AM nohit: ?
04:23 AM nohit: btw rue have you ever used Qt ?
04:24 AM nohit: it has a very nice command line parser
04:24 AM nohit: great for command line applications
04:25 AM nuxil: nohit, im got a laser pointed at a spinning mirror. mirror is rotating at 27500k. but i cant get my light pulses short enough to just make a points. it makes a lines instead.
04:25 AM crazy_imp: nohit: linking against qt for a cli app?
04:25 AM nohit: yes Qt core module
04:26 AM nuxil: https://pasteboard.co/IQP9mI1.jpg small lines instead of points.
04:27 AM nuxil: thats a test pattern
04:28 AM nuxil: oh well. i messed enough with this. time to find some other project instead.
04:28 AM crazy_imp: nuxil: how do you generate the pulses?
04:28 AM nuxil: isr
04:28 AM nuxil: two of them.
04:29 AM nuxil: one that triggers when the laser hits a sensor. that starts a new timer.
04:29 AM crazy_imp: that's quite a bunch of cycles to enter/leave an isr
04:30 AM nohit: how many cycles it took to get to the isr in cortex-m4 ?
04:30 AM nohit: was it 12
04:30 AM nohit: i think it was
04:30 AM nohit: and avr was 4-5
04:30 AM nuxil: i think my problem might be the opamp im using to puls the laser with. i think its way way to slow. its a lm358.
04:30 AM crazy_imp: and is the isr naked? that should remove even more overhead
04:31 AM nohit: try with another ampo
04:31 AM nohit: do you have anything else ?
04:31 AM nuxil: i got some. but thouse are smd's :(
04:32 AM nohit: what is naked isr ?
04:32 AM nohit: ive heard that one before
04:32 AM crazy_imp: i would first unroll a loop with on/off and see how short i can get the pulses, on an avr it should go down to f_cpu/4 iirc
04:32 AM twnqx: one that doesn't save all registers on the stack on entry
04:32 AM nohit: ah
04:32 AM twnqx: it's up to you to make sure you don't conflict with the non-irq code
04:33 AM twnqx: (so better use asm :P)
04:33 AM crazy_imp: simple PORTx = 0xff and such should be fine
04:33 AM crazy_imp: (hopefully)
04:34 AM twnqx: dunno if double immediate is ok
04:34 AM twnqx: clear/set single bit on a port most likely would
04:37 AM crazy_imp: anyway, i would first test how much speed you can get with the opamp at all, and i bet the pulse duration stems from the overhead to enter the isrs (prologue/epilogue + cyles to enter the isr), not the opamp being slow
04:47 AM nohit: morning cehteh
04:58 AM twnqx: this psb is going to drive me mad if i need to stare at it for another week
04:58 AM twnqx: pcb*
05:30 AM nuxil: its my opamp, its uber shit. well atleast for fast pulses. slewrate = 0.3 V/μs . git gud its bad. so to ouput 5v it takes ~16us
05:32 AM nuxil: twnqx, what are you making?
05:32 AM twnqx: a control board for a kind of vending machine
05:33 AM twnqx: too many issues with high currents, high temperatures, different voltages, ...
05:35 AM nohit: heh im makinf a control board too
05:35 AM nohit: with GUI
05:35 AM nohit: and embedded linux
05:36 AM nuxil: gui sucks. give them cli :p
05:36 AM nohit: great attitude
05:36 AM nuxil: i know ;)
05:38 AM twnqx: not totally off though, i am personally quite annoyed by GUIs for things that could be done in a tenth of the time with a neat command line interface
05:40 AM twnqx: just saying that there are things where clis are superior. there are also enough things where guis are superior, won't judge without knowing your exact application :P
05:41 AM nuxil: true enough.
05:42 AM twnqx: anyone here with experience on the "right" amount of solder paste on exposed pads with lots of thermal viaas in them?
06:16 AM polprog: [12:29] nuxil: gui sucks. give them cli :p
06:16 AM * polprog laughs in ncurses
06:16 AM nuxil: lol
06:17 AM nuxil: mc is one of my fav ncurses apps on linux :)
06:17 AM polprog: i need to learn ncurses to make fancy guis for music videos
06:17 AM polprog: same nuxil :v
06:20 AM nuxil: i need to go dig in my junkbin for opamps. i need one that has atleast 10v/us , not a shitty 0.3v/us as im using now.
06:20 AM nuxil: *slewrate
07:00 AM twnqx: i winder if this idea is sane... i don't have enough available pins on a connector (4 only). i want to use this for I²C with alarm reporting, with a low current
07:00 AM twnqx: (a few microamps)
07:01 AM twnqx: the alert pink can sink 4mA, so... instead of supplying VCC directly, supply through a small resistor
07:01 AM Fuchikoma: ?
07:01 AM twnqx: and when alert goes active, this turns into a resistor divider, reducing VCC by ~100mV
07:02 AM twnqx: which i can sense and turn into logic with a differential amplifier
07:02 AM twnqx: does that make sense? or will it produce a) magic smoke, or b) no useful results...
07:03 AM twnqx: guess only experiments will tell...
07:03 AM Fuchikoma: Hmm. Just to be clear, this is a limitation of a connector not the micro itself right?
07:03 AM twnqx: yes
07:03 AM Fuchikoma: What are the four pins currently used for?
07:04 AM twnqx: vcc, gnd, sda, scl
07:04 AM Fuchikoma: Mmkay. What voltage is Vcc?
07:04 AM twnqx: 5V, while the sensor can live on 2.7-5
07:05 AM Fuchikoma: Okay, so assuming a healthy 5V, you can drop that to 4.9 volts and still be within the TTL logic levels
07:05 AM twnqx: there's not even TTL involved, it's completely open drain logic all the way
07:05 AM Fuchikoma: Well yes and no
07:06 AM Fuchikoma: I2C needs pullups
07:06 AM twnqx: (because it's effectively open drain)
07:06 AM twnqx: and that's why i have bus insulation, yes
07:06 AM Fuchikoma: But the logic levels are still defined by TTL specs
07:07 AM twnqx: not sure, as you can run i2c on any voltage note between 1.8 and 5
07:07 AM Fuchikoma: As long as you can maintain a logic "High" voltage above ~3v it should be fine
07:08 AM Fuchikoma: It's the devices attached that tetermine the acceptable voltage levels. If the uC runs at 5v, then it will need a minimum of ~3v to properly register as logic high
07:08 AM Fuchikoma: And less than 0.5v for logic low
07:08 AM twnqx: sure, but that's why the micro always has a 5V pullup :P
07:09 AM Fuchikoma: But you can externally pull one of the SDA/SCL lines *slightly* low (4.9v) as a way to signal some condition
07:09 AM Fuchikoma: And that's fine, it will still be a logic high as far as the uC is concerned
07:10 AM Fuchikoma: In fact you might want to deliberately widen that gap, maybe 4.5v, just to be more decisive
07:11 AM twnqx: well, i must also consider what would happen if all 6 sensors signal alarm at once :P
07:12 AM twnqx: with a .5 voltage drop on each it would be a tad low, but yes, generally i could consider that
07:12 AM Fuchikoma: They're all on the I2C bus?
07:12 AM twnqx: yes
07:12 AM Fuchikoma: Also they won't be able to all pull the line low by 0.5v each, that's not how it works
07:13 AM Fuchikoma: Anyway, once you detect a voltage dip just poll all of the sensors to see which one(s) have a problem. You'd have to do that anyway
07:13 AM twnqx: maybe, maybe not, as they support group polling, but that's a oftware issue later on
07:14 AM twnqx: the problem is that the 4-pin-limit repeats for each chip
07:14 AM Fuchikoma: Well, you have no way of knowing which sensor is tripped otherwise
07:15 AM Fuchikoma: Alternatively you could put a hypervisor on each sensor that actively initiates an I2C link with the main controller
07:15 AM twnqx: i wanted to add a trimmer to the differential amplifier anyway so i can set the trip point, and i'll only have to change the upper resistor to widen the gap
07:18 AM twnqx: 52 ohms upper, 1250 ohms lower yield 4.8v, should all 6 turn on at once it'll still be 4V (~208ohm with 6x1250 in parallel)
07:19 AM twnqx: reality will be different with mosfet resistance on top and actual power consumption
07:20 AM Fuchikoma: That's not how voltage dividers work
07:22 AM twnqx: i am pretty sure that's how they work, just that ICs are dynamic resistances in parallel with this divider
07:23 AM twnqx: or rather, with lower resistor
07:30 AM Fuchikoma: In any event, there is nothing intrinsically wrong with your approach in theory
07:47 AM twnqx: good :) so let's see what the reality will bring
10:04 AM nuxil: yay. i blew up my little laser diode..
10:04 AM nuxil: note to self. dont try to push 350mA into something ment to run at 100mA :p
10:59 AM twnqx: poor laser diode :(
11:00 AM twnqx: i am kinda scared of doing that soon enough ™
11:00 AM twnqx: just... with 1k€ worth of LEDs
11:00 AM twnqx: they can take 1A, pulsed... the driver can generate 1.5A...
11:01 AM twnqx: hm. i should recalculate the current sense resistor to just put 100% at 700mA, aka their continous current...
11:07 AM mouseghost: im constantly frying all my electronics
11:07 AM mouseghost: so im scared to connect anything
11:08 AM nohit: mouseghost: consider joining #avrs
11:12 AM mouseghost: nohit, wdym
11:13 AM nohit: type "/join #avrs"
11:13 AM nohit: many nice people there
11:14 AM mouseghost: well k
11:16 AM Fuchikoma: Sounds like you need a current limiting powersupply
11:17 AM nohit: Fuchikoma: consider joining #avrs
11:17 AM nohit: we need asm expert there
11:17 AM Fuchikoma: Or how about no? :D
11:20 AM nuxil: with leds, lasers. always current limiting.
11:21 AM nuxil: with laser you really need|want a active current limiting ciruit.. leds not so important.
11:26 AM Fuchikoma: If your red LEDs turn yellow you might need a resistor
11:26 AM Fuchikoma: :)
11:27 AM nuxil: :D
12:36 PM davor_ is now known as davor
11:59 PM day__ is now known as day