#avr Logs

Nov 11 2017

#avr Calendar

03:11 AM polprog: good morning
03:34 AM Jartza: morning, indeed
05:00 AM polprog: i changed the mcu back to m16
05:00 AM polprog: do i just connect the crystal to tosc pins or do i need to add caps?
08:28 AM enh: Soon this channel will be 11 years old
08:28 AM enh: We should make a party.
08:29 AM enh: In 89 years it will be 100 years old.
09:28 AM enh: amazing, huh?
10:20 AM rue_bed: enh, is right, we should start planning the 100 year
10:21 AM rue_bed: lets distribute tasks, who will buy the plastic cups?
10:59 AM polprog: heh
11:01 AM polprog: https://puu.sh/yjKti/5c18c3f026.pdf
11:01 AM polprog: can someone take a look at that?
11:35 AM * cehteh looked at it
11:36 AM polprog: thanks ;)
11:37 AM cehteh: battery powered?
11:39 AM cehteh: for a clock i'd go for some external time source (gps, dcf77, ...) and RTC, not 32k quarz
11:40 AM cehteh: and dunno if you rather want some drivers for the display than connecting it directly to the io's
11:46 AM polprog: it's meant to be very small
11:46 AM polprog: normally there would be a separate RTC
11:46 AM polprog: externally powered
11:50 AM polprog: https://puu.sh/yjM8M/dd67d3d920.png
11:51 AM JoeMoo: oOo what is that polprog?
11:51 AM cehteh: clock
11:52 AM polprog: desk clock
11:52 AM cehteh: ok then .. whats D1 for? reverse voltage protection? do you want everything go trough the diode?
11:53 AM polprog: reverse voltage protection
11:53 AM cehteh: otherwise you can use polyfuse and crowbar
11:53 AM polprog: i know
11:53 AM polprog: but i dont have polyfuses this small physically
11:53 AM polprog: i only have 1206 fuses
11:53 AM cehteh: ok
11:54 AM JoeMoo is now known as JoeLlama
11:54 AM cehteh: when you drive the leds directly you may want to accompany the 100n cap with some big brother, 4.7µ Tantal or some multilayer ceramic
11:55 AM polprog: good idea
12:05 PM polprog: added a 4u7 tantalum
12:05 PM polprog: ill put it between the cpu and the displays
12:08 PM polprog: damnit, no space
12:08 PM polprog: and the routing doesnt allow it
12:14 PM polprog: i put the tantalum cap next to the power input
12:14 PM polprog: no space anywhere else
12:18 PM polprog: oh great they dont have m16 in qfn
12:18 PM polprog: shit
12:18 PM cehteh: possibly a 2.2µ is cheaper and better, and those caps should be physically as close as possible to the chips VCC
12:18 PM cehteh: 2µ2 ceramic i meant
12:21 PM polprog: i can put a 1u ceramic close to the chip...
12:23 PM cehteh: the 110n should be as close as possible, second the 1 (or 2) µ
12:23 PM cehteh: do you pwm the display for brightness control?
12:24 PM polprog: so far i have 3x100n, one close to the power and two close to the supply pin pairs
12:24 PM polprog: i dont pwm
12:24 PM polprog: i multiplex the displays though
12:25 PM cehteh: yes i seen the multiplex, just wondered if you use something for brightness as well
12:27 PM polprog: hmm farnell has good stock and cheapish shipping
12:27 PM polprog: 16pln vs mouser's 80 for shipping for orders under 200pln
12:31 PM nuxil: polprog, you can buy dil sockets with caps in them ;)
12:33 PM nuxil: like these. https://www.elfadistrelec.no/Web/WebShopImages/landscape_large/_t/if/ic-socket-650668f.jpg
12:33 PM nuxil: comes in all varians tho
12:34 PM cehteh: lol
12:34 PM cehteh: did you look at his pcb?
12:34 PM nuxil: no
12:35 PM nuxil: ouww.
12:35 PM nuxil: yea than thats a nogo :p
12:35 PM cehteh: and those dil sockets are old stuff made for TTL ICs wont fit AVR's who have multiple VCC and GND at different pins
12:38 PM polprog: hey those sockets are prety cool
12:38 PM polprog: :D
12:39 PM polprog: damnit mouser doesnt have those tantalum caps
12:39 PM polprog: ill buy a 1u MLCC instead
12:39 PM polprog: nuxil: the pcb pic is somewhere earlier
12:40 PM polprog: https://puu.sh/yjM8M/dd67d3d920.png
12:40 PM polprog: this ^
12:40 PM nuxil: yea. i scrolled up and saw it
12:40 PM polprog: how do you like it
12:41 PM polprog: ?
12:41 PM polprog: ill have to redo it, ill use a tqfp m16 instead
12:42 PM nuxil: looks nice.
12:44 PM nuxil: so. what kind of display are you going to use ?
12:45 PM nuxil: 7 seg displays ?
12:45 PM nuxil: 8 of them ?
12:46 PM nuxil: or something more fancy like a lcd
12:49 PM nuxil: or nixie tubes :p
12:50 PM polprog: nixies...
12:50 PM nuxil: :D
12:50 PM polprog: i have some ice tubes but i havent gotten around running them
12:50 PM polprog: nixies i have those too
12:50 PM polprog: i personally like 16 segment displays but they are rare theese days
12:50 PM polprog: in favor of HD44780 lcds and the like
12:51 PM polprog: or even oleds
12:51 PM polprog: ill finish the pcb tomorrow
12:51 PM polprog: what an orgy of vias and traces :D
12:52 PM nuxil: so you send in the design and get some firm to do it for you. or are you making diy pcb ?
01:01 PM polprog: nah, i think ill send the design
01:02 PM polprog: i always send
01:02 PM polprog: no point in making dyi, not this scale of miniaturization
01:02 PM polprog: i once made a successful dyi pcb
01:02 PM polprog: but i dont have luck or patience for that
01:02 PM polprog: maybe i should try and experiment with other ways
01:02 PM polprog: maybe my paper is bad
02:50 PM mmfood: https://electronics.stackexchange.com/questions/233157/driving-large-common-anode-7-seg-led-with-npn-transistor-and-arduino-worked-but
02:52 PM mmfood: following the second answer in this thread, I experience a lot of smearing immediately after powering the device. But the smearing is cleared after a while. What may be the cause of this?
02:56 PM mmfood: https://imgur.com/a/kL8lX
02:57 PM mmfood: the actual schematic is visualized in this image
02:58 PM mmfood: I am guessing that the current of on of the common pnp transistors is not clearing fast enough before the segments for the next digits is turned on ( my code for this is basically:
02:59 PM mmfood: set segments for digit 1 high
02:59 PM mmfood: set digit 1 high
02:59 PM mmfood: clear segments
03:00 PM mmfood: clear digit 1
03:00 PM mmfood: set segments for next digit high
03:00 PM mmfood: set next digit high
03:00 PM mmfood: in a loop
03:06 PM mmfood: void print(uint8_t segments[4])
03:06 PM mmfood: {
03:06 PM mmfood: for (int i = 0; i < 4; i++) {
03:06 PM mmfood: write_to_port(PORTD, segments[i]);
03:06 PM mmfood: write_to_port(PORTC, digit[i]);
03:06 PM mmfood: _delay_ms(1);
03:06 PM mmfood: clear_segments();
03:06 PM mmfood: clear_digits();
03:06 PM mmfood: _delay_us(1000);
03:06 PM mmfood: }
03:06 PM mmfood: }
03:06 PM mmfood: this is the actual printing function
03:44 PM nuxil: what transistors are you using ?
03:49 PM mmfood: BC546BTA (npn) and 2N4403 (pnp)
03:49 PM nuxil: how high powered are these 7 segments ?? seems to be "overkill" with transistor usage for enabeling segments. besides why use them like a voltage divider there ? can the pnp's not handle 5v input
03:50 PM nuxil: eerm.. why use them at all. :p
03:52 PM mmfood: well the forward voltage is 5.5-7.5V so they are being driven from 12V.
03:52 PM mmfood: *LED forward voltage
03:55 PM nuxil: hmm bc546. is they are anything like the bc547. they are shit when doing fast switching imo. they are just general purpose transistors.
03:56 PM mmfood: since they are in the same datasheet I would think they have some things in common
03:57 PM mmfood: what characteristics should I look for in these transistors then?
03:58 PM nuxil: isnt the C for fast switching ?
03:59 PM nuxil: here is my setup :p https://gyazo.com/c0023a67a50d581bb65cd2897b177932 just 2segments. and only on 5 volts tho. just resistors to limit the currents. no hazzle with transisors. only 2. for the multiplexing :p
03:59 PM nuxil: :p
04:00 PM nuxil: transistors are driven by 3.3v tho.
04:03 PM polprog: finished my desk clock
04:03 PM polprog: one question thougj
04:04 PM polprog: do i need caps on tosc pins when i use a crystal>
04:04 PM nuxil: usaly yes i think. check datasheet
04:04 PM polprog: haha, good answer :P
04:04 PM nuxil: same as i always get :p
04:07 PM polprog: No external capacitors are needed. The Oscillator is opti-
04:07 PM polprog: mized for use with a 32.768 kHz watch crystal. Applying an external clock source to TOSC1 is
04:07 PM polprog: not recommended.
04:07 PM polprog: sweet
04:08 PM polprog: nuxil: i can see you are messing around with a raspberry pie
04:08 PM nuxil: mmfood, so if it was my ciurect i think would remove all these pnps, and either and move the npns up ther. replace them with bigger ones but dont go above max limit of what your pin can do. or just change to a mosfet :D
04:08 PM nuxil: polprog, yea
04:08 PM nuxil: old pi2
04:08 PM mmfood: well, min 5.5V If wont work with 5V obviously, but I need to use a mcu so the pnp transistor is needed. I guess I could sink the current to the mcu and use a active low output for the pnp transistors. But Everything is working fine but for the first 10-20 min. Which is peculiar, I'd like to know why this changes later on
04:08 PM nuxil: use it to but my atinys with
04:08 PM nuxil: *programm
04:09 PM polprog: mmfood: if it breaks after a while i bet it's thermal
04:09 PM polprog: and it's 2300 here so i will go to sleep noe
04:09 PM polprog: now*
04:09 PM polprog: goodnight
04:09 PM mmfood: I can't use npn for the common anode since it is 12V and the base need to be Ve + 0.7V on a NPN. Whith a PNP I could just pull it down to 0
04:11 PM mmfood: I tried using just a NPN as both anode and cathode transistors before and the LED's wouldn't even light up
04:13 PM Emil: polprog: finished as in finished the design?
04:13 PM Emil: or the whole thing?
04:17 PM mmfood: And another thing I don't quite understand: The voltage of the mcu outputs is about 0.7V when set high and the base voltage of the npn transistors is also 0.7V. Why is this? Shouldn't the output be 5V and a 4.3V drop over the base resistor result in a 0.7V on the base when the emitter is 0V? Why would the output and the base voltage be the same?
04:18 PM Emil: mmfood: schematic pls
04:18 PM mmfood: https://imgur.com/a/kL8lX
04:18 PM Emil: I have a feeling though
04:18 PM Emil: yeah,so
04:18 PM Emil: where's your base resistor?
04:19 PM mmfood: oh, damn, forgot that in the schematic, they are placed in the circuit though
04:19 PM mmfood: 2.2k
04:20 PM Emil: I don't believe you :D
04:20 PM Emil: Also
04:20 PM Emil: what kind of 7 segment dispalys are those?
04:21 PM Emil: And, umm
04:21 PM Emil: how big are those resistors R12 R2 and so on?
04:24 PM mmfood: https://www.farnell.com/datasheets/2047381.pdf
04:24 PM Emil: Why do you have those R2 resistors?
04:26 PM Emil: transistors are not mosfets
04:26 PM mmfood: R12-R16 would surely be needed to get a current on the pnp base
04:27 PM Emil: mate
04:27 PM Emil: pls
04:27 PM Emil: R2 to R5
04:27 PM nuxil: Emil, mosfets are transistors :p just not bjt
04:31 PM Emil: mmfood: point is: R2-R5 hinder the operation of your circuit
04:31 PM mmfood: I am not really sure why they are needed, https://electronics.stackexchange.com/questions/233157/driving-large-common-anode-7-seg-led-with-npn-transistor-and-arduino-worked-but
04:31 PM mmfood: this is the source of that circuit
04:33 PM nuxil: mmfood, also. you dont know why base is 0.7V ?
04:33 PM nuxil: thats basic 101 transistor stuff :p
04:33 PM mmfood: The second answer introduces those resistors to get a fast off-switch of the pnp. But the third answer also has thos resistors. I guess I should do some more calculations on the circuit to really figure out what's going on.
04:34 PM mmfood: nuxil: yes, base is 0.7V but why the output? that gives a 0V drop over the base resistor and no current?
04:34 PM mmfood: the output should still be 5V?
04:35 PM nuxil: no. youre mesuring the "diode" inside the tranasistor betweeen BE. its usaly around 0.7v or so.
04:35 PM mmfood: yes
04:36 PM mmfood: but if I put the DMM between 0V and the output pin on the mcu I still get 0.7V or so
04:41 PM mmfood: https://imgur.com/a/iYhw8
04:41 PM mmfood: sorry for the hideous image, but maybe it will clarify what I mean
04:44 PM nuxil: umm
04:49 PM nuxil: why dont you just make something like https://gyazo.com/e3529bdc2a52dca653a32e6e4bd67400
04:50 PM nuxil: Q1 can even be a bc547 since the segment only does max 20mA and the bc547 can do 100mA
04:51 PM nuxil: try and built it in ltspice and see it work :p
04:51 PM mmfood: I did exactly that
04:52 PM mmfood: but Since the collector and the emitter (just about) is 12V the base would have to be 12.7V which the mcu cannot provide
04:52 PM mmfood: if using a single npn for the common anode
04:53 PM nuxil: your fine using 12v
04:53 PM mmfood: that won't work
04:53 PM nuxil: Forward Voltage
04:53 PM nuxil: Per Segment Or (DP) 5.55V
04:53 PM nuxil: you have enuf to play with
04:59 PM mmfood: that is minimum, I have measured at least 6.5V in circuit. And I don't really get what you mean bu enough, If the mcu provides 5V, how can the base be 5.5 + 0.7 = 6.2V ?
05:35 PM nuxil: build a walton multiplier on the mcu output :p
05:36 PM Ameisen: I'm very fond of the program memory templates I added for C++
05:36 PM Ameisen: in lieu of having __flash
05:36 PM Ameisen: constexpr const auto Tag = "SimpleManager"_p;
05:37 PM Ameisen: _p makes a compile-time flash_char_array literal (Acts similar to char[]) which can also decompose into a flash_string type (acts similar to const char *)
05:37 PM Ameisen: which gives passing around program memory strings more type safety, otherwise they're all const char *, but completely different...
05:57 PM Emil: mmfood: check your wiring
05:57 PM Emil: mmfood and also check your currents
05:57 PM Emil: You probably have a short
06:18 PM Ameisen: So, interestingly, (polprog should take note)
06:18 PM Ameisen: the only main maintainer of the AVR backend for GCC strongly recommended to me that I abandon GCC AVR and contribute to LLVM instead
06:19 PM Ameisen: he's rather disillusioned with GCC's maintainers
06:19 PM Ameisen: and doesn't think AVR will improve but will only regress
06:19 PM Ameisen: since there's no real concern on the part of the compiler maintainers to make sure that the middle-end doesn't regress AVR performance/codegen.
06:19 PM Ameisen: I've noticed that switching from GCC 4.8 to 7.2.0
06:19 PM Ameisen: while I gained C++17, I also gained 2 KiB of .text size without any performance gain
06:20 PM Ameisen: I've also been encouraged to encourage other AVR developers, if they could, to contribute to LLVM's AVR backend so another toolchain can be fully functional
06:20 PM Ameisen: I think there's about 20 or so people working loosely on AVR-LLVM
06:20 PM Ameisen: most of them for Rust, but the backend is the same regardless
06:21 PM Ameisen: I've been working on the lowering code to try to get codegen quality comparable to gcc/g++
06:21 PM Ameisen: it is _way_ easier to get clang up and running for AVR (or any target) than gcc though, including on Windows
06:21 PM Ameisen: as it builds as a native windows binary, even in visual c++
06:22 PM Ameisen: so, just throwing that out there if there's anyone who wanted to contribute to having a second toolchain available (one that can actually not regress as much)
06:22 PM Ameisen: even if it's just telling the LLVM/Clang maintainers that you care strongly about it, so it moves from experimental to main branch, and thus gets unit testing support
06:23 PM Ameisen: since it's experimental, their repo unit builds don't test it, so it sometimes breaks
07:32 PM Emil: Sounds like GCC maintainers should pull their heads out of their arses
07:35 PM Ameisen: They won't
07:35 PM Ameisen: AVR is, wha
07:35 PM Ameisen: 0.1% of their users?
07:36 PM Emil: How the fuck can they break perf :D
07:36 PM Ameisen: because performance IMPROVED on x86, arm, etc
07:36 PM Emil: Idiocy at maximum
07:36 PM Emil: shit coding, I say
07:36 PM Ameisen: regression only matters if the regression impacts something you care about
07:38 PM Emil: Sounds like there needs to be performance testing
07:38 PM Emil: comparison between versions
07:38 PM Emil: and a very fucking condencending post in the mailing list
07:38 PM Ameisen: there have been ocndescending posts
07:38 PM Ameisen: which were read by nobody
07:38 PM Ameisen: because nobody cares
08:01 PM Emil: That's
08:01 PM Emil: depressing
08:17 PM enh: hi
08:23 PM robinak is now known as robink
09:30 PM Emil: Hi
10:00 PM JanC is now known as Guest1441
10:00 PM JanC_ is now known as JanC
10:37 PM _ami_: damn, i bought lots of stuffs from aliexpress during this 11/11 sale.
10:38 PM enh: :)
10:39 PM enh: I feel your pain
11:17 PM _ami_: enh: i had planned to buy stuffs before this day but i bought most of things which i did not plan to buy :/ :P
11:17 PM enh: :)
11:18 PM enh: I have not even entered the portal.
11:18 PM enh: Was afraid of that
11:23 PM _ami_: enh: :)
11:43 PM enh: _ami_: https://www.youtube.com/attribution_link?a=zub_J3c-cBIFXTsS&u=/watch%3Fv%3Dk3lacOYokY0%26feature%3Dem-upload_owner