|
ante posted:Counterpoint: if your issue with dead code is that you have to scroll past it, modern IDEs will minimize the section so you can't even see it My IDE specifically flags it with a warning and says "delete this, idiot, that's what version control is for"
|
# ? May 6, 2023 19:48 |
|
|
# ? May 29, 2024 16:37 |
|
Honestly the problem I've always had more than just having to scroll past it is it's never really "dead", if it's commented out it's still gonna get caught in find/replace all and things like that (and if you have to uncomment it later it might suddenly have a bunch of bizarre mutations due to that, had that happen a few times) and if you just make it unreachable your IDE will still consider it in refactoring (may or may not be what you want but I've had that bite me before), or even throw compiler errors or stuff like that.
|
# ? May 6, 2023 19:53 |
|
There's definitely been occasions where search catching the greyed-out-by-the-IDE code has helped me, like in figuring out bugs like a manager complaining he can't ping the board from his Windows machine and eventually hunting out that LwIP just has "support being pinged from Windows machines turned off by default" via macro. But either way, I don't think there's any right or wrong answer here, it really is just preference, and the compilers hardly help. Recently on one microcontroller (I forget which) I found 40K of flash in Release mode (when the chip only had like 64K flash) was being used by the provided "configure system oscillators" function, which just took a few parameters deciding options. I was able to reduce that flash usage to 500 bytes or so in a way that made me feel a little dirty - copy and paste the source for the function into my file containing main. The compiler was then able to optimise for the actual parameters and get rid of the millions and millions of ifs it contained.
|
# ? May 6, 2023 20:00 |
|
Shame Boy posted:My IDE specifically flags it with a warning and says "delete this, idiot, that's what version control is for" I don't think we're talking about commented out code, yeah, delete that. We're talking about preprocessor directives that can change depending on LwIP flags that are enabled
|
# ? May 6, 2023 20:03 |
|
ante posted:Obligatory: Sure you could do that. I'm just the kind of nerd that likes to know how everything works and I've never played with Ethernet before so I'd like to learn more about it. I'm going to have to support this thing so I really should know how the code base works and not have a critical function that is a complete black box if possible. If it starts to turn into too much of a time waster I can just revert to vanilla LWIP. While having the whole HAL framework is nice in that it generates (mostly) working code for you to start with I've been amazed at how obtuse and bloated that code is. When you step through it and watch what it actually does you see that it uses many, many function calls and configuration structs, etc. to just flip a couple of register bits. It has very few useful comments explaining what is going on. So I make my own function that just flips those bits directly and add a comment explaining generally what the option bits do and where they are explained more in depth in the STM datasheet. My intent, which may well turn out to be dumb, is to similarly start with a working HAL/LWIP setup and start ripping out stuff we don't need until I hopefully get a simple set of functions that do what we need (DHCP, UDP, maybe TCP/IP) and nothing more. Then comment the code liberally, assuming that whoever is reading it in the future is competent at C/C++ but may not know the MAC/PHY/protocol stuff well, and then explain generally what each part does and where they can go if they need to dig deeper.
|
# ? May 6, 2023 22:10 |
|
Are you asking about Ethernet itself, or ARP/IP/UDP/TCP? Using stuff in a microcontroller, you'll generally get a (slow) MAC peripheral. That will have some chip-specific interface for how you tell it to do things like send frames, filter what it receives, when to interrupt, etc... It doesn't know anything about TCP/IP except maybe things like hardware checksum calculators. That will output to an external PHY chip via some MII standard. The PHY encodes to twisted pair cabling. Typical vendor HAL code is trying to give you a "I want to send this ethernet frame" interface without having you need to understand the MAC peripheral registers, in the same kind of way HAL serial code is trying to make you not need to care about the chip's specific UART peripheral registers. What content to actually put in those ethernet frames is left up to software, which is where something like LWIP or a vendor TCP/IP stack comes in. Implementing ARP/IP/UDP isn't that hard, implementing TCP is a lot of work. Those are trying to take you TCP/IP idioms ("Open a connection to this IP, write this data, close the connection") and turn it into a sequence of ethernet frames to send.
|
# ? May 7, 2023 00:06 |
|
I guess really I'm looking for the ARP/IP/UDP/TCP part. When you plug an Ethernet cable into the port what is the sequence of messages that go back and forth to establish the link, then reach out to a DHCP server to get an IP address, etc. Basically I want to understand the protocols well enough that I can look at a Wireshark screen and know if what's going on is correct or not. I was somewhat surprised that I couldn't immediately find a book explaining all of that stuff, the book I linked earlier kind of does but not fully. I have my microprocessor with a MAC and PHY chip designed, built, and sitting on my desk, connected via RMII. I couldn't get the PHY used in STM's dev board so I'll have to take their code and go through it to see what if anything needs to be modified for the chip I could get. But my PHY is from the same company/lineage as the one STM used so hopefully that won't be too bad. I took a brief look at the MAC and while there are a fair number of moving parts the two biggies are basically DMA controllers that do the TX/RX to the PHY. The part I don't understand right now is what bits I should be feeding into the TX buffer or how to interpret a frame sitting in the RX buffer to decide how to respond to it's contents.
|
# ? May 7, 2023 01:02 |
|
I think TCP/IP Illustrated by Stevens is that book, it's like 25 years old now though. I think it is all relevant still
|
# ? May 7, 2023 01:17 |
|
PDP-1 posted:I guess really I'm looking for the ARP/IP/UDP/TCP part. When you plug an Ethernet cable into the port what is the sequence of messages that go back and forth to establish the link, then reach out to a DHCP server to get an IP address, etc. Basically I want to understand the protocols well enough that I can look at a Wireshark screen and know if what's going on is correct or not. If you don't mind reading RFCs, then IPv4 is there, telling you what should be in these packets. If you need to go lower, there's the various flavors of 802.3 that tell you how the actual ethernet frames over whatever specific PHY you're using (10baseT, 100baseT, etc). IP is layer 3. MAC is layer 2. Ethernet is layer 1/2, much like RS-232 is layer 1/2: what flavor of 802.3 you're using tells you both what wires to use as well as what signal levels to expect, and how messages made up of those signal levels at what rates can be transmitted. ARP can tell your layer 3 thing how to talk with your layer 2/1 thing, and is a layer 2 thing itself. UDP/TCP are layer 4. They use layer 3 (n.b. tcp/ip udp/ip) to communicate over whatever is below them. This is why it's legal to have joke specs like "UDP/IP via carrier pigeon." The PHY is a flying bird, but neither IP nor UDP care; they just specify how messages are transmitted. ARP on this interface would just give you the name of the pigeon carrying your strip of paper with your UDP data in its IP header.
|
# ? May 7, 2023 02:28 |
|
taqueso posted:I think TCP/IP Illustrated by Stevens is that book, it's like 25 years old now though. I think it is all relevant still Yeah, that looks excellent. There's a newer version from 2012, I'll get work to order me a copy on Monday. Thanks!
|
# ? May 7, 2023 02:35 |
|
PDP-1 posted:I guess really I'm looking for the ARP/IP/UDP/TCP part. When you plug an Ethernet cable into the port what is the sequence of messages that go back and forth to establish the link, then reach out to a DHCP server to get an IP address, etc. Basically I want to understand the protocols well enough that I can look at a Wireshark screen and know if what's going on is correct or not. For the Wireshark side you can run Lwip on Linux in userspace and see what it does (there's projects to do this on Github, via things like TUN/TAP). Wireshark will obviously tell you if you get your frames wrong too, since it'll highlight bad ones in red, so you can even hack it up and see if you can break the packets/etc. if that's what you want to try. Basically in terms of Lwip, once the MAC RX/TX DMA is working, you just feed Lwip everything that appears in RX, and when Lwip calls you back to say it has something to send, you stuff it into TX without any thought. So this is still in the realm of "writing a TCP/IP stack", not that there's anything wrong with writing a TCP/IP stack of course (as a hobby - places I've worked would definitely balk at the suggestion for actual products both from a time and a security perspective), and I feel you should at least consider going and hanging out on the osdev.org forums where people love this kind of thing (do we have an osdev thread here? It seems like something some goons must have done). As pointed out, there's RFCs for everything that happens beyond "I got a packet in from my MAC" and "I want to construct a packet I can send out via my MAC", which sounds like the stage you're at, so you can basically just send whatever you want now.
|
# ? May 7, 2023 03:19 |
|
hey i'm the person who put the kapton tape on my 7000K fridge and freezer LEDs. well i realized three layers was too much, but I had trouble getting off the tape on the freezer light. so instead of being careful, like a total idiot i tried to use a little knife to get it off and now i have no light in my freezer. I contacted Samsung about a replacement part as I can't find one online. anyway thank you for listening if anyone knows good sites to check though lmk the fridge model is RF18A5101SR edit: the LED model is DA41-00519R, but it's a newer version, revision 3.0 edit2: oh god i could have just gotten it out of there and taken off the tape easily but i'm stupid I loving HATE BLUE LIGHTS actionjackson fucked around with this message at 21:05 on May 7, 2023 |
# ? May 7, 2023 20:30 |
|
So I've used these guys for other parts and they've been great but uh.... $109 for three LEDs? https://www.repairclinic.com/PartDetail/Led-Light/DA41-00519R/2031107 It says 'Special Order' so it sort of implies they're just drop shipping it from Samsung anyway, so that's probably the same price they'd charge you but I don't know obviously.
|
# ? May 7, 2023 21:34 |
|
Rescue Toaster posted:So I've used these guys for other parts and they've been great but uh.... $109 for three LEDs? https://www.repairclinic.com/PartDetail/Led-Light/DA41-00519R/2031107 cheaper to just find three warm white LEDs with the same pad layout and reflow them on your stovetop.
|
# ? May 7, 2023 22:15 |
|
Less time consuming at this point, to learn to do it, too
|
# ? May 7, 2023 22:23 |
|
Just don't, like, somehow attach them direct to the compressor or something until this ends up like some kind of old lady who swallowed a fly-type fridge situation.
|
# ? May 8, 2023 00:13 |
|
I mean if you search for DA41-00519R on ebay you'll find people selling stuff that claims to be compatible (and I mean, it's a 12v led strip, so the only thing to be compatible with is the connector) for like $10.
|
# ? May 8, 2023 00:50 |
|
Rescue Toaster posted:So I've used these guys for other parts and they've been great but uh.... $109 for three LEDs? https://www.repairclinic.com/PartDetail/Led-Light/DA41-00519R/2031107 yeah I saw that one (which is as you mentioned way overpriced), and have looked on ebay and otherwise, but they don't have my version which says revision 3.0 on it the ebay ones are typically the first version from 2013 also i'm the person with no electronics experience, so soldering or whatever the hell you guys do isn't an option. i'll see what samsung says actionjackson fucked around with this message at 04:36 on May 8, 2023 |
# ? May 8, 2023 04:33 |
|
actionjackson posted:
Guess how many of us got that experience. It was very similar to “$Xxx for Y? No way. I’ll figure out how to fix it.” Join us.
|
# ? May 8, 2023 05:12 |
|
actionjackson posted:yeah I saw that one (which is as you mentioned way overpriced), and have looked on ebay and otherwise, but they don't have my version which says revision 3.0 on it We've got a great "introduction to soldering" thread over in BYOB of all places. There's a kit you can buy on Amazon that comes with everything you need. It's a great skill to have: even if you can't fix this current thing with it, I guarantee you'll fix something else later. https://forums.somethingawful.com/showthread.php?threadid=3976179
|
# ? May 8, 2023 05:15 |
|
cruft posted:We've got a great "introduction to soldering" thread over in BYOB of all places. There's a kit you can buy on Amazon that comes with everything you need. It's a great skill to have: even if you can't fix this current thing with it, I guarantee you'll fix something else later. Also, it's perfectly normal to think that your soldering jobs suck when starting out. Some of us never shake that feeling.
|
# ? May 8, 2023 06:08 |
|
ryanrs posted:ST Forum: Does USB device code for STM32 really allocate dynamic memory from interrupts? That reminds me of spending several weeks trying to track down a rare flash memory corruption bug on a vehicle telemetry system. The ultimate culprit turned out to be the vendor-provided low level code which kept track of the open filesystem handles. It didn't use any form of thread safety so when the OS timeslices lined up just right and a context switch triggered during that code, two threads would wind up being given the same file handle pointing at the same memory. This lead to some very amusing symptoms like files being unable to ever reach EOF, files being closed and written to flash twice, or never, files ceasing to exist at random times, and files re-existing after being deleted.
|
# ? May 8, 2023 06:15 |
|
While designing an embedded device, I had a co-op student who had some free cycles. I got him to write essentially a CANBus fuzzer. My software team insisted that it was a waste of time, there were no unknown code paths in the communication stack. We found a race condition that would reliably crash the device in like, four hours.
|
# ? May 8, 2023 07:00 |
|
For Windows CE one of the tools Microsoft provided (which was required to actually ship e.g. a Windows Mobile device) was just a tool that'd click the screen at random and open/select menus (which it had special knowledge of, beyond just clicking the screen, to ensure it'd reliably trigger menu-based functionality). The longer it'd run (on the scale of like 24 hours or more) with multiple seeds, the more Microsoft were happy for you to ship your device. It would stop the moment it hit any crash. I worked at a company that had a multiplatform product including Windows CE, and occasionally OEMs wanting to integrate our stuff would send these crash reports consisting of the tool, the seed they'd used, and the report that it'd crash in 7 hours. They were right, it did, but normally it was much easier to produce than their suggested "wait 7 hours" (though if they didn't happen to have any further info, we'd need to do that at least the first time).
|
# ? May 8, 2023 07:12 |
|
ante posted:My software team insisted that ... there were no unknown code paths in the communication stack. Software engineer here. I would like to say to your software team that hahahahahahahahahahahah you fools. Thanks for listening.
|
# ? May 8, 2023 11:23 |
|
drat if they solved the halting problem they really should publish that in a CS journal instead of hoarding the knowledge
|
# ? May 8, 2023 15:21 |
|
BattleMaster posted:drat if they solved the halting problem they really should publish that in a CS journal instead of hoarding the knowledge They are keeping it locked in their desk in case anyone wants to challenge them as the town computer scientist.
|
# ? May 8, 2023 15:43 |
|
cruft posted:Software engineer here. Yeah, I know. I'm trying to train hubris out of them, but I think they teach class in CS at university
|
# ? May 8, 2023 16:32 |
|
actionjackson posted:yeah I saw that one (which is as you mentioned way overpriced), and have looked on ebay and otherwise, but they don't have my version which says revision 3.0 on it Link to the highest-res image you can of this 'Version 3.0' you have. Just because Samsung had to buy slightly different LEDs or something and caused a rev change in the board doesn't mean one of the other ones won't plug right in and be fine. It genuinely seems like you're looking at a 12v led lamp and that's it.
|
# ? May 8, 2023 19:53 |
|
Rescue Toaster posted:Link to the highest-res image you can of this 'Version 3.0' you have. Just because Samsung had to buy slightly different LEDs or something and caused a rev change in the board doesn't mean one of the other ones won't plug right in and be fine. here it is omg i could have just unplugged it too i'm so dumb please ignore the knife marks
|
# ? May 8, 2023 20:16 |
|
On one hand, any part with the same part number should be compatible regardless of the revision number. On the other hand, if you did just a little soldering you could put LEDs of whatever color temperature you wanted on there and be done with the tape altogether.
|
# ? May 8, 2023 20:47 |
|
Well, except that he's scraped up the traces on the PCB and apparently now it doesn't work. I think the main takeaway of this whole situation, actionjackson, is that you don't need to buy a new board by any means. There are a dozen ways to fix this if you are willing to learn electronics. You are posting in the Learning Electronics thread, so...
|
# ? May 8, 2023 20:52 |
|
I think the current problem is he cut apart one of the LEDs, not the traces. Replacing all 3 leds with something of the desired color temperature and a reasonable Vfd should work fine. actionjackson, If you don't want to solder it you definitely can buy any of those compatible replacements and it should be fine, don't worry about the v3 thing, there's nothing special about it. This is just a 12V LED light with a certain connector. You may luck out and be happier with the color of one of the alternatives anyway, since they're probably using a grab bag of cheap LEDs.
|
# ? May 8, 2023 21:21 |
|
wire up rgb leds for extreme gamer fridge
|
# ? May 8, 2023 22:16 |
|
thanks, i'll see how much it costs to get a replacement first, or if there are other options
|
# ? May 9, 2023 00:02 |
|
If you want to mail it to me, I will solder new LEDs on it with my hot air station. I have reels of 2700K Samsung LM561B LEDs, as well as smaller amounts of other color temps. I use those same LEDs in my Bear Radar project.
|
# ? May 9, 2023 02:22 |
|
ryanrs posted:If you want to mail it to me, I will solder new LEDs on it with my hot air station. I have reels of 2700K Samsung LM561B LEDs, as well as smaller amounts of other color temps. thanks, the ones in there are loving 7000K. i don't want 2700 though as that would be too yellow. what would be a good compromise, 4000K? honestly if I could buy one of these strips with a specific color temp that would probably be easier, does anyone sell them?
|
# ? May 9, 2023 02:29 |
|
Well here are your choices: 2700, 3000, 3500, 4000, 5000, 5700, 6500. If you have calipers, can you please verify those LEDs are 5.0 x 3.0 mm. e: LM561B dimensions ryanrs fucked around with this message at 02:39 on May 9, 2023 |
# ? May 9, 2023 02:35 |
|
oh cool thanks! i first want to verify that these are actually 7000K. i only found this number once when I was looking up the fridge light strip. But I'm not sure if it's accurate, so I want to check with them. Online I see this for the fridge one ASSY LAMP LED;5,FR-4,150*12,WHITE,SMAW25 I assume that's 4150K, so maybe I was wrong. edit: does anyone know what "cem-1,65*10*1.6t" means? 6500K? actionjackson fucked around with this message at 02:56 on May 9, 2023 |
# ? May 9, 2023 02:51 |
|
|
# ? May 29, 2024 16:37 |
|
actionjackson posted:ASSY LAMP LED;5,FR-4,150*12,WHITE,SMAW25 FR-4: normal fiberglass circuit board 150*12: probably 150 x 12mm board size
|
# ? May 9, 2023 03:13 |