Previous Thread: >>2928655Here we discuss microcontrollers (MCUs), single board computers (SBCs), and their accessories, such as Atmel mega and tiny AVRs (Arduinos), PICs, ARM boards such as blue/black pill STM32, ESP8266/32s, RP2040, Raspberry Pi, and others.For general electronics questions (power supplies, level shifting, motor driving, etc.) please ask /ohm/.>where can I find verified quality microcontrollers and other electronic sensors or partsdigikey.commouser.comarrow.comnewark.com>but that's too expensivealiexpress.com (many parts here are fake, particularly specific parts out of stock in the above sites)lcsc.com>I need a part that does X and Y, with Z specifications. How can I find it?use DigiKey's or Octopart's parametric part search. Then purchase from one of the sellers listed above.>how do I get started with microcontrollers, where should I start?There is no defined starting point, grab a book and start reading or buy an arduino off ebay/amazon and start messing around. There are a plethora of examples online to get started.>resources:https://github.com/kitspace/awesome-electronics>RISC-V microcontroller list:https://codeberg.org/20-100/Awesome_RISC-V/raw/branch/master/RISC-V_MCU_development_boards.pdf
>>2952647Arduino is not cool. In fact it's fucking stupid in multiple ways.
>>2952826Are we gonna start hating on starter kits now?
Which is the easiest SoM to build a PCB for and get it to work with an embedded linux? Aren't there any templates with the right footprints and conducting traces for a basic periphery? As well as a pre-configured embedded linux? I basically seek a starting point to jump off the development board onto the self-designed board.
>>2952826i'm a noob. what's stupid about it
>>2952861It doesn't require signing your life away for an awful clunky toolchain that's bloated to all hell for some reason, and doesn't require a spaghetti of wires to an expensive bespoke programmer to develop for it.Therefore, "real" embedded devs hate it.
>>2953044The Arduino IDE is the most clunky thing I've ever encountered, except maybe for the vendor Eclipse IDEs, that only idiots use.
>>2952826it's a general purpose prototyping board, it's not cool inherently. It does what it needs to and is relatively easy to adapt to changing requirements. I don't want to have to configure SFRs just to spin a motor when a button is pushed, my boss wants me to have a functional prototype yesterday. The PIC16F that will be used in production isn't cool either, but it's cheap, reliable, and and will be configured to the product spec that is already written before it even gets selected.
>>2953076How are pics still a thing how much are they saving per unit a nickle? And it has to be programmed in assembly how much does that cost?
>>2953086There are compilers for PICs. I think a lot of the use of PICs these days is with legacy designs where the code is already written, I see them in multi-stage lead-acid battery chargers, that kind of stuff where youād need under 50 lines of C anyhow. Doesnāt matter how inefficient your compiler is at that point, maybe these things are written in Basic. Thereās also 32-bit PICs that surely nobody programs in ASM.
>>2953044>>2953049>>2953076what mcu do the cool kids use?
>>2953049You don't need the IDE. You can just use avr-gcc and avrdude.
>>2953049how is it clunky? just type da code and compile and upload
>>2953174I know, but it's annoying how the IDE hides all the tool use, which could be pretty simple, and even needs to do that init/loop bullshit.
>>2953176It's designed for babbies, who would be confused by such things
>>2953223Stop being such an elitist debby downer and make something cool. The fish wont care you used an arduino to feed them. Bedides youre not getting an embedded job without a license anyways.
>>2953146Arduino is dinosaur tech which began with a 20 year old microcontroller. 8bit MCUs are going extinct.Anyway the cool kids might use stm32, which is a pretty modern, extensive family of processors. As few as 8 pins, or over 100 if you want. They have the "nucleo" dev boards too which makes it easy to get started. I've used them and like them.ESP32 is also worth a look. The company Espressif has sold over a billion esp32s, they're everywhere. Cheap devboards but extremely capable (lots of flash, lots of ram, and high clock rate, up to 240MHz IIRC)
>>2953255I'm using a teensy 4.1, which I kind of lump in with Arduino because it uses Arduino IDE. It's pretty powerful.
>>2953255>8bit MCUs are going extincti just had a look at the new avr generation and i dont think so.
>>2953174Then it's just an overpriced ATMega/ESP/whatever the fuck they use now development board>>2953255ST is pissing me off with the whole Cube stuff, having to register with full name and address. ESP is nice, ESP-IDF is good to work with desu.And I think AVR 8bit MCUs are here to stay.
>>2953229I didn't say there was anything wrong with that. If you know enough to need more, you can figure out how to get it.>>2953488>Then it's just an overpriced ATMega/ESP/whatever the fuck they use now development boardDuh, but why would you ever buy a real one? Chang will happily sell you ten functionally identical knockoffs for the price of one genuine Arduino⢠board. As a beginner, that gives you access to all kinds of Arduino-oriented handholding AND nine chances to keep going after badly fucking up.
>>2953488>ST is pissing me off with the whole Cube stuff, having to register with full name and addressThis alone drove me to other micros when I was picking a chip for a project.I'm sure there are probably thirdparty toolchains that don't have this crap, but I can't be bothered to investigate when other chips work out of the box with no strings attached (also the supply chain issues of the time didn't help ST's case).
>>2953554Back when it was new and ST guys were first trying to shill it, I looked at Cube and decided it was shit. Being able to pick a configuration with a Windows gooey app might be cute and impress PHBs and Arduweenies, but as I recall it generated *customized* header files. So much fun if you've actually got a product that you want to keep track of in source code control.I never stopped using their old hardware libraries, which were flawed in other ways, but didn't change due to a fucking checkbox.
Putting esp32's on custom pcbs. What, pray tell, do I actually require to be able to use serial over USB? Supposably you need a quart/USB chip, but there is also mention of it being native to the esp32, pins 19/20?
>>2953076>PIC16FIs it possible to use a Raspberry Pi Pico to play the role of a PIC programmer and transmit data between them using a very thin wire carrying a signal through USART so as to have a Pico and a PIC picking up and passing pieces of data though a wire thinner than a toothpick?
>>2953486I looked now because of your post and yeah the new avr stuff is pretty cool. I take it back, there's still space for 8bit
>>2953146Different kinds of cool kids everywhere.The pic stuff has some interesting options for extra peripherals. The language and your ultimate goals are the key. It is nice to use an interpreter like with Flash Forth, or Micropython, or Circuit Python. Any of the Forth languages can be fun. However, you will be doing stack based programming, so branching is a bit more complicated. Anything from Adafruit with support for Circuit Python is nice and well documented. Thony is an easy way to interface without some electron, google, or microsoft stalkerware. The cool kids take the time to learn both Emacs and Vim, usually Doom Emacs and NeoVim.
>work has 3 high school kids as interns for the week>kid I'm assigned says he has thousands of hours in Warthunder and WoW>hand him a box of microcontrollers, breadboards, and other electronic scraps and tell him to figure out how a transistor worksHe was entertained for the entire day, and he can't wait to continue tomorrow.
>>2953760that's cool of you anon. did he figure it out?
>>2953778With a little help, yeah. Had him solder LED blinker circuits at the end of the day.
>>2953488> 8 bit is here to staySadly, DIP or PDIP is slowly leaving us.This is because the materials of the packaging (shipping, epoxy, lead frame, bond wires) cost way more than the actual die. Neo-Nexperia is finding this out now. So weāll see more bare-silicon/flip chips since factories are getting better at using raw dies. Weāve had the black epoxy blob for decades. Bad for the diyāer. Get good at making carrier boards.8 bit may also leave us for various complicated reasons. Weāll probably be emulating 8051s and z80s with ARM in the near future.Home devices that only need 4 or 8 bit cores (like breadmakers, toasters, juicero, etc.) will soon want to be wired to the internet for the āservice modelā idea which 8-bit cores canāt really do by themselves.
>>2953806that's sad about dip. i don't mind SMD that much but i probably would have found a different hobby if i had to deal with SMD only. but smd will likely get easier in time as well with cheaper solutions
>>2953588Which ESP32 model? Some of the more recent models have native USB capability, and some can even be programmed by USB without a hacky bootloader, but from what I remember they needed to be told to enable this first. Or that you need to cycle power, or push the programming boot button, or some other caveat that makes it less convenient. Unlike an RP2040.If youāre just using UART to program them, you can use one or two of the flow-control pins to pull down the boot button or whatever, so you donāt have to press the button manually. Take a look at the schematic of a NodeMCU board to see how they did it.>>2953682Wire thickness isnāt an issue at all. 30awg can carry USART, no problem. I donāt know how PIC programming works outside of a PIC-kit, but I think Iāve seen one or two projects that implement it on custom hardware. One was on another PIC, which isnāt surprising.>>2953760Fun. I wish someone gave me that kind of internship out of high school, instead of going off to university for a useless degree.
>>2954113S3-WROOM19/20 are on USB data lines for programming, apparently I have to put the chip in USB otg mode or some shit. Eff that I'll just ftdi off board.
>>2952647Stupid question: I bought a bunch of these weak laser diodes off Amazon a while back. I think theyāre rated 3 to 5 volts. I was just using them with 3 volt coin batteries but I want to use them with an arduino project. Do I need a resistor or a transistor to connect them? If so what kind? Also, even dumber question: can I make them brighter somehow?
>>2954873Lasers are kind of like LEDs, but usually much more fragile, so they need current limiting.A resistor should be enough for low power ones (IDK the exact value, you'd need to look that up), but a proper driver circuit is best practice and almost mandatory for stronger lasers.You cannot make them much brighter. Overdriving them will quickly destroy them.If you want the most brightness for any given strength, go for green lasers since our eyes are most sensitive to it.I know this sounds like a broken record, but be careful lasers. The type you have are probably genuinely <5mW and fairly safe, but strong ones can easily cause permanent eye damage (a reflected hit with a "weak" 20mW laser caused a spot in my eye for over a day), and online sellers habitually lie about the ratings (sometimes by hundreds of times) to skirt regulations.
Did I fuck up my pcb design so psram (U11) sees noise?Long story short I making a cartridge for zx spectrum, and that thing has pico as well as PSRAM chip. Whenever I plug my custom ZX Spectrum cartridge in, the PSRAM starts spitting errors on a self test ā even if the boardās powered by USB and the +5 V from the Spectrum is cut.ZX address/data lines (A0āA15, D0āD7, MREQ, RD, etc.) go through 74LVC245s for level shifting to 3.3 V. Spectrum ground is tied to the same plane as everything else on the board.If I cut A0āA7 lines from spectrum (by an adapter board), PSRAM self test passes. So it feels like the Spectrumās bus noise or ground garbage is messing with the PSRAM/flash.gpt suggests the followingā Separate ZX/buffer ground and tie it to main ground at one point?ā Add ferrite or resistors between ZX 3V3 and main 3V3?ā Series resistors on each ZX line?ā Some shielding or layout trick Iām missing?But I am just a beep boop guy I don't know this high rf woodoo magic. RP2350 runs at 280mhz, PSRAM is driven at around 100 and spectrum is only 3mhz.
I'm planning to use an LMP91000 to measure signals from a 3-lead electrochemical cell. Has anyone here worked with the TIA or similar setups?Is it easy to implement ?
>>2955036You forgot the easiest thing to tryāstart soldering decoupling caps in random places.Also, make sure the zx has any old caps replaced and it wouldnāt hurt to add decoupling caps there, either.
>>2955332I actually have like 15 of them - the pic doesn't show them all
>>2955036I'm seeing lots and lots of broken attempted ground planes with traces crossing them and very few stitching vias, both of which are no bueno for noise since AC signals are going to travel all around your board without a short low impedance path to ground.I suggest switching to a 4 layer board with dedicated ground layers or completely redoing your layout while keeping traces on one side of the board to a minimum
>>2955592ah, I've already sent this version for production - i've taken PSRAM chip closer, made CS line shorter, and in a follow up pic put ground plane for ZX buffers into a separate region.
>>2955592>>2955611This is selected area of special ground plane I've made for the buffers, as these are leaking per gpt. I've mead a single ground tie so hopefully that current on those buffers goes back to ZX instead of affecting PSRAM.I've also removed ground plane under 0-7 pins between buffer and CPU so they wouldn't radiate into psram as much.Hope that helps, I don't know what I am doing.>stitching viasYou're saying just cross planes with vias to make ground plane more uniform?
>>2955612Single ground tie makes for a pretty bad high frequency ground and removing the ground plane under pins means they're now radiating more than if they had a plane under them>as these are leaking per gptChatGPT is terrible at electronics. Look at any artbyrobot thread for what happens when you rely on chatGPT.Stitching vias are for connecting ground planes together, but I posted that before realizing your top plane is 3V3 instead of ground. Having a power plane like that is probably overkill for whatever you're doing and complicates routing compared to properly sized traces.I highly recommend this channel for a good intro to SI if you don't have time to watch/read lots of Eric Bogatin interviews or articleshttps://www.youtube.com/@HansRosenberg74/videos
>work inna factory>factory heavily dependent on compressed air>we have 3 air compressors for this purpose>no centralized controls for them>me and coworker short of obsessed with optimizing their load/unload settings>reached a point where we need to check if, and how often, a specific compressor unloads>go no data collection in the compressor about this>slap together a breadboard with an ESP32C3 and a SSD1306 to hook up to a NC switch on the compressor's main contactorIt simply counts how long it's been on for and how many times the contactor has shut off and prints it to the display. Gonna leave it over the weekend and see what it says.This microcontroller shit is useful. Glad I got into it recently.
just ordered like 15 CH32V003 dev boards since they were under a dollar a piecedid I fuck up?
>order random T48 set off of Amazon>have to install the right libusb-dev to build minipro>even worse fuckery trying to get it installed on an old Mac too, but I think I got it working>try to run algorithm extract script>it locks up in one of the steps to extract from the .exe>have to fuck around with the script to get it to extract successfully>finally get it working>realize after all that fucking around that the algorithms were probably only needed for T56/T76 anyhow, but I don't care>realize that it had a really old firmware on it>more fucking around to find the appropriate update file>get it updated from linux, no winderz were used during thisAnyhow, I was able to write to a little 12F519 chip that I had lying around, and read some random EPROMs.
CH32V003J4M6's are pretty fucking nuts, price-wise.
>>2955615Amazing input thanks anon
>>2955869Glad to help! Good layout isn't as mystical as it seems once you know where to start looking
>>2952647anyone here do any x86 assembly, specifically 64 bit? i know it's not a microcontroller isa but just asking.
>>2955615>ChatGPT is terrible at electronicsit really is. fucking retard gpt
>>2952647I finished a simple, two-day script to log data from an accelerometer with my arduino. It would have been one day, if not for some file on my SD that was broken and kept the getNextFileName() function in a loop. I'll calculate how strong the acceleration forces are for the people who drive in my household, to see why they say I'm driving badly. This is to improve my driving skills, not to prove that they drive just as badly. No, I'm not resentful.
>>2955937Nothing like spite to push a project onwards. Personally I bought a handful of openlog modules for data logging projects, tiny cheap boards with a 328P on one side and a micro-SD slot on the other side, with some I/O pins broken out. Havenāt needed one yet, but itās only a matter of time.
>>2955878a little bit, why?
quick question here: I'm trying to identify the pins of the micro usb port here, and it seems that VCC and GND are both connected to the circled connection. is that normal?
https://store.steampowered.com/app/2198800/CRUMB_Circuit_Simulator/Anyone tried this?
>mfw reading ARM assembly
>>2953146i recall circa 2016 reading somewhere that half of mcus of the "real industry" produced still were 4bit systems. i.e. programmable industrial thermostats, proximity sensors etc. Anyway, the mcu programming example from 'the art of electronics II' on MC6800 , a 50yo 8bit controller... it's how cool guys are doing stuff.>>2953255>8bit MCUs are going extinctzoomers are brain damaged>>2953086pics are fun. pics are also retarded. A lot of critical infrastructure still use them, a lot of oldtimers respect them.>>2953131asm is pretty much descriptive. it's just one abstraction layer away from C. You can write programs in x86_64 asm for pc also. >32-bit PICs that surely nobody programs in ASMwtf are you talking about. If you write bootloaders, you will most likely be involved in ASM.
>>2955878The loss of things like the Geode x86 SOC from Nat Semi/Cyrix/AMD is a travesty.Thereās no good reason they canāt take a single 64-bit efficiency core with no vector/fp ⦠add some peripherals⦠and sell it into the embedded market.It would crush, even at bigger process fab sizes.The only thing that prevents them is the world using it to run Windows XP again on a $10 dev board, but faster than it did in itās era.
>>2956369>is it normal that the USB port that supplies power was designed to make a short circuit?No. How did you determine that? Try plugging it in, and if the charger instantly heats up like a water heater, you were right to ask.Otherwise, get your multimeter again, put one probe on GND, and with the other, check the voltage of the far left and far right pins.
>>2955878>x86 assemblyI've always thought about doing it as a pastime riddle but what's the point(besides creating some memory stealing exploit) BC C language basically allows for the same abstraction layer. I've always thought of doing some parts in asm so that retards fuck shit up when trying to use my code.
>this week on "Things That Compile with Absolutely Zero Fucking Complaints from -Wpedantic"...
I AM THE KING OF THE MAGNETIC FIELDTHERE IS NO CHANGE IN MY LOCAL MAGNETIC FIELD THAT I CANNOT SENSEFEAR MY POWER
>>2957192Whats the plan here? Are you hunting ghosts?
>>2957192>slight breeze through room>all readings are offI hope you tape that stuff to a solid surface.
>>2957302>I hope you tape that stuff to a solid surface....Is would I would say...IF I WERENT THE KING OF THE MAGNETIC FIELDyou think my readings with be CONFINED to the dimensions of 2D? That they will need a HORIZONTAL PLANE to be EFFECTIVE? hah HAH hhaha HAHAHAHAHAHAHABEHOLD 6 DEGREES OF FREEDOM ACCELEROMETER AND GYROSCOPETHE BREEZE WILL SIMPLY BE DATA to be ERASED by the power of MATHthe X Y Z axis will be DEFINED to the PERAMITERS of WHERE EVER THE FUCK I WANT THEM TO BEthe TYRANNY of MOVEMENT and BEING UPSIDE DOWN has been USERPED BY TECHNOLOGY
>>2957297i... are ghost something that might mess with my magnetic field.... i... is that something I need to worry about ....?
>>2957367>THE BREEZE WILL SIMPLY BE DATA to be ERASED by the power of MATHSure, but you'll still need to tie the other boards to those, or the bending of the wires relative to the boards will offset your readings.
Hello, noob question ahead:I've never used microcontrollers, if I wanted to make a simple rechargeable (maybe) battery powered lcd timer (just a learning project) what board should I use? I think I have a chink arduino nano clone I bought on a whim lying around
Well first, just know that LCD anything except for those common (mostly 2x20) displays is a pain in the ass.But yeah, this sounds like a standard Arduino project. Start with something talking to the display, then get it counting time, then make it count the right way, then figure out how to hook it up to a battery bank.The important thing is one step at a time. Don't try to do too many new things at once with hardware or you will get stuck and unable to figure out what's wrong. You don't go from zero to a 6502 computer or an MP3 player. Break it up into steps.
>>2957421I really underestimated how easy it would be to make a functioning quaternions now I feel like udder fool :( I thought I was a master of magnets but I was only a master of my own hubris
>>2957727> a chink arduino nano cloneAlmost anything would do for a timer.Might as well re-use the nano clone.>>2957763> lcds are a pain in the assAgreed. If you are clever, you could use one or two LED 7-segment displays. (e.g. 9 hour, hour granularity display/separate minute display and set)> rechargeableThatās not a real requirement. Any battery powered device could also be hard-wired and vice-versa.
>>2957822Anon, IMU fusion is a modern marvel of mathematics that took 6 decades of work by the world's smartest people to develop. There is no way you could understand it in a single day.
Does anyone know why these types of drivers have separate +5V inputs for the pulse, direction and enable? I mean everyone seems to just wire them in parallel so why not just bridge them internally?
>>2957924A: they can be used as differential inputs for better noise immunityB: theyāre internally connected to optocouplersProbably the former
What is the current software situation in general? I'm tired of broken vendor IDEs and bloated HAL libraries that eat up flash just to perform basic functions. Should I just throw out everything and deal with registers directly? GPIO is easy enough to get going but something like I2C is going to take a while to figure out on 32-bit micros. I'm tempted to learn forth to avoid bloat and enjoy simple interactive development and ability to just connect over serial to develop without any special tools, even if I'm stranded at some remote location with nothing but bluetooth serial module and a phone. Does anyone have experience in forth? Is it possible to develop reliable software with advanced features multitasking and using advanced peripherals like DMA? How do you even handle interrupts in forth? Can I even implement efficient digital filters in it? It seems to me it's only good for simple automation tasks, but it becomes very difficult to work with it if you want to develop advanced algorithms or deal with non trivial data structures.
>>2957827>Almost anything would do for a timer. I see, that's nice to know, thanks!
>>2957763Thanks for the advice, that makes a lot of sense to make starting out less daunting. I found the wokwi arduino simulator and I started screwing around with it a little just to get a feeling for the coding. But I think I'll go with externally recharged batteries to save myself some hassle for now
>>2957978>But I think I'll go with externally recharged batteries to save myself some hassle for nowWell yeah, duh. Kids these days don't know how good they have it with 2 watt USB power bricks and hueg lithium ion battery packs being thrift store trash. Most of the time you don't even need to waste your time autistically cutting power usage.When I was a kid I had to deal with my parents freaking out over wanting to make a 7805-based power supply from radio shack parts. (and I still have it)
>>2957974PlatformIO is passable, if you hate Electron apps then text editor and command-line compilation and flashing it is. Assuming you canāt stand skins of Eclipse. No clue how to automate the makefile or import the hardware specific syntax highlighting of register and bitmask names though.Direct register manipulation in C is probably the way forwards, but even if the vendor HAL is bloated thereās nothing stopping you from writing your own extensive macros for simplifying the process of setting up timers and ADCs and such. Spend a few hours figuring it out once, and youāre good for life. C compiles well for most MCUs out there, especially 32-bits, I wouldnāt trade it for anything unless I had a hardware-based reason to.
any1 know how I can get my mkl25z128 to not hardfault when there is a floating point specifier in sprintf (`sprintf(perkele, "ADC: %d , voltage: %.2f",adcval,voltag)`)I tried using -u _printf_float in the linker option in keil but it says it does not recognize it. perkele is big enough.
>>2957297Holy crap you weren't joking. Using an AS5600 combined with the IMU, there are spooky magnetic fields that pass by all the time. Some of them even move slow enough to look like human walking.
>>2958269I tend to use and do everything in integer math. Especially on embedded systems.Multiply your voltag by, say, 1000, do stuff, then prnt it out as mV or insert a . three places to the left.
greetings.attempting to make a genlockable analog sync generator using a EPM240 fpga, stumbed upon a problem with horizontal sync separaton - it doesn't play nice with vertical interval.composite sync is pre-separated with LM1881 and is lowered from 5 to 3.3v via voltage divider.fpga program in verilog simulates a one shot multivibrator with a timer, simulation seems to separate sync just fine but on hardware this happens.is this a code issue or should i drop this idea altogether and use a regular flip-flop for that instead?
>>2958415> 3.3 voltsThe device probably runs natively at less than 1.8 V so 3.3 is pushing the upper limit there. Iād level shift it down some more and clamp it to some threshold. The logic levels might not be right either.> and use a regular flip-flopAlmost certainly.Fpga is n^n^n overkill. Plus the discrete logic will be much more voltage tolerant.
>>2953044Midwits love gatekeeping. There is nothing wrong with arduino. Its simple intuitive and fit for 90% of stuff.
>>2953255>8bit MCUs are going extinctWhole industry runs on it. For 90% of things you dont need more. Please telll me reasonable home project that needs more.
>>2958494Arduino is garbage on a technical level. And since idiots flock to it, its ecosystem is garbage too.That's not saying it's not useful or that you can't use it. It's like eating fast food.
>>2958502>its ecosystem is garbage tooI see people say this, but then it's like, I try to make something using a PIC, and there is a $500 paywall for stack libraries, that you still need to do 40 hours of debugging on to get working wellthen its like, it's already free on Arduino and it actually works
Embassy is cute, Rust's stackless coroutines are the perfect fit for 32-bit MCUs.
>>2958553This is unreadable garbage. Main job of a programming language is to clearly communicate the computational process. No wonder rust programmers have trouble implementing even basic software like core utils without having logical bugs everywhere. So much noise just to implement a basic task. For what?
>>2958554>but muh memory safteezThe other problem with rust programmers is a compulsion to rewrite fucking everything from scratch. Starting with the bottom of the stack.
>>2958554> a programming language I don't know is unreadable for meWhat are you trying to say? Everything is unreadable if you're illiterate.But my point is not the syntax, which is fine; it's the ability to conceptualize your uC code as a collection of pseudo-parallel infinite loops communicating via mutexes or channels, each sleeping independently. All this for zero-cost performance-wise. That's a nice abstraction to have.>>2958563Yes, I'm trying to rewrite a two-button and an LED test project from scratch, shame on me.
>>2958567>Everything is unreadable if you're illiterate.I'm just questioning a choice of using Qinjiang Mandarin when english works perfectly fine for what you're trying to accomplish. You might understand your code now but what about in 5 years from now? I can modify my old C code perfectly fine even if I don't look at it for years because language is so small as there is no complex abstractions that you have to keep in your head. It might be zero cost performance, but it's not zero cost maintenance. I already have to understand underlying hardware which is complex enough and now I would have to add another layer of complexity with language just as complex as hardware below?
>>2958578> english works perfectly fineTo continue your analogy, English may work perfectly fine when you discuss Shakespeare, but if you try to discuss Confucius, English is a poor choice, because you'll have to spend a lot of time expressing all the nuances a single Chinese character has. That's why most people outside the US actually learn foreign languages.> what about in 5 years from now?I will understand it just as well? How is it different from any other programming language? There's nothing inherently hard about Rust once you spend some time learning it - just like any other programming language. You have a strange conception of Rust and its complexity, just from seeing a couple of syntactic elements you're unfamiliar with.> language is so small as there is no complex abstractions that you have to keep in your headThat's the other way around, C is so primitive you have to keep all the abstractions - like variables' lifetimes, coroutines' states, error handling - in your head. Try expressing in C an equivalent of the `.await` operator. Sure, it's possible, but the complexity you'll have to deal with will be enormous.> add another layer of complexityBy that logic, you should use pure asm since it's the simplest, most abstraction-free way to program uCs. You don't have to learn all that confusing stuff about types, functions, control structures, memory allocation, and so on.
>>2958589I'm not sure about all of this. I see software getting worse day by day. Rust coreutils meme is a perfect example of this. If it is truly a superior language why is it so difficult to implement same software in it? You even have a 100% working reference so all you need to do is translate C to Rust - you don't even need to think about implementation details and edge cases and yet the result is buggy mess. I remember servo web engine, so much hype and where it is now? Compare that to ladybird which is written in C++ and coming along nicely. I don't know of any successful rust project expect maybe that butt plug firmware thing. We were promised bug free utopia if we convert, but all we got in the end was longer compile times for existing software and another set of dependencies.
>>2958595> Rust coreutils meme This entire situation is Ubuntu's fault, I have no idea why they decided to ship a beta package, according to the package authors themselves. It has little to do with Rust. GNU coreutils is a large project with 40 years of history, no other coreutils implementation - BSD or busybox - even tries to replicate it.> all you need to do is translate C to RustThe goal is to reimplement it in idiomatic Rust, not to "translate" it from C.> remember servo web engine, so much hype and where it is now? Here: https://servo.org/ . A lot of Rust code from it has been in use by mainline Firefox for 5+ years now.> I don't know of any successful rust projectThat tells more about you, desu. Rust is used in the Windows and Linux kernels, both Chrome and Firefox, by AWS and Cloudflare. Both Microsoft and Google report a lot of positive results from adopting it and plan to expand its usare further. The majority of new code in Android is Rust now: https://security.googleblog.com/2025/11/rust-in-android-move-fast-fix-things.html .I'm not trying to evangelise, I was sharing my positive experience with a tool. This knee-jerk Rust-bashing reeks of nocoders from /g/ and the Lindjew's engagement baiting.
>>2958567> 32 bit mcu> mutexes or channels> zero costI think those have a cost.> flashing ledsPost code size.32-bit Gaming PC Class āmicrocontrollersā with near infinite memory were a mistake.Post code size.
>>2958269To print a float it needs to convert it from binary to decimal, maybe thereās no valid subroutine for that. Floating point is cringe, fixed-point is the way to go.>>2958553I was under the impression that any dynamic memory management was less suited for compiling onto a microcontroller, but thatās just an impression from writing code for AVRs with no need for memory reallocation. It would be interesting to see how efficiently (memory usage, lines of required code, and execution speed) different programming languages compile onto different architectures. Rust, or maybe Haskell or Erlang or whatever, might be a good fit onto some.
>>2958596> Rust is used in the Windows and Linux kernelsNot to any significant degree. There was prolog in there at one point, too, for network initialization. Nobody went hyper-religious about prolog claiming āeverybody is doing it⦠look at this big companyā> Chrome and Firefox, AndroidThese are not technical companies driven by technical excellence. Theyāre run exclusively be mba grads/dropouts and their core competency is advertising, data mining, and selling user data. Itās not an endorsement: I see them hyperventilate over some new fad run the other way because itās probably a scam. It needs to stand on itās own merits, not because some internet rando made post about it.When rust makes it into flight control software, I stop flying.If rust starts managing the control rods in a nuclear power plant, I move to germany.Iām going to be in great shape when rust starts running brake systems in electric cars because Iām biking everywhere after that.Also, let me know when it can target 8051.
>>2958553> look at my fancy pragmata pro font I used on my helix editor using the wheatgrass theme on my 8K monitor.> youāre not looking at me..> LOOK AT ME
>>2958658>tfw using a teensy 4.1 to drive a TMR keyboard and the jitter filter + QMK is 1 mb
>>2958553Come back when you learn how to flash a LED in in 18 bytes of machine code and a (generous) 2 bytes of RAM.Also run the entire development process and tool chain on the microcontroller itself. Because the new millennium is upon us, you can use a wyse serial terminal. We donāt want to be luddites here, now do we?
>>2958589>English may work perfectly fine when you discuss Shakespeare, but if you try to discuss Confucius, English is a poor choice, because you'll have to spend a lot of time expressing all the nuances a single Chinese character has.Reading shakespear and reading confucios paralels to maintaining legacy software not to writing new books aka creating new stuff.By the time you learn Mandaring writing to be able to express sex using horse character and a spear character meaning of which will be lost on 90% of the readers another person will write 10 books in english meaning of which will be more clear and whos message will spread far.I can master whole history and meaning of confucios in english while you studdy chinese.I will know what temper his 15th mistress had by the time you read the first page.
>>2958553What the fuck is this vomit. If that's supposed to be the future of low-level programming, then I'm quitting my job and gonna switch to farming or something.
>>2958567>That's a nice abstraction to have.This sounds horrible, like a fragile javascript mess that fucks up whenever you make "unexpected" clicks or your network connection has a latency too high.
>>2958775even the font wears programming socks
>>2958775> vomitIt was written in such a way to be intentionally outrageous. You donāt have to write it that way. In fact, itās not even recommended.It was designed to look (and, in fact, *be* crazy) yet thereās nothing you can do about it. Regardless of how many times it takes down the internet or kills people in software controlling brakes, planes, or medical software, it will proceed to take over the software world. All you can do is stand by and watch and be outraged. Thatās real power right there. If it wasnāt ārustā it would be some other unnecessarily obscure language. Itās literally the ānewspeakā idea from 1984. Everything else has to go into the memory hole, and you C guys will end up being gatekept. C++ went fown the same path. Full-blown C++ using every feature of C++26 is just as unrecognizable and crazy looking as Rust.
>>2958919As a C++ programmer this is absolutely true. If you use every possible feature in C++26, the code would be incomprehensible to someone who targets C++11, say.
>>2958919Even "sane" Rust code looks like shit.
>>2955870>>2955615>>2955592After watching this dude's vids I made another revision making sure return currents from zx lines stay away and it worked, no noise.Fucking sorcery.
>>2959150Congrats! Now you can put "Signal Integrity" on your resume and still not get any interviews for jobs you're more than qualified for
Now, I ain't really the type of guy who likes debating about programming languages since I just get excited by pressing a button and toggling an LED, but is there a Rust compiler for Atmega microprocessors? If so, is there a repository full of example programs for Arduino written on Rust?
>>2959228> 8-bit mcuThere will be, as soon as atmega becomes 64 bit with sse4 and avx512 and runs the amd_64 instruction set using ubuntu linux.
Hi guise, this is probably a noob question but here goes, Iām working on a midi interface thing on teensy and i want to add a little function that records a sequence of midi notes in real time and then loops it . Basic idea for the program is>press record button (timer starts running from 0 onwards)>if a midi message is received, note the time , the message type and the data in some sort of log>when the
>>2959236You coulda just Googled it and said "Yeah, there is one" (which is what I found out after I did), or if you didn't wanna do that, you could've used the usual "Google is your friend". No need to talk with such confidence about purely speculative stuff.
>>2959255 (wew check āem)Fuck hadnāt finished>when the stop recording button is pressed a final line is written in the log fileSo after that the log should look like>time - message type - -data 1 - data2 >0000 Start. >0040 NoteOn Note Velocity>0050 NoteOff Note Velocity >0060 Stop Then when i press play another timer starts running, the value of the timer being compared to the time entries in the log file, then when the value of the timer is equal to a value in the log, the corresponding note is sent to the midi device. When it reaches the stop line (0060 in this case) the timer resets to zero and starts reading from the beginning again. This is probably pretty simple but i have no idea how to create some kind of short term event log. Anybody know a simple way of achieving this?
>>2959259Ask chatgpt.
Looks like you guys have nothing to talk about besides Rust, so here's the next tutorial project.>>2958659> I was under the impression that any dynamic memory management was less suited for compiling onto a microcontroller,There's no dynamic memory allocation out of the box as it's #[no_std], you have to use a separate allocator like https://github.com/rust-embedded/embedded-alloc .>>2958663It's Iosevka with vanilla solarized-light theme.>>2958698I know how to flash an LED without any code, m8.>>2958662>>2958775Chill out, m8s, there's no need to be triggered, it's just a programming language.
>>2958658The ELF is 48kb, the text section is 16Kb, and the rest is the symbol table, which I guess could be truncated to only the symbols the uC needs to load the binary. Most of the 16Kb is the library, which will stay the same. I'm using RB Pico 2W with 2Mb flash and 520Kb of SRAM.
>>2959268No thanks I donāt talk to clankers
>>2959273So ::new is stack allocation?
>>2959259>Anybody know a simple way of achieving this?YesIn recording mode you keep a 32-bit hardware timer running and record USART input bytes when they come, with delta timestamps, to the teensy's ram, until recording mode is stopped.In playback mode you also loop through the delta timestamps + midi bytes log, delay for the appropriate time for each one, then emit the corresponding byte out via USART, then loop at the end.
>>2959279Yes. Technically, it's just a static method that returns the struct by value: https://github.com/embassy-rs/embassy/blob/main/embassy-rp/src/gpio.rs#L125 . It may initialize the fields however it likes, but the struct itself is guaranteed to be RVO'd and be put on the stack. In practice, it's most likely inlined. To allocate on the heap you'd use `Box::new`.
Also fuck freenove for not protecting the 31st pin with a register in this example. The uC had it on OUT/High when I connected the RP to USB, and the potentiometer was all the way to the right, meaning I had a short. Everything is fine, but the potentiometer still smells like burnt plastic.
>>2959273>it's just a programming language.Just a programming language with followers so mentally ill and fanatical that the community routinely has discussions on how they conduct public relations.
>>2959286Just a programming language that brought down half the internet because someone wrote code like a fucking 1st year CS student by declaring a fixed-size array, which fails when the prof runs it with his own test input. And then calling a function that should never be used in production code.>BUT IT WAS MEMORY-SAFE
>>2959285Or add a series resistor as a safety margin giving a minimum resistance. Many pots and transistors perished when I was experimenting with current sources and amplifier circuits until I learned to add always add one even if just testing that one thing real quick.
>>2959290lol. And just recently ubuntu is redoing a lot of coreutils in rust. Last week sudo-rs was found to have multiple security vulnerabilities.Another day, another overconfident Rust zealot "fixing" something that wasn't broken.
im working on a project where i want to pair a mc to a raspi over bt to have it accept serial data and have it drive a cheapo usb display from that serial data. so far im playing with a raspi pico 2 w and its annoying as hell. i dont actually know if ill be able to drive the usb display at all yet because tinyusb is daunting and frankly all the documentation and examples for the rp2350 seem bad. are esp32 boards any better?
>>2959434If you want something easy to code, I'd suggest you to use an LCD or OLED display you can connect to through I2C. Leave USB stuff for when you actually want to learn about the USB protocol.
>>2959436ive managed to get an i2c display working so far, but the one i have is very unimpressive and its resolution is too low to drive a usable TUI on it (monocolor 128x64 px).the usb display i have is the WeAct Studio Display FS V1 which is an rgb565 160x80 px display. its just barely large enough that i feel i could use it for a TUI and also use color to add functionality given the limited display realestate.at some point im going to have to come up with an optics solution because the plan is to mount the device near my eye, but id imagine that a larger resolution would help a lot with this and give me more leeway with font rendering.
>>2959430Why are they like this. Why are they fucking up everything. Seriously mentally ill robots.
>>2958596>and Cloudflare*unwraps your internets*
>>2959438If you havenāt seen him already, check out the AR and VR stuff done by MaƱolo on youtube. He has a variety of different displays that are all quite compact and cost optimised.I would go out of your way to find a display that runs on something other than USB or HDMI, for high density displays like youāre suggesting Iād be looking for something along the lines of SPI, maybe with parallel data lines. Whatever it is, you likely donāt want to have to bit-bang it, so you may have to select a microcontroller with more specialised hardware. The ESP32 uses QSPI if I recall, otherwise most manufacturers with a dozen or two 32-bit chips in a family have some that are specialised in having unique interconnect options.
>>2959440it's the same soi attitude that caused systemd
>>2959465The fuck systemd has to do with Rust? It's written in C. Besides, the systemd drama was like 15 years ago, everyone has moved on a long time ago. It's almost like you snowflakes enjoy being permanently outraged at something.
>>2959531I don't know what exactly he meant, but systemd is still being shit at present. Absolute fucking trash.
>>2959531It's the urge to rewrite something that is working just fine, because NEW THING BETTER.
>>2959621There is nothing wrong with improving something. But the systemd "philosophy" is something like hardcoding the thing they wanted, and broadening the scope of the project to anything they think they should "improve" and making it part of systemd. This is why systemd is an init system with a DNS server.
>>2959531Systemd broke my system twice because of its trash DNS resolver, so I just disable it now. It's a bug they just ignored because they are unable to understand the issue, because they're stupid fucking faggots. https://github.com/systemd/systemd/issues/13432 - issue closed, no plans to fix, and they don't even recognize it as being a problem.
>>2959657Why not use an OS designed not to be reliant on systemd? Like Artix or Devuan.
>>2959280Thanks this was the kind of reply i was looking for, keep in mind i havenāt programmed since high school so prepare for dumb questions but first the part I figured out , i create a buffer that contains the midi data and the timestamp and send that to a DMA channel, then in playback mode it reads this back from the start timestamp and sends the data out after corresponding delay times and looping back at the stop timestamp? , i do have some questions though >32bit hardware timerDoes elapsedmicros use this? Iāve seen this used for measuring time measurement but idk if the hardware timer youāre mentioning is something different entirely.>USARTis this an alternative way of spelling uart? It doesnāt return much on google by itself, and neither do the delta timestamps, i did however find this thread on some forum : https://forum.pjrc.com/index.php?threads/teensy-3-6-add-timestamps-to-dma-transfers.43470/ Is this guy trying to do what iām trying to do?? Does it make sense to comb through his code for inspiration?
>>2954113>for a useless degreeyou seem pretty knowledgeable. What degree did you get?
>>2960151Physics. I guess some of the papers helped with my interest in electronics, but Iād have gotten there sooner or later. Not that the me now would hire the me out of high school for any skilled work. I was high on my own ego, I guess barely passing uni surrounded by smarter people was a humbling experience, but it took me another few years for that lesson to settle in.As I am now I have a breadth of knowledge with depth in a few areas, solely from experimenting, setting myself lofty goals, and running into roadblock after roadblock. Most of those roadblocks are self-inflicted though, deliberately doing things the hard way.
>>2960156what field are you in? are u doing this out of a hobby?
>want to do a fire effect >use tardunio because lazy and I don't want to setup my workspace on my new PC>a few analog writes and random calls>"error: you are using 120% of available code space"I mean it is attiny13 but what is arduino dragging into the project to add that much overhead
>>2960159Oh no Iāve been working retail for 6 years now. My knowledge comes in handy selling solar charge controllers and resistors and such, plus I meet people for jobs on the side, but Iām not easy to hire. The local volunteer repair org is fun though.>>2960184I also use tiny13s. They have plenty of memory if you:>never use floats or division>be careful with regards to multiplication since thatās done via an addition-based routine, and anything else that it doesnāt have hardware for>donāt use any libraries unless you absolutely have to and have compared all alternative librariesThose random calls will be your issue. Either Iād get random noise from an ADC sample on a floating pin, or code up an LFSR. 8 bits means 255 states, which is probably fine for a fire sim. But that is four taps, a 7-bit LFSR only needs two taps if youāre pressed for space. It doesnāt have an XOR instruction, bitwise or no, but you can probably trust your compiler to do that without eating up too much space.The worst bottleneck as far as Iām concerned is the presence of just one timer, with no input capture for that timer either. I2C would be nice too.
>>2960184You wanted your C++ library, you got your C++ library.
>>2952647how dumb is this?>put a fairly basic microcontroller battery, screen, accelerometer, and charger inside of a (reasonably small) SPENT bullet casing>program the mcu to when shaken, it displays a random or randomly generated reddit comment on the screenid think of it like a magic 8 ball, but instead of random wise 'thoughts', its the thoughts of mentally ill internet losers instead?
>>2960402Dumb in the sense that IDK why the fuck you would do it, but you could I guess. Could easily preload millions of comments into a flash chip/micro sd card.The concern IMO would be battery life. Unless you have a power switch, or use deep sleep modes and a very low power accelerometer, it wouldn't last long.
>>2952647Hi everyone, would like to consult your expertise, do you have recommendations for automotive sector ? i already did some CAN loggers, looking for inspiration ,i'm also interested in the growing trend of automotive Ethernet , but documentation seems scarces, i would realy like to get into it tho...
hello sars. I'm thinking of making a pull-up counter as my first project. The idea is sticking an esp32 + a module that detects movement on top of the pull up bar that sends the records to my server through wifi. What should I put in the aliexpress basket? Also, does this sound reasonable for a first project? I don't think it's too advanced, is it?> previous exphave done some esp32 projects in college (as a comp sci major) but my recollection is quite bad.
>>2960402i like it. please provide a follow up
Hallo SAAARS I wuz thinkin of making a grand total of 3 LEDs blinks cuz two is overdone and I want to use a non-deterministic machine learning-driven algorithm. Being as it is, alas, I was reincarnated in this life not as the son of a maharajah but as a poor sorghum farmer's illegitimate child, whence I must incur strong budget constraints and use the least expensive mu cee I can get my hands on.Therefore I do beseech ye, my good sires, that ye may be of great aid unto me and that ye may recommend me a myoo cee available in the Islamic Republic of Pakistan at an extremely low price so as to engage in the endeavour I have in mind, not withstanding the constraint of being able to run something akin to TinyML.
>>2961468Woe to thee brother, alas if you were born white, you could aim for the lofty heights of 6 blinking LEDs. kinkartavyavimoodh!!!
>>2961559this is the most niggerlichious way to get 6 leds to blink ive ever seen in my life
gonna be modding some old oem rcontrollers for use on pc (with gp2040-ce software) as a first project and I want to dremel out a spot for a usb c port so I can use the same cord for all my controllers. what's the best way to go about wiring a pico to an external port? been reading about how usb c to c isn't a good idea so I'm at a loss.and are there any recommended aliexpress picos or should I just go for a legit ones? the reviews basically look good on this one aside from the wifi which I don't care about anyway. open to other suggestions though if there's a known good chinese brand.
>>2961559I don't use breadboards I'm not a fucken bitch