#avr Logs

Mar 19 2022

#avr Calendar

01:09 AM rue_mohr: the avr and an eeprom chip are good down to 3V atleast, and it doesn't take long to save-out
04:59 AM specing_ is now known as specing
09:13 AM ville: howdy. anyone happen to have a link for bare metal blinky in c for arduino micro/atmega32u4? one that doesn't rely on the arduino libraries, just avr-gcc and avr-libc
09:27 AM polprog: https://emil.fi/avr
09:28 AM polprog: just change the DDRx and PORTx values so that it blinks the LED on the arduino
09:28 AM polprog: i dont know what pin its on
09:29 AM ville: polprog: thanks i'll give that a go. ddg never even suggested the site with my search terms
09:29 AM polprog: hmm yeah
09:30 AM polprog: Emil: fix your robots.txt
09:31 AM ville: i wouldn't be surprised if search engines penalize it for being text-onl
09:32 AM polprog: i think its the lack of robots.txt, my site is similarly text only and it gets indexed
09:33 AM polprog: tho ddg does not find it
09:33 AM polprog: i want to use ddg because i hate google, but the index size matters
09:33 AM polprog: ddg simply does not find most of what I search for
09:36 AM polprog: if you have any problems with getting the code to work just ask :)
09:36 AM ville: ok. i know nothing of that stuff. ddg is not too bad for what i usually search for. i've been able to avoid google search for ~10 years. at this point it is very well likely i am just beaten to submission and accept whatever the quality level is
09:38 AM polprog: im glad ddg is there
11:04 AM ville: looking at https://emil.fi/avr i am not quite sure why both pb0 and pb1 are set as output? presumably by: DDRB=0b00000011
11:05 AM twnqx: because the LED is connected between PB0 and PB1
11:05 AM ville: shouldn't it have been enough to set pb1 as output?
11:05 AM twnqx: so you need one to output 0 and the other to output 1
11:05 AM ville: ok think i get it. pb0 outputs the ground reference level
11:06 AM ville: pb1 outputs the vcc level. or something like that?
11:07 AM twnqx: yes
11:08 AM ville: and if pb0 hadn't been set as output then its output value would have been "undefined" in programming terms?
11:08 AM twnqx: it would have been an input
11:09 AM twnqx: in electrical terms, high-z
11:29 AM ville: would the presence of a pull-down or -up resistor on the pin determined the voltage without it being explicitly set?
11:30 AM qu1j0t3: for an input, yes
11:44 AM twnqx: the leds needs current to flow, not just a potential
11:45 AM twnqx: while an input, if realized with the "typical" mosfet inverter, only needs a bit of current for a brief time to change the charge of the gates
12:06 PM qu1j0t3: yes. ville to be clear if either is an input, no current will flow, no LED will light :)
12:12 PM ville: alright thanks. so what's happening in the button case then? there only pb0 is set as output, pb2 left as input as its value is being read later. so it's using something else besides current then?
12:16 PM qu1j0t3: ville: you're misreading something. B0 and B1 are outputs.
12:16 PM ville: err pc1 and pc2 in the case of the button. button... b...
12:17 PM ville: pc0
12:17 PM qu1j0t3: well, an input requires negligible current, per what twnqx said
12:17 PM qu1j0t3: C0 is set to ouutput and driven high.
12:18 PM qu1j0t3: i am not sure why this circuit doesn't use the rails, but this all amounts to the same thing.
12:19 PM qu1j0t3: oh sorry, C2 is the ooutput
12:20 PM ville: so for the button instead of being connected to pc2 it would be connected to + rail?
12:20 PM qu1j0t3: then they enable pullup on C0 (per comment) so that the input is defined (high) with button open
12:20 PM qu1j0t3: C2 is driven low (for button closed to read low)
12:21 PM qu1j0t3: ville: Yeah they probably have a reason (layout or something) but it would be simpler to read if the fixed voltages just used Vcc or GND
12:22 PM ville: and the led could have been connected to ground instead of pb0?
12:22 PM nohit: yes
12:23 PM qu1j0t3: yes
12:23 PM ville: alright then. thanks for all. think i got it for some value of getting it
12:23 PM qu1j0t3: the gpio is just a low impedance path to gnd or vcc
12:24 PM qu1j0t3: and that current limiting resistor is super important but you probably know that :)
12:25 PM ville: well "know" is a strong term. as in sure i'll stick it there and cargo cult it for now
12:25 PM qu1j0t3: without out it, youi will dstroy the gpio
04:37 PM guanche: Hi
04:40 PM guanche: do you guys see anything wrong with this? (using LUFA):
04:40 PM qu1j0t3: o/
04:40 PM guanche: https://pastebin.com/raw/7M678wTV
04:41 PM guanche: I've turned a chinese pro-micro into a winusb device that doesn't need of drivers, and I'm using bulk endpoints to send and received data
04:41 PM guanche: Then I'm using winusb on the host-side to handle comunications, but the device randomly locks while hosts expects data and I can't see why
05:26 PM WormFood: guanche, Do you honestly expect anyone to be able to help you with a code snippet that is basically a straight path? Have you ever heard of a race condition? That's a common mistake, that can be really hard to track down. Your code snippet most likely isn't the problem. I doubt anyone can help you without more code.
05:28 PM guanche: I've tracked down the problem to be the device not sending (for some unknown reason) the data. The host is locking waiting for it, how would a race condition affect that WormFood?
05:29 PM guanche: I've been reading about zero-length packets and windows to cause problems depending on how these are used, if used at all, just asked in case anyone would have gone through something similar
05:30 PM guanche: other than that, at least by now, the device is just echoing, or should, no race condition possible as far as I can see
05:32 PM WormFood: I was only using that as an example of a type of problem that is hard to track down, and not obvious. There are several common problems. My point was, your code snippet is too small to help anyone troubleshoot
05:33 PM WormFood: and most likely your problem isn't in that specific code snippet, unless you're using bad data, which nobody can tell, except you.
05:37 PM guanche: even if using LUFA, turning a pro-micro into a winusb device (that works) is not a 10-line thing, besides
05:37 PM WormFood: of course
05:38 PM guanche: my problem is likely to be related to the interaction of winusb with my device, you can think of it simply as an echo device so that we can isolate the rest
05:38 PM guanche: because that's actually what is doing even if the code shown looks more complex than that
05:39 PM WormFood: Do you have any type of output on the device, that could be used as an indicator in debugging?
05:39 PM guanche: I'm now reading up on logman, to see if I can sniff usb traffic and spot something wrong there, crappy windows stuff
05:40 PM guanche: leds, but couldn't find anything wrong by using them
05:40 PM WormFood: or, have you tried looking on the wire, to get a better idea of exactly what it is communicating physically?
05:40 PM guanche: that's what I'm trying now, just not too saavy on windows crap
05:40 PM WormFood: I despise winblows with every fiber of my being.
05:41 PM guanche: where even capturing usb traffic becomes a nightmare
05:41 PM WormFood: It is so amazingly hard to work with
05:41 PM guanche: sure it is
05:41 PM guanche: twice as difficult than it should for no real reason other than non sensical design
05:42 PM WormFood: I mean, doing the most basic things are so painful. Even copying files can be extremely frustrating.
05:42 PM WormFood: And people have the notion that windows is "Easy to use". That is totally not true. Windows is *not* "easy to use"! What it is, is "easy to learn", and that is totally different.
05:43 PM guanche: yeah, or opening them in a reliable manner, if it wasn't because I set my mind on doing it, I would have removed windows from the laptop altogether and keep going with my happy life as a linux user/hacker
05:44 PM WormFood: Try deleting a directory that has an .exe in it. It deletes 1/2 the files in the directly, and then it asks to confirm to delete the .exe, because the program might still work with 1/2 it's files missing. Couldn't they check to see if an exe was in the group of files to delete, and ask you at that time, before deleting anything?
05:46 PM guanche: haha, I'm mostly under msys/mingw64 terminal all the time, in fact, if it wasn't for msys I wouldn't be using windows at all
05:46 PM WormFood: Or, copying files. Many, many, many times, I'd start a big file transfer, that takes an hour or so, and I go do something else, like get lunch, and when I get back, I find it stopped 30 seconds after I turned my back, to ask me some stupid question. And "yes to all", means nothing, because they keep asking you stupid shit.
05:46 PM guanche: I just don't feel like wasting 15GB of my monthly mobile allowance to download a dumb "develpment" "environment", which doesn't include emacs
05:47 PM WormFood: There needs to be an "expert/idiot" switch in windows...to make it act reasonably. Hey Microsoft! when I say to delete a file, or copy a file, and there is a problem, don't fuckin' stop you god damn assholes! Do as much as you can, and save all those god damn questions for when someone is there. At least TRY to do your job, instead of acting like a slacker.
05:48 PM guanche: haha
05:48 PM WormFood: My theory, is Windows is powered by mouse clicks.
05:48 PM WormFood: I like to imagine it, like this big old rusty cog, and my mouse clicks are what make it move a little bit.
05:49 PM WormFood: er, I mean, my mouse clicks are the grease that makes it move a little more.
05:49 PM guanche: yeah, it's actually pointless having to do kilometers with a mouse to do some "real" "work"
05:49 PM WormFood: But it's so old and busted, it can't go far, without needing another squirt of grese.
05:50 PM WormFood: But to be fair, I've had a lot of fun with Windows
05:50 PM WormFood: That's another way of saying, I only use Windows for playing games.
05:51 PM guanche: I got into windows because I was tasked to do some excel add-in in COM, what a nightmare, had to reverse that part of Excel because the "comunication" "protocol" when excel starts up for it to recognize the bloody add-in is not documented anywhere
05:51 PM WormFood: That's not true either. I just rarely play games. Anyways, I'm hoping that Microsoft will drive Windows into the ground, and something new will come from the ashes.
05:52 PM WormFood: I can't believe I'm trying to read a memory chip, with only 5 address lines.
05:53 PM WormFood: at least it will be trivial to do.
05:53 PM guanche: using SPI?
05:53 PM WormFood: no
05:53 PM WormFood: It's traditional, 5 address pins, and 8 data pins
05:54 PM WormFood: 32 bytes
05:54 PM guanche: hehe, nice
05:54 PM WormFood: no joke. They actually made 32 byte memory chips (PROMs)
05:56 PM WormFood: and I was hoping to make something that could program a 1702, the first commercial EPROM, but then I decided, that trying to generate -47 volts, was just too much hassle.
06:30 PM twnqx: pretty easy with some inverting switcher, but those usually deliver little current
06:38 PM WormFood: You need little current, however, where would you get an IC to program?
06:41 PM twnqx: hmmmm
06:41 PM twnqx: now thta russia is off limits, it probably became harder