Previous thread: >>2909001Here 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
>>2928655I want to sink 10, maybe 15 mA from uart mcu pins that i cannot determine the type of because it's embedded into something and non-reachable so i can't look up the specs. Is this current acceptable for uart connections on most mcu's? The sink is to drive a serial isolation optocoupler. The signal is 5V and outputs some data every second at 19200bps.
>>2929363Probably not on newer MCUs. An older type like the ATmega328 (arudino uno mcu) would be able to but newer types would likely see a significant rise in Vol when trying to sink 15mA. You might see 1v when you should be seeing under 100mV. The exact voltage rise would be dependent on the mcu and may or may not be acceptable depending on the characteristics of you optoisolator. Also, I would be careful putting 5v on a digital input if the mcu is unknown. Newer types would may run on 3.3v rather than 5v and there is no guarantee that the pins would be 5v tolerant. Since 19200bps is very slow by modern standards, I would buffer the output with a transistor. I imagine the LED on the optoisolator is connected to 5v through a resistor and you want to connect the cathode to the mcu pin to turn it on when the pin is low? If that is the case you can go with normal non-inverted logic and connect the tx pin on the mcu to a bjt inverter. pic related
>>2929370>I imagine the LED on the optoisolator is connected to 5v through a resistor and you want to connect the cathode to the mcu pin to turn it on when the pin is low?Yes that was my plan. But this pic inverts the signal right?
>>2929372Yes the output on the isolated side will be high when the mcu output is low. If you don't want this you can invert the logic on the mcu. If you can't change the mcu firmware, you can add another npn to invert the signal. Since your baud rate is only 19200 the difference in propagation time will be negligible.
>>2929390What are you retarded? Just put a pull-down resistor on the phototransistor instead of a pull-up. It’s floating, it doesn’t have to be common-emitter.
>>2929392Good point. With 5v logic a 0.7v drop can be tolerated.
Should work. Thanks guys
>>2928655Do you have the sauce for the banana dev board or a high resolution pic? Here's some CRT porn in exchange
>>2929405Nvm found it
>>2929405I’ve never been able to find a source file for the WTFduino, but I’m pretty sure it’s just a 328P nano.That CRT doesn’t look to have a front electrode to dissipate the charge from the phosphor. Man I want to make a vector display. Good thing we have laser galvos. Or maybe I should feed a component/VGA signal into a laser galvo to make a raster display? I should look into that.
man, the (tr)usdx HF transceiver is insanely impressive for an ATmega328P. I think they’re doing I and Q decoding AND voice input and output. Somehow. I don’t see any mixers or filters on their circuit.
I just spent the better part of somewhere between 4 and 6 hours figuring out a relatively simple and stupid bug in some code for a pair of STM32s trading a pair of bytes and ACK signals over UART.NGL I kind of feel like shit about this, and how often things like this happen to me. Is embedded dev actually just like this? Does it get better? Is there some magic trick to not think like a fucking retard? Or is the best course of action about 50g of acetaminophen and a bottle of everclear? I only do this as a hobby and I'm not that experienced, so I have no real context for whether or not struggling so badly for ridiculous amounts of time on what end up being relatively simple single-line problems is an everybody issue or just a me issue. I've heard plenty of joking about it, but I don't have a clue how much of that is exaggerated for comedic effect.
>>2929798Is it something where an oscilloscope would have helped?Sometimes just not being completely blind to what's on a wire that makes a big difference, and it can be easier to hook up than a printf debug on something with no console.These cheap handheld ones are only like 80 bucks or so, and well worth it.
>>2929798I made an app dev debug something for weeks because my firmware had a trivial bug.
>>2929798Are you using debugging via GDB or otherwise through your IDE? Printf “debugging” doesn’t count. Being able to step through clock-cycles and see what values are in your registers and on each pin can be very useful for tracking down spurious bullshit. Or so I’m led to believe. Doing this on two MCUs at once may not be easy, but it should be doable.I think CNLohr wrote some sort of development environment that made compiling and uploading code to STM32s really damn fast for more rapid prototyping, but I don’t know if it includes debugging.While I wouldn’t recommend asking an LLM to write a program for you, asking an LLM why your code has this buggy result may steer you in the right direction.You could also take the ASIC+analog pill and avoid anything you have to program. Most projects can be greatly simplified with the right hardware, and even if the microcontroller can’t be taken out of the equation maybe you can use an existing codebase for it, or make the programming far simpler. Why solve a problem today in software if you could have solved it yesterday in hardware?
>>2929887>I think CNLohr wrote some sort of development environment that made compiling and uploading code to STM32s really damn fast"make"?>asking an LLM why your code has this buggy result may steer you in the right direction.lol
>>2929798>Is it something where an oscilloscope would have helped?I already have a DSO. I'm not a complete novice here, though perhaps only just barely this side of it. That's part of the problem. I feel like I shouldn't be fucking up in ways this stupid at this point, at least not for this long.>>2929887>Are you using debugging via GDB or otherwise through your IDE?GDB via the STM32 extension for VScode. Which actually was what ended up being part of the problem: It didn't occur to me that the peripheral registers have no way of knowing whether they're being read/written by the MCU itself or by the debug...meaning that flags that are set/reset on register read are flipped "at random" when the debugger pauses the MCU and checks register values.IDK, I guess I'm mostly just looking for confirmation that either failing this hard is semi-normal or that I am, in fact, retarded.Just for reference: Picrel for what ended up being the root of the problem. I couldn't figure out why the timeout for the first byte always worked fine, but the second wouldn't time out. USART_WaitForAck() would always return true (transfer received in time) even with impossibly short wait times...unless the receiving MCU was held under reset and not responding at all, at which point it would time out as expected. I eventually set the receiving MCU to just never send the second ACK and measured how long the timeout actually took, which was suspiciously close to 65535µs. Turns out, when I wrote the TimeoutSetup_uSec() routine at the core of the delay, I had implicitly assumed that the counter would be stopped at the start of that function. But, if the delay is long enough that it can be called again BEFORE the counter hits the set AutoReload (maximum/top) value, setting another, lower AutoReload value will cause the counter to dodge the original and the new timeout value won't be hit until the counter overflows.
>>2929923(cont'd.)It just seems so fucking obvious now that I see it. Yeah, other problems took up a portion of the near full day I spent on this (like the debug clearing flags, or that it's not pointed out in the datasheet that the overrun detection bit being set practically halts the entire USART peripheral, or any of half a dozen smaller code bugs), but saying that just feels like cope.Anyway, thank you for coming to my blog, have a nice day.
>>2929923>>2929924I didn't try to understand your problem (tl;dr), but it's common that shit close to hardware, especially timing related stuff, can be hard to figure out. It simply drains a lot of time and energy. I'd recommend to have good ways to debug, like using a scope to view what happens on the UART, or making sure gdb shows real values (it often lies to me).
Bought a ESP32 and decided to run some tests with a 4-digit 7-segment display. I wired it and uploaded the sketch from thishttps://microcontrollerslab.com/esp32-74hc595-4-digit-7-segment-display/It works fine for any number up to 5555, but entering any number higher than that into the serial monitor causes errors. Random numbers, symbols that aren't even numbers, and blank screens. I looked through the code and I didn't see anything wrong with it, and I swapped out the 74HC595, resistors, and wires incase there was any fault there.Is my ESP32 just borked in a completely retarded way?
>>2930572>It works fine for any number up to 5555how certain of you of this statement? that would be a very strange bug, as theres nothing very special about numbers higher than 5555.does 7777 work?
>>2930572have you tried another code or ide with that board?
>>2930572Probably shitty code. That does not sound like a hardware problem. If you write the code yourself, not only will you understand why it works, but also understand where to look if it doesn't work.Or ask an AI to do that for you, jeez.
>>2930577Because the moment I noticed the bug I went through the numblers. First by the thousandth state, then the hundrendtg stat, finally the tenths, I didn't dive into the single digits because literally ever single numble above 5555 glitched out.>>2930611Yeah, I ran a basic blink sketch on this board multiple times with zero errors.>>2930775I spent all of Friday night and half of yesterday going over the code and see zero issues. The code should work. The board should work, in reality nothing works.I pulled out my Fluke and tested every resistor. They resistors I used were 220 and rated at ±1 but actually read at 217.3Ω. I sat down and did the math and that variance should not in any way effect this. I switched out the 74HC595 with an honest to God Texas Instruments 74HC595. I replaced the 7seg4 with three different ones I had in my bench stock and got the same results ever time.
>>2931163Those symptoms are not indicative of any issue in hardware, it’s definitely in the code, even if it isn’t obvious. Assuming you’re not in a workflow that has GDB available, try putting some printf() statements at various points in the code. Try to send 5556 to the screen and check key variables for overflow or corruption. Displaying binary values as decimals requires division by 10, and mostMicrocontrollers don’t have hardware division, so memory might be a problem. If you don’t calculate the last digit and leave it as 9 all the time, do you still get the bug?
>ardushitto code written by retardskek
>>2931203it was in the code
>>2931216Was? You fixed it?
>>2931228yah, I am a retard
>>2931232Explain the problem so we can learn. And laugh.
I wrote a little something to monitor sensor data and display a history. Now I'm wondering, are there better libraries for this? It's an ESP32, so I might even do it in micropython which could make use of the time information.
>>2929443>front electrode to dissipate the chargeYou mean the aquadag coating? This tube was a 1930s demo piece so I'm guessing that aquadag was either not a thing back then or they didn't bother because it was just a demo tube. >Man I want to make a vector displayIf you want to use a CRT it's pretty simple if you're willing to work with high voltage. Picrel was my setup before I dismantled it. I plan on coding an mcu to connect to the drive circuitry so I can play pong on the CRT in the near future so I may post here if I get around to it.
>>2933043>aquadagYeah, though I didn’t know it stopped short of the phosphor. Guess the electrons can still move to it after striking the screen. Bet if they put an ITO layer under the phosphor too you’d get less static buildup.>MCU for pongCmon man, pong is the perfect project for a diy analogue computer. Can probably make it in 40 ICs or so.
>>2933058>Analogue computer for pongTo be fair I find this idea appealing and was initially going to go down that route since I prefer hardware over software but I have my hands full with other projects at the moment and it should probably be possible to write the program for it in a single day. I've already prototyped one deflection plate amplifier and it works fine at low frequencies. I didn't have any high voltage BJTs so I had to improvise and use IRF740s (not suitable for use in their linear region, I know) but even with those MOSFETs the deflection plate drivers are probably more than fast enough for pong. I've built up another amp to go with the first one so I can have independent control over X and Y deflection but I haven't tested the second one yet.
Micropython, I kneel. Why didn't I try this before? It's so much easier in the field than getting my laptop with esptool, platformio or the Arduino IDE.
>>2933911What is it?
How did ARM manage to make the MRC and MCR so completely retardedly over-complicated and unintuitive? Every time I'm trying to wade through their shitty docs and try to match these psychopathic IDs I want to kill myself. Fuck ARM.
>>2935481Take the RISC-V pill
>>2935565RISC-V has a similar mechanism, but instead of a tuple of 5 names, each register has only one name. One potential mistake they made when they defined the ASM language is how each register has an actual name, instead of specifying it as number. Now you need an updated toolchain each time you want to access a newer CSR.
>>2935593Super-H?
>>2935686Seems to have a very low number of system registers, not like ARM ("it must be extensible until the heat death of the universe and even after aliens enhance our brains to think 6-dimensional") or RISC-V ("I will design it to be extensible with random shit until I leave the industry")
>>2935593> how each register has an actual name, instead of specifying it as numberOn Isreal Inside(tm) I’ve stopped using RAX and, instead, use R0. To prepare for amd128 which is in the works, which will, again, double the register file cardinality.Do likewise, gents.
>>2933956It’s taking a toy language, making another, superficially similar language, but one that hardly does anything that the original one does making it more of a toy. The only thing left is some of python’s worthless syntax. And by worthless, I actually mean that it’s a blight on the industry.
>>2935686Super H is a reasonable choice, however ARM already stole one of it’s main features: code density. In ARM this manifests as the Thumb and Thumb 2 instruction sets. Without that, the roles of SuperHitachi and ARM would be reversed and we’d be living in a utopian society.
>ARM has 4 instruction set encodingsOr was it 5?
What's a good j-link clone?
I'm trying to build a tachometer to use with a nodemcu, the issue is I want to use interrupts to count the pulses, but when the edge falls, it triggers hundreds of interrupts.I tried a low pass filter and it still didnt workIm having this issue with both optical and magnetic sensorsI do not have an oscilloscope
>>2935943RC low-pass filter followed by a schmitt trigger. And twist your wires together, maybe even add a ferrite, since automotive environments can be electrically noisy. Could add some dead-time before you re-enable interrupts too.
>>2935948>RC low-pass filter followed by a schmitt trigger. that wont work very well, as OP has found out3 things that will work- integrator (diode, cap, resistor) followed by schmitt trigger- non-retrigerable monostable, such as a 555- SR latchfor more, do google image for ''switch debounce''not having a scope means you should go with a method that doesnt use RC time constants as you'd be adjusting them blindly
>>2935952 (You)forgot one:since you're using a 'puter, you can debounce in softwarewont work if you insist on using interrupts, thoor maybe it canafter you get a first interrupt, disable that interrupt for the next 15-20 msecs, creating a dead zone just like a monostable would
>>2935952>integrator (diode, cap, resistor)>diodeThose sensors generally don't have push-pull outputs in the first place, so the diode is probably superfluous. It should pull the output down fast, and the pullup resistor and cap will make for a slow rise.
>>2935948weird thing: I connected the same sensor to an arduino uno and the interrupt works correctly, but the same setup on the nodemcu makes it trigger like 4k times when it should trigger oncedigging around online, this seems to be a weird issue with the nodemcu, apparently it is too fast and if the step rise is too slow, it registers several times. still, over 4k is way too many times
wassup my niggas I am backthe news are:-I have finished the PCB design: i just need a review and then order prototypes.-for some reason i don't fucking know what's the problem with my bill of materials n shit.. i can't order this thing on JLPCB-my depression got way worse so I may not be working on this a lot but i'll try my best-my new goal in life is to get in a nursing home and live the rest of my life sedated until either big oof or euthanasiabtw the repo is still here if u wanna fuck around (maybe you'll find out) github com/hydrastro/owo
>>2935943as the prior anon said, use a schmit trigger. ESP interrupts need sharp edges. Had my fair share of problems trying to use those cheap rotary encoders
>>2936051Sounds like it’s spending too much time in the 25-75%Vcc range or so where logical 1 or zero isn’t defined. You need a Schmitt trigger or a few microseconds of delay before you enable interrupts again. A low-pass filter will only make the problem worse, but might still be a good idea to remove some noise if the other methods don’t work fully. You may also be able to improve the response speed by using a lower-value pull-up/down resistor on the sensor.>>2936145I may check later if I remember, but are you using the JLC fabrication toolkit addon for KiCAD? And adding the LCSC PART # or whatever in KiCAD’s BOM tool as the extension instructs? You also have to watch out for SOT-223s and other asymmetric footprints, they often come out off-centre by default.
>>2936182>but are you using the JLC fabrication toolkit addon for KiCAD?uuuhh nodidn't know it existed lmao>And adding the LCSC PART # or whatever in KiCAD’s BOM tool as the extension instructs?not reallythough I have all the parts in a list on DigiKey>You also have to watch out for SOT-223s and other asymmetric footprints, they often come out off-centre by default.wtf why? damn that would sucki'll try to check things outthanks!
>>2929798>is embedded dev like thisif you only know how many times I've been in the lab after 3 weeks of dispair only to realise all my problems stem from a single most stupid mistake.It doesn't get better.Example: The company pulled an old prototype back out. I was told to set it up and get it running. It had some combined multicore MCU FPGA unit on it. That thibg was somehow modified and some of the boot jumpers were on the prototype board but it wasn't clear which etc. The thing also had SD and two partitions. Flashing firmware would work in that usual way: Flash to the secondary partition, boot into there, if that works copy to primary partition. Reboot from there.So I just configured some stuff for it ran it through buildroot set some boot jumpers and hoped for the best.No boot. Try things, eventually boots. Erratic behaviour. Absolutely clueless.Turns out I confused the mapping for the two partitiond and the SD. So when I went to change something and flashed it something that may or may not be from earlier booted or not and if it booted it would copy something from somewhere to primary and the whole boot jumper situation didn't make it any better.Such a trivial mistake and I went stupid levels of deep into what is happening. And it ends up being duh.It just bever gets better.Every day is the same.Leave your RS232 in the lab, a colleague needs one real quick but with a modification, modifies your adapter, doesnt tell you, you look dumb again.New PCBs delivered, nothing works. Everyone looks dumb. Why? Is there a mistake in the new production files? Check everything for two days while someone probes everything to find out whats wrong.A colleague is like 'that feels slimmer than usual'.Fucking PCB place simply FORGOT two internal layers.It's an endless series of events like this.
>>2936145hmmm maybe my clearances are too tight? 0.1mmidk
>>2936285Also i'm not sure that I placed the SD slot in the right directionwhatever i should just kms
>>2936252>DigiKeyYou are trying to get JLC to solder it all for you, right? They have a list of parts that they stock that are basic parts and have no fee associated, mainly passives and jellybean parts, plus a few “preferred extended” parts that also have no fee associated. Ensure as many of your components are from one of these lists as possible. Then for a small fee per part they can get stock from the main warehouse of LCSC, because they’re the same company, you’ll likely have to do this for more specialised parts like MCUs and motor drivers and such. This can all be done as you generate the quote. Parts in other LCSC warehouses need to be ordered in before you generate the quote into your personal parts inventory, and there’s a significantly higher fee for this. I imagine the same applies for getting parts in from other vendors, DigiKey included, but I’m unsure of the ordering process.LCSC has a really shitty parametric search function (JLCPCB’s search is even worse, which is where you see the basic/preferred extended labels) so I sometimes find myself using a 3rd party webtool for browsing their parts instead. There’s a hackaday article about it.Also note that while SMD parts are cheap to get soldered for you, THT parts are not. If finding SMT versions of parts isn’t feasible, I’d recommend just leave them unpopulated and solder them yourself once they arrive.>damn that would suckAfter it confirms the BOM and placement files it asks you to confirm the component placements with a view of the parts on their footprints, so it just takes a minute to scan through that and pick up any issues. If you miss something they’ll probably email you and ask if it’s correct, but I wouldn’t bet on that unless you’re paying extra for inspection. They emailed me about footprints they thought were backwards, they weren’t though.>>2936278>FORGOT two internal layersNot getting that flying probe test?
>>2936322You are trying to get JLC to solder it all for you, right?yes>They have a list of parts that they stock that are basic parts and have no fee associated, ehhh FUCKi just found this out when I finished the PCBbut i guess i can find alternative components>Then for a small fee per part they can get stock from the main warehouse of LCSCyeah I mean apart from common passives I am using few ferrite beads and few oscillators ad specific frequenciesthen i also have some mosfetsand the "main" things which are the DAC, the MCU (esp32-c6-wroom) and some amplifiers from texas instr/analog dev.then i have: rotary encoders (through hole), buttons (soldered), switches (i forgot lmao), usbc port, SD card slotmost of the things are surface mount when possiblemy idea was to have the whole PC assembled by themi have zero soldering experience though I do have a hot hair solder available and I can order shit and try to do stuffwhat should I do? do people let JLPC manufacture everything? or do they also get their hands dirty?by the way.. when I was choosing the parts on Digikey I was always making sure there where in production and in large quantity in stock!anyways, thank you a lot, your feedback is really helping me!
>>2936368THT rotary encoders will be very simple to solder with a soldering iron, no hot-air necessary. Assuming you have good thermal reliefs. I’d want things like rotary encoders and other parts that might need to match up to a faceplate to be through-hole anyhow since surface-mount alignment is never perfect. There’s also the matter of strength for parts that have humans applying force to them.I’m not sure about the WROOM module, using castellated vias on a module that itself has solder on it may mean it has to be hand-soldered, which isn’t as trivial as a through-hole encoder. Well I’d go through the quote and see what they charge to solder the ESP32 and decide for yourself if that sounds reasonable. The alternative is to put the ESP32 chip itself on the PCB, alongside its supporting components.>c6Based RISC-V enjoyer.
>>2936322>testidk but they mounted everything on there. 3 digit ICs, a huge ass ceramic filter etc.why would yomeone be 'getting that test'why would the customer pay for the supplier to make sure their work is okaythe contract says you get delivered what you ordered, if that's not the case there is no fulfillmentif the reliability is that low it's in the suppliers interest to test
>>2936373>THT rotary encoders will be very simple to solder with a soldering iron,nice>Assuming you have good thermal reliefs.i have no idea what are those> other parts that might need to match up to a faceplate to be through-holethe buttons are surface mount... because through holes would have eaten out too much space on both sides of the board.. and the design is already pretty small>Based RISC-V enjoyer.hell yeah. the software part of this thing will be fun to do>>2936389on jlcpcb some components are wrongin picrel you can see the SHIT i am talking about
>>2936458idk about jlpcb or any other chink supplier for businessi use those for my private projectbut i'm plenty sure boss would rip me another one if I ever put something like that in a productand if they have certifications and what not theres definately someone who is going to doubt itidk if they know how NDA work>had traumatic flashback todayjust to add one to the list if what makes embedded so painfulwe run the products in the lab alot without the enclosures lid because youre probing and modifying and what not all day anyways so why ever replace the lidone day we had a fault that bamboozled everyone and also seemed to be sporadic and was impossible to reproduce etc etc.long story short:the lid coupled some noise from one location to another fucking things up and all thatjust one of those youre chasing the fault for a week and at the end you look very very dumb went through all the datasheets, measured everything, called apllication engineers and so on and someone goes 'huh... if I put the lid on and press down in thos corner it changes, aint that odd? '
>>2936469>but i'm plenty sure boss would rip me another one if I ever put something like that in a productif you ever "put" those intersectinc capacitors?>idk if they know how NDA workwhat do you mean?btw this is my own project, open source, done entirely be mehmm maybe you are relpying to the wrong person? idk
>>2936500idk this is an imageboard in the style of furaba for a reason but if we wanna (You) alot:Someone, I suspect (You), was like>>2936389 (You) #on jlcpcb some components are wrongin picrel you can see the SHIT i am talking abouthere>>2936458and that sort of sounds like they (You) are suggesting for me to use JLPCB or something similar at work.But placing an order there would probably be the last day I have work because a) that would mean leakimg company secrets and b) that would. also. mean I unironically intend to incorporate items of dubious origin into critical infrastructure which might make the customer (state) a wee bit mad.
>>2935954>since you're using a 'puter, you can debounce in softwarethis is the way. sample on a timer interrupt and debounce/filter inputs.>wont work if you insist on using interrupts, thotying interrupts to real-world noise is a good way to produce interrupt storms
>>2936469>idk about jlpcb or any other chink supplier for businessSomehow foxconn's customers get by.I haven't used jlcpcb yet but I figure I might on a personal project to see how it goes.Any of you have suggestions for quick-turn fab and assembly shops that will sign an NDA? They don't have to be cheap if they're fast and good.
>>2936517for private projects they are good I also can recommend pcbway, excellent speed.Regarding work I could only name some. that are national / local to me and so most likely of little use to others. It's hit and miss, we had a time at work where every non critical mini-project, time and quality wise, would go out to a different new supplier, only so we could evaluate service, speed, quality etc.
>>2936458Thermal reliefs are the gaps in your ground plane around pads that make the pads easier to solder.I ordered a bunch of RISC-V chips myself, the CH32V series, but I’m too retarded to figure out a toolchain on my frankenstein’d arch install.>>2936502No I think the was confused and was assuming you were already using JLC. As for NDAs, I doubt the chinks have time to reverse engineer every damn project you put through them, especially if you don’t tell them to upload the firmware too. But I guess it wouldn’t be a YouTuber sponsorship read without some sort of caveat. Still wouldn’t use them for important production runs, just prototyping.
First time posting in this board.Stupid thought went through my head and idk where to post it: What if I made a 68k computer?
OK, I thought for a moment and typed up thisCPU: >68060 @ 50MHzMemory:>2MB Flash ROM>16MB RAM expandable to 128MBVideo:>8MB of VRAM>OpenGL 1.x 3D acceleration?>Resolutions of up to 1080p>16.8mil colorsAudio:>8 stereo PCM hardware channels at 44.1kHzStorage:>microSD supportI/O:>4 USB2 ports>HDMI portsExpansion:>4x 16-bit ISA slots>2x 32-bit PCI slotsThoughts?
>>293656724bit colour * 1920 * 1080 = 50Mb = 6.2MBYou probably want at least twice the VRAM for a single framebuffer so you can write to one frame while the other is being displayed. It's a pretty esoteric project in general, I wouldn't even know where to begin. Are you going to design a graphics card?
>>2936567>Thoughts?years worth of effort for little gainbecause anything you wanna do with it, you'll have to write the code for itevery tiny little thinga keyboard routine, with roll-over, which is no easy featRS-232 codevideo codeaudio codea monitor, editor, assembler, compilerbut before any of that, months of building and debugging the hardwarewhich is gonna be so slow, even Pong will lagor you can skip all that BS and go straight to coding applications with a $5 ESP-32 board with 10x the power
>>2936567It would be fun if you have no other hobbies and don't plan to have any other hobbies. But what software would you run on it? If you ported a unix, it would just be a slow unix machine.I've always thought it would be fun to have a really loaded big box Amiga around but I got over it some time when Bill Clinton was still president.
>>2936520I've heard of people sending board files out by 5pm friday west coast time and getting boards back from China on Monday. Not for cheap. Not sure if they could get them assembled or how long that would take. Would be nice to have a known good supplier dialed in like that - that's how you hit 2-3 week cadences.
>>2936672Yeah I did that a few times in uni. You know. Fuck about with your lab partner all semester, last week for the project: Oh shit oh shit.PCBway does their thing, meanwhile code shit. Have chatgpt document it all. Done.
>>2936703Yeah PCBway is a little lower end than I was thinking but might work. I was thinking who can send by overnight courier for reliable Monday delivery.
Is it possibleon 328p to configure phase correct PWM in such a way that ONE of the two signals is inverted?My manual says to set the COMnx1:0 bits to achieve the desired non-inverted or inverted output.So setting COMAx1:0 to 3 (set if count > ref)and COMBx1:0 to 2 (clear when count > ref)should lead to the desired behaviour, right?Like say BOTTOM was 0, TOP was 1024 and I set both compare regs to 512 I'd get a 50% differential signal?
>>2936836Me again.It's a chinese board. Took it out its bag and soldered it straight to board without testing (tested another one from the same batch). TX light is on. Serial seems gibberish but might be encoding / rate issue.Upload stuff:Input/output errornot in syncresp=0x00Awesome. Not sure if I can get it off the board also I am absolutely sick of working on this shit. What do? How to nuke the ROM? Anything else im overlooking?
>>2936943If you don’t have a USBasp, use an Arduino as ISP, where you program an arduino to be an ICSP programmer that you connect to the 6-pin header on the target you want to program. Then you burn the bootloader. FYI you’ll probably need to add a capacitor from the programming Arduino’s reset pin to ground once it’s programmed.
>>2936950its all so tiresome.USBaspbut another ome from the same batch programmed fine via usb
>>2936960same batchbehaves normalthis board got fucked up in no timeit was supposed to be an improvement over the last proto but whatever
>>2936962your mistakes were:>not just putting the mcu and supporting components on the board directly>trusting chinky arduino clones enough to not test each board first>not mounting the icsp header>using hacky usb serial bootloaders in the first place
>>2936987well it works nowregarsing the ISP id just solder wires when neededpls give me a rundown how to use 2 nanos in a fashion where i get around that serial on the underside of the board
>>2937039>pls give me a rundown how to use 2 nanos in a fashion where i get around that serial on the underside of the boardJust follow any Arduino as ISP tutorial:https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/Pic especially related. All the same data pins (D10,11,12,13) still go to the ICSP header on the target. The only difference when using a Nano instead of an Uno as the source, is that you probably need a capacitor from the source's reset pin to ground. 1-10uf should be good, only add the cap after you've written the sketch onto the source arduino. If you plan on doing this a lot, I'd recommend soldering a ribbon cable to the host machine with 2x3 IDC connector on it.The missing IC is the USB-to-serial converter (and the voltage regulator, in case you're running on 7-15VDC input). Without the IC you can't program it via the USB port, or send serial messages over the USB port.
>>2937046I got a lot of boards, uno nano mega dueso. if you say use uno for it ill use uno for it>missing IChehI sure know what a USB serial converter is and what it does. I mean after all thats what you see when you plug an arduino into your computer.The reason it's 'missing' is because I desolered the whole lot and generally speaking desoldering things with many pins and lots of masse with just iron and air leads to things like picrel. At least you get a free ch340 and linear reg. Would probably cost more than a chink nano if you bought them like that.
Hiya!So I have a 328p on a board and it functions as a source for PWM, either phase correct or up counting depending on mode of operation.My development process requires me to gradually hike the PWM up after making changes to a board, because an unpredicted element or any error and the whole thing will break.I can also not allow glitches here. It's a high EMI environment once the PWM is on.Low or zero value PWM is inconsequential. Accidentially high duty is bad.I want to hack something on to my board that lets me speed this up without having to reprogram.My thoughts how to do this are as follows:I will run code to adjust the PWM once in the setup() function and not update it during runtime. This is to make sure EMI does not fuck with the reading. I will place a row of jumpers that encode the desired setting. The jumpers will pull down as to defeat EMI and loose jumpers. A jumper being placed leads to the duty to increase. So again: This is meant to lead to a safe design, where a loose or forgotten jumper is not catastrophic.I have plenty of open pins on the board.So assuming I want 8 bit resolution I plan to reserve 8 pins (17, 18, [22,26], 28) for this, first set them to input, active pullup, delay, and then read each pin and shift it into a byte. When done pass this byte to the register like OCR1A.Then main empty while(1)What could go wrong? Is there a better way to do this? I want discrete steps and a low impedance environment. Again: I think a pot is too risky. I might even make entire 8 bit jumpers and key and mark them as to not make mistakes.
>>2937938>those pinsI’m not sure what pinout chip you’re using, but shouldn’t it be a full port? Like PB0-7 or PC0-7. That way it’s trivial to read all the pins at once e with a port read, and just save that to the timer/counter register. But I’d ensure your reset button/switch is actively pulling to a rail in normal operation, and only being pulled weakly via resistor when it is being reset. I assume all output pins turn hi-Z when reset is a logical high.Instead of jumpers you could use a pair of hexadecimal rotary selectors.For safety I’d tie LEDs to the jumpers/switches so you know they are in the right state when you toggle them. Or even better, have the MCU spit out the jumper setting somehow and ask you to confirm before it goes into the main loop. It could confirm with parallel LEDs, or with a digital output to a computer (galvanically isolate your signal), or to an I2C screen if you want. You could even just set the PWM value by comms from a computer and do confirmation the same way right afterwards. Ethernet comes to mind as it’s inherently isolated at both ends, but do whatever.You’re the EDM anon aren’t you?
>>2937956I'm thinking a bit like this:void setup() {int pinsInputPullup[] = {17, 18, 22, 23, 24, 25, 26, 28};for(int a = 0; a < sizeof(pinsInputPullup)/sizeof(int); a++){ pinMode(pinsInputPullup[a], INPUT_PULLUP); }char A = 0b00000000;for(int a = 0; a < sizeof(pinsInputPullup)/sizeof(int); a++){ A &= digitalRead(a); A << 1;...OCR1A = A; }>>2937956>but shouldn’t it be a full port?Luckily I'm dealing with an MCU and not some ASIC here. So I get to do whatever I want in the software, right? And the thing is on the board now and some lines taken. Why 'should' it be a port? I get it's convenient and saves a few cycles KEK. This runs once and the ALU idles after setting up its PWM.>use a pair of hexadecimal rotary selectorsI dont have any. Also why hex?>have the MCU spit out the jumper setting somehow and ask you to confirm before it goes into the main loopI should also note that there is a requirement where this gets done today and doesnt consume any amount of ressources, as such there will be no shopping and not much effort.>galvanically isolate your signalSame issue: No transformers. Optos might be too slow for serial but too much effort and potential pitfalls anyways.>set the PWM value by comms from a computerthe lack of isolation is why I am currently stuck in a cycle of unplug MCU, take to desk, upload config, plug back in. The very cycle I'm looking to speed up.>EthernetSee above. It's obviously a nano. Not writing and debugging drivers that abuse an ethernet port in such a ways today. I should mention my programming sucks and is slow.>You’re the EDM anonYou're the EDM curious anon. Latest purely qualitative measurements imply we do now have bipolar behaviour. KEK. It's not intentional but rn it looks like that. And the measurements check out when compared to each other. Obviously the voltage on the output side can only remain the same if no charge leaves through the gap or go up if charge is transferred into the output ...
>>2937956>>2937962...The output does exactly that. Dampened oscillation for ~ 3 periods during the discharge. The current waveform or first derivative thereof mirrors that.I wonder where that comes from. With the last board I sometimes felt like it's trying to do that. But there was no inflection points, not even real saddle points. Now since the inductor has a core (but same inductance), the power is up by quite a bit and the coupling cap is several times greater. I suspect one of those changes did that.Only remaining question is: Is that really beneficial, or not and what's exactly going on.
>>2937962Just assume I put the ~ there to account for the pullup logic>inb4
>wanted to create a simple remote control>chatgpt told me to get an STM32 Nucleo and CC1101 RF module>ok done>ask it to walk me through setting up a simple blink program to get going>need to create 4 different files with hundreds of lineswhat the fuck did i get myself into? i dont remember arduino being this difficult
>>2937938SHIT! There only really is 3 pins on that side. Well I guess its going to be a 3 bit setting.Cant be fucked. After all thats 9 power levels and if something is wrong I get to see that on the first, generally.Also >>2937964not ~its !.Like I said my programming sucks.
>>2937981int pinsInputPullup[] = { 17, 18, 19};for(int j = 0; j < sizeof(pinsInputPullup)/sizeof(int); j++){ pinMode(pinsInputPullup[j], INPUT_PULLUP); }uint8_t A = 0;for(int i = 0; i < sizeof(pinsInputPullup)/sizeof(int); i++){ A &= ~(digitalRead(i)); A <<= 1; }What am I doing wrong? It looks like pins 18 & 19 come back 0. I've confirmed they are all being pulled up.
>>2937983Solved. >my programming sucksmistakes were made.Naturally I wanted to A |= digitalRead(pinsInputPullup[i]);Also A<<1 on top of the loop as it doesnt hurt on the first time but would double the result on the last round when it's at the bottom.Now, with 2 random leads shorted to GND, it goes:000000000000000100000011nice.
>>2937962>Why 'should' it be a port?Because it tickles my autism, and makes it easier not to program it wrong. Which might be pretty useful judging by the subsequent replies. But your method is more free to the rearranging of pins, so I guess you’re not making a new circuit layout and are somehow using existing pins to add these jumpers?>why hex?Because an 8-bit binary number is the same as a 2-digit hexadecimal number. With 8 pins you get the full 256 different combinations. Decimal selector switches on 4 wires each would only give you 100 combinations, plus you’d need to do the decimal-to-binary division.>Optos might be too slow for serialJust use a slower baud rate. Or even just flash a single LED at the set duty-cycle and measure it with a photodiode (read: another LED) and your oscilloscope, or even just look at the brightness with your eye. That will be enough to avoid sudden increases of duty-cycle.>bipolarIs the voltage going low enough to get a spark jumping in the opposite direction? Hmm, maybe going without the capacitor is the way forwards…Also you’ve successfully convinced me that ECM is the better way to go if I just want subtractive machining of metal parts on the cheap. That still needs reverse feed-rates for short-mitigation though, so I’m waiting to see what your sucky coding (your words not mine) can do about that.>>2937963Mutual capacitance to the inductor core? What core material are you using anyhow?>>2937977Shoulda used an ASIC, like an HT12E.
>>2937995It aint pretty but it works. That goes for the hard- aswell as the software.We had a little explosion along the wax and half the time went into fixing that.Guess I shouldn't always use the transformer soldering gun. Works as advertised. Placing the jumper adds time to the on period as youd expect from binary, 1T, 2T and 4T or combinations of those. >the explosionI always thought those glass diodes were nothing but MELFs on a stick? And I thought the appeal with MELFs is the deterministic failure mode? Anyways I had a glass diode go short. B170 or whatevs I just used any. It blew a trace under a cap, what a bitch to find and fix it was.
>>2937999fun time debugging this shit
>>2937999That's why you should always route pads for each of the unused GPIO pins, at least whenever there's room. Some spare GND and VCC too, though in this case GND is covered for you. You never know when you're gonna need extra pins.Also not liking that solder blob bridging that trace on the left there.>>2938000Brutal, what caused the diode to blow?
>>2938003Well I spilled a whole lot of solder across the entire board. It fell off the tip. So I used a big glob of flux and flowed everything out, so I thought. Must have forgotten a few spots. So just a random short on the power for the DC-DC, not the high power section but not the digital either. I think that's literally the best outcome. On the high power section god knows how big the hole would have been, on the digital it would have gotten the regulators and such, maybe. The DC-DC power: Just that diode that I thought would fail open beyond 1A but it failed short. >Pads for extra stuff. Yeah good idea but then again soldering gun goes brrrrr. >not liking sold... - ACKsoldering gun goes BRRRRRRRRR
>>2937977Can someone explain this shit? Pic related works as expected; LED is on when button is released, and turns off when button is pressed.When I invert the highlighted if to say != BUTTON_RELEASED, the LED just stays off regardless of the button being pressed/released. What the fuck?>>2937995>Shoulda used an ASIC, like an HT12E.I don't even understand how to use that. My goal is a programmable 318MHz remote control to open a garage door.
>>2938012Oh. The button electrically shorts the LED to ground when it's pressed. Why the fuck
>>2938012Well what happens if you yet it to equal and stick the negation onto button released?But I guess it wont work. You'll probably have to look into how button released works internally.
>>2938013LMAOOOObetter safe than sorry huh
Are there only enthusiasts here or there are actually people who work as embedded developers?
>>2938050>here are actually people who work as embedded developers?Yes.
>>2938012There were other weird issues where my code wouldn't flash and I had to unplug & replug the dev board for whatever reason(took me way too long to figure out). But I've got a good starting point now: I put the dev board on a breadboard with a button and LED, and all works as expected. Plus, I set up UART for bidirectional serial console communication so I can actually debug shit and send commands to the board without wiring up a bunch of buttons. Working on the CC1101 but crimping duponts is a pain in the fucking ass so I'm waiting for the female to male jumpers I ordered.Does anyone know if there's an "adapter board" for a 2x4 pin layout to a 1x8 breadboard-compatible layout so I have something a little more rigid?Thanks for reading my blog posts!>>2938014>>2938015Turns out that button is a RESET, it's only labeled B1 on the board for whatever reason.>>2938050>there are actually people who worklollmao
>>2938054did until spring this yearno one on the team had a very specific position like 'embedded' developer. Everykne was just development engineer and the tasks reflected that. I mean we had guys who werw more or less on one or another side of things and they'd do the respective tasks. But in reality when you're responsible for a few products you get all sorts of work, some hw, some fw, some sw, general design and integration and testing things, compliance and what not.
>>2938050I'm not working for much longer lmao
>>2938078>I set up UART for bidirectional serial console communication so I can actually debug shitYou’re using a nucleo board, its built-in programmer is also a debugger that can pause the MCU and read out its registers, use GDB for this if you want proper cycle-by-cycle debugging.
>>2938120>its built-in programmer is also a debugger that can pause the MCU and read out its registers, use GDB for this if you want proper cycle-by-cycle debugging.Thank you! That's great to know.
>>2938112You're just feeding them while they can't stop laughing and assume you're literally retarded because no mstter how many times they fuck you over you still support them.
>>2938078>CC1101Can't get it working. I can initialize it and put it in RX mode, but it just picks up constant garbage instead of an actual signal.Using CC1101_ReadStatusReg (with 0x30-0x3B addresses): PARTNUM (0x30): 0x00 VERSION (0x31): 0x14 MARCSTATE (0x35): 0x01 RXBYTES (0x3B): 0x00 TXBYTES (0x3A): 0x00Configuration registers: FREQ2/1/0: 0x0C 0x2E 0x8B
>>2937999I’ve been thinking about a bootleg reverse g-code alternative for clearing short-circuits. If a short is detected by a comparator or whatever, an arduino could then pull a pin low to tell the mainboard to halt it’s g-code execution, and another pin to stop the EDM machine from pulsing. Then the MCU would send its own step/dir commands to the Z driver to move upwards, until the short is cleared. Then it would move downwards either until it reaches its original position or until it detects a short again and has to move upwards. When it’s moving up the EDM pulser is disabled, when it’s moving down the EDM pulser is enabled. Once it gets back to its old position with no shorts, the pin goes high again and the mainboard resumes g-code execution.I was reading a GitHub post and the guy was saying you want variable feed-rate with feedback to your spark voltage, for ECM I guess you could do the same, but I don’t believe Marlin or GRBL have the capability to do adaptive feed-rates. Maybe LinuxCNC can. I think GRBL can do g-code halting, I suspect Marlin can too but I’ll have to look into it.
>>2938447What you described neither needs G-Code, GRBL, a stepper controler, steppers or any of all that since you're describing a ome axis machine 'sinker EDM' or 'ram' where the reversal of movement is trivial. If it's working in the - Z direction reversing to clear shorts means +Z.>variable feed rateYes you can do that. Especially since that is a very common feature on all sorts of CNC machines, where the UI often includes a rotary encoder or pot that can be used to overwrite speeds and feeds.But the case where this actually is non-trivial, idk if it was ITT, an earlier one or an entirely different one, but I have alluded to that before, is 2D movement, like it is commonly associated with WEDM or any other EDM process that actually requires a toolpath. Suddenly clearing a short is non-trivial and requires at least understanding of the current movement vector at the time of the short occurring or actual memory of the toolpath leading up to the short. Luckily this has been solved by Roland of the G-EDM project, who rewrote GRBL do do exactly that.
>>2938463My suggestion would still work fine for side-milling so long as the tool has no concave geometry. Not for a slitting saw, but yes for an end-mill. Sure it would be inefficient to go all the way up out of a deep cut to clear a short instead of just backing off a quarter mm, but it should work. Hope it wouldn’t get caught on the way down again.>Yes you can do that. Especially since that is a very common feature on all sorts of CNC machines, where the UI often includes a rotary encoder or pot that can be used to overwrite speeds and feedsNo I mean adaptive speed changes, where the machine detects the load on the cutting bit and adjusts the speed accordingly via some sort of feedback loop.>G-EDM projectOh I should look into that.
>>2938466I don't think you're getting what I wrote. It is a standard feature on NC controllers to have an input for adjusting speeds and feeds on the fly. The input is a defined interface, it does not care if an actual rotary encoder or pot is connected to it, only that whatever is connected to it acts or looks like it and thus conforms to the interface.
>>2938469>The input is a defined interface, it does not care if an actual rotary encoder or pot is connected to itAh, I see what you're saying. I assumed there'd be a separate input for a manual control compared to an automatic control. Because the automatic control is part of a feedback loop, it should increase the feed-rate until the voltage passes a threshold. If it's just expecting a potentiometer then you'd need an external error amplifier, which is ok, but then if you also want to be able to automatically set a different voltage threshold for roughing and finishing passes you need a DAC. Anyhow, does GRBL or Marlin do that?Hope that GEDM project will be applicable to ECM.
>>2938480>>2938480I omdont want to offend but I think you're a bit all over the place with your thoughts and also more concerned with what could be done instead of what is sensible to do.Like having two MCUs and have one take control from the other and hand it back without having a real interface and protocol for that... it doesnt make too much sense.Meanwhile the speed overwrite input: It's just that. Input that overwrites speeds. And its got a nice interface, you know, voltage, or pulses.>you need a DAC you never really 'need' anything digital. Yes there's reasons why we like to do things digital and avoid analog as much and as long as we can.Also switch that either puts another R in series or parallel with that signal source or biases it by various means if one really insisted on jogger rigging something like that onto a preexisting input of that kind. >Does controller firmware do thatYes absolutely. Besides the fact that you can always write a simple M code, marlin for example is already equipped out of the box to toggle a digital pin on any board that you have a HAL for.But if you ask me: Just use the S parameter? I dont expect you to have an actually rotating spindle. And your gap voltage is probably the best analog. So instead of not using the S parameter at all just define it as an proportional to gap voltage. If you insist on a hacky solution feed a diff amp of that and the gap voltage into the speed overwrite? Tada theres your thing.
>>2938531>I think you're a bit all over the place with your thoughts and also more concerned with what could be done instead of what is sensible to doI’m just spitballing for now, trying to see what is doable, then narrowing that down to what’s sensible, then narrowing that down into something I should make. My aim is <0.1mm accurate parts made of metal for cheaper and quicker than getting them milled or 3D printed overseas. Wire and sinker processes are useful for specialised geometries, but I’m just after bulk roughing out of billet, so a square-nose cylindrical end-mill is probably the way to go for me. EDM seems both more difficult/expensive to make, while being slower and more prone to tool wear.>SAhh, that’s a very nice elegant method with a pulse frequency output that’s easy to turn into a DC voltage. If I have to use Marlin or GRBL it’s worth keeping in mind.But that G-EDM project looks promising enough I probably won’t have to use stock GRBL or Marlin, and I think I have all the stuff lying about to get it working, sans the screen. Wish it had better documentation, but it’s a relatively new project so we’ll see.
Is there any way to use the counters in a 328p so that there is an output that is centrally aligned to an edge of the other output?Like imagine one output toggles but just before every falling edge the other output turned 1 and back to zero after the falking edge. So it's like the phase of one outpur was aligned to the edge of the other.
>>2939743Maybe if you could use a single timer with one compare channel in phase-correct-PWM mode and the other output toggle-on-rollover mode, but I suspect you cant have two different waveform outputs in a single timer. Worst case you just synchronise two timers I guess. There’s probably a smart way of synchronising timers with interrupts but I never tried.
>>2939771I think I have now settled on just cycle counting and probably hard coding a few modes. The thing is I dont need anything besides the setup and then the timers. So for the time being I can just keep cycle counting indefinately without ever handing over or overly complex flow.And afaik... idk 4 cycles for a noop? I think it was something lile that, I need microseconds so that should be well within reach and precise to some digits too. >inb4yes single micros not multiples of 4 plus minus
>>2939775I would have just delayed the other output (assuming trailing edge) and sent the output through a pulse stretcher using some discrete logic.Helps if you have access to a 2x freq clock.
>>2939848the board is as is I can only change software at this point.>which is better:i could make a simple blocking delay function that takes one argument, uS, multiplies it and loops through as many noops and call this at several points in an eternal loopAlternatively I could reset a timer and block using a while(timer register < xxx) {}and reset the time every timethat way it wont ever overflow and I dont need to add previous elapsed timeWhich method to prefer and why? I'm bad at programming and I think I'm experiencing paralysis by analysis
>>2939942Is, in the arduino environment, thisvoid loop() { do stuff} any different fromvoid loop() {while(1){do stuff)}}? I have just written my stuff using delayMicroseconds which is bad as it again has a resolution of maybe 4 uS but i wanted to get out of paralysis quickI've then caught a glitch. See picrel.I was concerned over arduino related stuff like watchdogs or similar fucking my shit up.So I tried while(1) to prevent it from ever handibg back and I havent been able to catch another glitch which doesnt mean there is none.Glitches would be bad.
>>2939954I'm now also thinking:no interrupts might be a good idea anyways but also:Is there anything in an otherwise empty 'sketch' that could trigger interrupts
schematics for burst emitters ?jammers also plox
>>2939974This seems to work oksi[code]void microsecondsDelay(uint8_t uS) { uint8_t count = uS * clockCyclesPerMicrosecond() / 4; uint8_t i; for(i =0; i<count; i++){ asm volatile ("nop\n\t"); } };[/code][code] PORTB = 0b00000000; //Idle microsecondsDelay(1); PORTB = 0b00000010; //Charge microsecondsDelay(1); PORTB = 0b00000110; //Connect gap microsecondsDelay(1); PORTB = 0b00000100; //Discharge through connected gap microsecondsDelay(1); [/code]I figure a nop is 1 cycle but the loop itself is more like 4 cycles because the incrementing and comparing and all that? idk? is it? it looks kinda good and I'm just going with the inaccuracy as long as I get the precission.Like yeah sure figuring out count every time takes some cycles too.
>>2939954> glitchInterrupts disabled?
>ardushitto
>>2940048Yes I have disabled interrupts for the critical part. I'm curious regardless, suppose you did not, what is there in an otherwise blank 'sketch', when n there is no comms and nothing, to trigger interrupts?
>>2940127The USB serial bootloader
>>2940219wouldnt that onyl trigger shit when comms are happening?
>>2940226Only happens at boot / power-on-reset, regardless of whether there's serial comms, not sure if there's actually an interrupt going on but it sounds likely.
>>2940240Mhm shitty situation, since I need to be sure and I have nothing to trigger on pulse length xid have to make a counter
>>2940242it's only there on the boot period anyhowif you're worried just wipe the bootloader and use an icsp programmer instead, bootloaders were a mistake anyhow
>>2940127You wouldn't have to ask this if you didn't use arduinos ridiculously shitty framework.
>>2940245nah thats ok first thing I do is bring everything to a safe statethen set everything upand only before entering the loop all safeties come offthe one I caught did occurr in the main loop
>>2928655hello mcg, stupid question since i am new to this.how are chips attached to eval boards like picrel? does it have to be soldered if you want it to stay fixed in place?if the latter, could you not just solder on some wires yourself and skip the eval board altogether?i have the chip, but not the board.https://www.mouser.com/new/infineon/infineon-xensiv-pas-co2-5v-eval-board/
>>2940354There might be other interrupts coming from arduino functions though, like analogRead, delay, or serialPrint. You should avoid these and directly address the registers if you're unsure.>>2940438What do you mean by "chip"? The IC? The metal can? Or the surface-mounted BGA(?) board that contains the IC and the metal can? The lower board that the surface-mounted board sits on looks to just be a breakout board for prototyping, so you should be able to do without that.
>>2940479I did not use any of those and only used direct port manipulation and register read writes. Idk how to use all that I only work with the 328p and AVR reference. Thanks for the heads up, all spunds like I expected.>>2940438You have many options. In production, if all the products are configured the same, it is not uncommon to solder directly. So either you have 1mm holes for the 0.64mm pins and mount it THT or you can even save yourself the pin headers and aolder vias to vias directly. Depends on if and what there is on the underside and if you can have a cutout in the board etc.It's also possible sometimes to mill the contour of a board like that so the outer vias are disected. You then have really nice exposed features to solder SMD style.You can ofc always mount a female header of varying quality or use ribbon cables. This depends on space, the need for customization or replaceability, shock and vibration rating, current rating and RF performance. You can sometimes run two grounded pins on either side of your RF pins, it sometimes helps.
Alright MCG I am reusing a vacuum pump that has an air pressure sensor and a mini dc pump (yb370) I originally used it to vacuum seal filament bags, and SMT pick up tool once in a while, however I wanted to make some changes to work with a foot pedal and a solenoid. What I have got right now is a 5A pwm controller that has a resettable fuse.>https://www.amazon.com/dp/B091SHPR6L2v025 solenoid 12v>https://www.aliexpress.us/item/3256805024070436.htmlair pressure sensor hp203n (reused) arduino nano OLED screen lm2596 or mp1854n 12v -> 5v for motor and nano usb poweredlogic level shifter for hp203n operates at 3.3vNow my question is, how should the motor behave? Should I just have it continuously running even when air flow is block (picking up smd chip with blunt needle) or would I want the motor to stop when it reaches a certain negative pressure, and turn back on when it loses *insert epsilon value* kpa/pa?To me it seems option 1 would wear the motor out or ruin the motor while at the same time maybe not, while option 2 also seems like it would ruin the motor and the reason for that is because the pneumatic connectors I currently have suck apparently since I cant hold a seal when suing any of them.pic not mine just found online.
>>2940941just run its what units sold as lab equipment do toand it makes sensevacuum pumps are designed to reach a certain vacuum at which the lack of gas to pump will automatically let them shed load. Usually mmvacuum pumps are rated to run under those conditions indefinately. You see unlike a pump providing positive pressure vaccuum has a limit and the work doesnt get harder, it gets easier.
>>2940944>vacuum pumps are designed to reach a certain vacuum at which the lack of gas to pump will automatically let them shed load.When I powered the motor directly it was 5v @ 0.7a this probably explains when it dropped to 5v @ 0.4a when I blocked the tube. the pwm controller seems to have limited the current to 50ma and would shoot up to 200ma when I blocked the tubing, I guess I would just discard using the pwm controller and just power it @ 5v then?
>>2940950Yeah, vacuum pumps (and your household vacuum cleaner) use less current when blocked.But a pump like in picrel is not long for this world, so you want to minimize the on time, and also minimize heat buildup.
>>2940956Well from your comment and the other one, it sounds like I should just grab the old pcb that was controlling it, and modify what I can, the manufacturer didnt put any markings on the main IC, and it a pain in the ass so many of the pins are on ground, some pins I manage to figure out but damn I wish I could look up IC by pin placement, and ic-type or whatever ssop and others like that are called.Anyways thanks, I was hoping to power this from a power supply but I cant seem to find out if this non used solder points P+ and P- are meant for another version of the vacuum pump that can be directly powered from a power supply, but I guess I will find out.
>>2935852just get a j-link edu, if you only use it from your private network.Olimex also has a cheap open-ocd debugger.
i want to turn wireless debugging on to use Shizuku on my Android phone WITHOUT using any wi-fi connection ("wireless debugging" requires this and i can't find any way to bypass this without root and i don't want to root rn) or any device to set up a local hotspot.apparently, this isn't possible, so the next best option is to get a the smallest, most portable router for a local hotspot.is this $4 USB pocket wifi modem i intend to use unSIMmed the best option or could i get a cheaper microcontroller to program a start/stop local hotspot routine?>second phonedon't have one.>captcha: KMSWR
>>2940479>>2940490late reply, sorry>surface-mounted board that contains the IC and the metal canthis sounds about rightpicrel is the underside (14 mm wide)if i buy the breakout board, would i *have* to surface solder the "chip" for it to remain in place? would it be viable with some jank alternative like electrical tape to make it not fall off? rigidness is not too important.i only have breadboards, so option 2 would entail soldering free wires directly onto the "chip" which then go to the breadboard. but that sounds risky given the size. will an inexperienced solderer not just mess that up and damage the sensor?
>>2941373Pressure-based mounting might work if each pad was connected to with something compliant (e.g. pogo-pins), but just taping down one board onto some other surface, even with solder bumps, likely isn’t going to work at all, at least not reliably. Soldering wires onto the pads is the other option, but if you tug on the wires it might rip pads off, and the pinout doesn’t seem to describe what those central pads are for.Have you already bought the module without the breakout board?
>>2941476>Have you already bought the module without the breakout board?yes. i made a mistake>Pressure-based mounting might work if each pad was connected to with something compliant (e.g. pogo-pins)seems unlikely to be the case here, so i think wire soldering is the best option then. i'll probably do it with some female dupont headers. thanksgetting this thing to work will be an excuse to get into soldering, i don't mind desu
I'm a software engineer but just finished an arduino course and now want to build a digital wrist watch. I'm trying to pick out hardware, and the Cortex M0 looks promising as a core. I've narrowed the MCU down to either STM32L0 or TI's MSPM0L (both ultra low power devices). I'm slightly preferring the TI because it's smaller (I'd eventually like to minitiarize the watch as much as possible), newer (although this might be a bad thing), and looks like it has better docs (STM's website is a mess but maybe I'm just too stupid to navigate websites properly). Additionally, as a software guy who's completely comfortable working with code/bits/memory/etc, I found the "hand-holding" of Arduino IDE a bit patronizing, and it seems like there's lot of that in the STM32 ecosystem (although I'm sure there's ways to cut through all that). Would choosing the TI chip be retarded? ChatGPT is pretty strongly pushing me to the STM32; not sure if that's actually the best choice or just the midwit consensus from the internet hivemind.
>>2941507do you really need a 32-bit chip for a wristwatch?it's not a smartwatch, is it?an msp430 might be a smarter choicethe stm32 ecosystem is wide, if you learn one stm32 then that's a skill you can apply to a lot of different parts for different applications, but yeah people do have some opinions about their bloated hal
>>2941507>Would choosing the TI chip be retarded?I've never had MSP430 be easy to use unless you're running Windows and have the official TI debug thingy or maybe a hacked up launchpad board.STM32 you can hack up a GCC toolchain and use a $5 clone STLink to talk to the chip.It's been more than 10 years, but I remember that MSP430 had some goofiness where the contents of the interrupt vectors worked like a password for accessing the chip, and if you didn't have it right it would erase the flash, including the part of flash that contained factory calibration for the RC clock. There's security and then there's paranoia. (I was able to sort of recalibrate against a 60hz zero crossing detector)I didn't hate MSP430, it was an okay architecture and even kind of fun, but it was too annoying to work with when I was no longer being paid to do so with someone else buying the tools including an IAR compiler. On the other hand, my STM32 experience let me use a Bule Pill board with no problem.One anecdote is when there was a bug in the Mac version of the debug driver, TI fucking held the patch back because they insisted on their development package being all the same version number and they weren't ready to make a new version even to fix a bug.Yeah, this was the TI of 10 years ago, but I haven't seen much excitement for them since then. I did eventually get one of those old MSP430 wristwatch kits a few months ago, but way too much other stuff to do for now.
>>2941527>>2941529I did consider the msp430, but it seems like TI has bet its future on ARM with the mspm0c/l/g. I'd also rather work on ARM because it provides an easier pathway to BLE if I ever want to support that (with nrf52 or something like that). Since ultra low power consumption is basically the same between msp430 and mspm0, I don't really see a compelling reason to go with msp430 unless it's vastly simpler (but sounds like it probably isn't).Question then becomes which vendor do I choose, TI or STM? I think TI looks interesting, but I could easily get annoyed if they force me into using shitty tooling. There definitely seems to be a strong "bare metal" STM32 community, so I would have a lot of resources to help me figure that out which I may not have on the TI side. STM32 definitely seems like the safe choice, but the only thing holding me back is that the STM32L0 is 25mm2 in area vs 16mm2 for the mspm0. And as an American, it might be better for my career to be on an American platform vs European, but who knows.
>>2941567>ultra low power consumption is basically the same between msp430 and mspm0Oh that's impressive. I bet they'd sell a lot more to hobbyists with an open toolchain and open-source hardware for the programmer, but TI doesn't seem as into that as Microchip or STM.>TI or STMI'd go STM. While they don't encourage people programming it bare metal, plenty of people do, and there's lots of 3rd party development environments to choose from. The programming hardware is also dirt cheap. People clone those chips too, with things like the GD32. I think you can also use the same programming hardware and software for their smaller STM8 chips, probably for ST's ASICs with an ARM core inside (e.g. motor drivers, power management chips, etc.) too.
>>2941567>an American platform vs EuropeanNobody with any sense calls STM32 a "European platform".
So the recommended method to handle multiple SPI slaves is to share the SCK, MOSI, and MISO pins, and use a different SS pin for each. But then you go into the datasheet of an MCU like the 328P and find it only has one hardware SPI SS pin. What the hell is the point of that? Do the tarduino libraries just bit-bang SS synchronously to their SPI hardware communications calls? It’s not that big of a deal since there’s no DMA, but it feels kinda silly. I could also apparently use the USART hardware as SPI, though I doubt existing libraries would know how to work with that. If you do set some random GPIO to be SS, what happens to the actual hardware SS pin? If it’s set as an output pin, does it toggle alongside your software defined SS pin?
>>2941507>arduino course >asking chatgpt fort adviceIs there a better general, board, or website, where I don't have to see this clown shit?
>>2941569Thanks for your help. I'll probably go with STM32 and see how that goes. This stuff is complicated enough as it is, I'd rather not trail blaze on a relatively new platform.>>2941573I never claimed to have any sense, but STM is definitely a Euro company. Probably doesn't matter, but if I ever want to sell electronics in the USA, it could be easier to get government gibs if I used TI.>>2941580The datasheet labels PB2 as a "slave select pin" which is only applicable when SPI is enabled as a slave. When SPI is configured as a master, I don't believe there's no special relevance to the PB2 pin (maybe aside from some arduino lib internals). And yes, you need 1 pin per slave (any gpio pin works) and need to manually pull it low before transmitting SPI, but I'm sure there are libs available to make this more ergonomic. I'm a noob, so maybe get some verification on all this, but that's my understanding.>>2941593Sorry to offend you, fren.
>>2941605>When SPI is configured as a master, I don't believe there's no special relevanceThat's probably how it works. The SS pin only matters for a slave device. Otherwise any old GPIO can work as a select.I've been doing some 68HC11 stuff lately, it seems to be the same, and that era was the OG of SPI.
>>2941567> bet it’s future on armNo, msp430 is just their 16-bit platform.If you are coding it in assembly, this is the one you want. It was designed for that.If you’re loading python on it, you’re going to want something with x1000 more power, and that’s going to be a 32-bit arm based core(s).Although, you’d still be able to get more compute done on the 16-bit MSP 430 than the ARM.“Loading python on it” is code for “doing anything other than machine-level programming”… and ARM really sucks for low level stuff. And has gotten worse. I think you can find ARM cores that potentially have around 1200 instructions now.
>>2941678>… and ARM really sucks for low level stuff. And has gotten worse.Lolwut? You want to use python instead?
>>2941626> been doing some 68HC11Sounds interesting. Using real 68hc11s or is it a second-sourced core?I see 8051 cores being used to glue analog radio to I/O sometimes, running at 50 MHz/1 clock/cycle…… more than anyone really needs.
>>2941683>Using real 68hc11s or is it a second-sourced core?Why would I use core shit when there are plenty of 68HC11 chips in user-friendly DIP packages?
I have thought about a digital dumb watch that has a calendar snooze. I dont really care about the heart beat feature. Also maybe have it tell you when it’s going to rain. What else.
>>2941605>>2941626Ah I see, you’re right. You can set the SS pin as an input or output when in master mode, and as an output it works as any regular GPIO pin without being connected to internal SPI hardware. When used as an input it actually acts a bit like an SS pin of a slave device, if it’s pulled low it interrupts the transmission process.Damn this is the kind of stupid question that GPT or whatever would probably help with. I should investigate running deepseek or whatever locally. Maybe an American model too so I can ask it about what happened in Tiananmen Square.>>2941678>> bet it’s future on arm>No, msp430 is just their 16-bit platform.I don’t see how that’s a contradiction. MSP430 is their 16-bit MCU series thats often used for low-power and has been around for decades. MSPM0 is their ARM M0 core 32-bit MCU series that they’re pushing hard because it’s more powerful and can have just as low a quiescent current.>pythonOk I get that they disincentivise writing for ARM chips in assembly, and they may even not have very good documentation for those who write C without their bloated HAL, but there’s still a long jump between using their HAL and using Python, your superlative is unfounded. The MSPM0 ARM chip isn’t even supported by micropython. HALs should still compile down to be about as memory and clock efficient as bare C, and pretty close to assembly, while Python is nowhere near as fast or as dense.>>2941686Ionising radiation detector, be it ion chamber or SBM21. Also make it collect time information from outside, be it wifi, GPS, those radio broadcasts in some countries, whatever works. Ideally it automatically handles daylight saving time.
>>2941708> ARM M0 core 32-bit MCU series that they’re pushing hard Not sure why. I just spent a bunch of tine researching the M0s. These are chinese arm slop cpus they’re selling. They even left chinglish in the data sheets. I doubt TI even fabs them, None of them have FRAM, and the ADCs are very different. In fact, *everything* is different. So different that, after reading the migration guide, you basically have to throw everything away and start again.> because it’s more powerful and can have just as low a quiescent currentThat is not clear. They both do around 80μA/MHz but the msp430 does more useful stuff in 1.3 μΑ low power mode, and they both have multiple LP modes.The average M0 user is not likely to be sophisticated enough to effectively use those those modes anyway and will likely use 100 times the amount of power transferring all the data internally as yaml.If you need 32 bits for a watch, that’s your problem, not mine.
>>2941686Yea, I'm doing the dumb watch thing too. Putting a nice digital display into a fake nautilus case for phase 1 of the project. Would like to hook up the crown to some type of rotor control to set the time, but we'll see. Any ideas on how to do that? Btw, hoping to get 5+ years of battery life on this with a coin cell.>>2941678I mean I could code it in assembly, but not sure I want to. Like >>2941708 said, C should be just fine, no one is talking about python lol. Question, are STM32 HALs mostly just a collection of macro definitions? On Arduino, looks like a lot of the "digitalWrite" etc methods actually incur a runtime memory/perf cost, but if this HAL bloat is really just zero-cost abstractions in the pre-processor, I'd be much more amenable to it. Would still need a register level understanding of everything, but wouldn't mind importing some HALs to make life easier.
>>2941684> core shit when I have DIP?Good point.MSP430s also have DIP, I didn’t see any M0s in dip (might exist, who knows)
>>2941763> zero-cost abstractions in the pre-processorYou have to look at the generated machine code.There is a bunch of shit written by retards that do processor checks and case statements in the code and they’re not just #defines.In almost all cases, it’s easier to init the cpu, ports and peripherals in machine code.
>>2941765The only DIP ARMs in a long time were a couple of NXP chips, and they were low pin count too, no 40-pin monsters.You could probably put a QFP on a breakout board, but at that point you might as well take the Blue Pill and add the crystal and some jumpers.
>>2941849Carriers are the way.I think now the epoxy packaging (and the process to make *any* chip) is the bulk of the cost for high-quantity production parts)
>>2936943select old bootloader
I have a question, I am reusing a pcb to control a vacuum motor and that turns it on / increase pressure limit. To turn it on its a button press that shoorts gnd pin to another pin,if I wanted to simulate this on a esp32 cant I just solder wire too the non ground pin and then have esp32 make that pin from low to high or high to low to think the pin go shorted to ground or would I need to use djt/transistor whatever according to my google results to achieve this?
>>2942247Generally, yes if both are using the same power supply.Output pins have a fan out rating that lets you know how many inputs can be driven with that output.You might want to put a resistor between them though, just in case.
>>2942247To be safe I'd use a logic transistor to pull it down instead. That way you don't have to worry about power rail timings or voltages. By logic transistor I mean either a small-signal Nch MOSFET with a low enough Vgsth to turn on easily from the ESP's 3.3V signal (probably also a resistor from gate to ground), or a small-signal NPN bipolar transistor with a series base resistor. All of these methods assume a shared ground rail, which is usually a safe assumption.If everything is on the same 3.3V supply then using a GPIO should work fine. If you keep the button in place, ensure that the MCU can never pull high hard, only ever with a pullup resistor (if not just go hi-z by setting it to an input and using the existing external pullup resistor), to ensure you don't get the fault condition whereby the ESP is pulling up while the button is pulling down. A series resistor is a hacky workaround, as it might not result in the signal being pulled low enough.
>>2942314> fuck around with transistorsNo need with TI’s “little logic” line. Use a buffer or inverter as appropriate, or use the line level translator series in picrel.
>>2942329We want something that actively pulls down like a button, regardless of what voltage a resistor is pulling it up to, and actively pulling up is detrimental if he's keeping the button in place for manual use. You could get a level-translating buffer with an open collector output, but a transistor is both easier to wire up and cheaper. Especially if you get a logic transistor with built-in resistor(s).If you use no transistor or logic and wire the MCU pin directly up to it, you also get the benefit of being able to sense whether the button is being pressed. I'm designing such a PFET power latch button circuit as we speak.
Man, my DHT11 is giving me false readings half the time. I’m using an ATMega328P’s internal 8MHz oscillator so it could be that the clock isn’t accurate enough, but I measured a tone output and found it to be within half a percent of what it should be. Guess I’ll flip it back to a crystal oscillstor and see if that helps. Damn “one-wire” sensors are stupid.
>>2942736Clock stabilisation was not the issue. Hmmst.
I was thinking about implementing a humidity/temperature lookup table for a sensor with interpolation, but then I realised I’d be much better off just calculating a sufficiently matching polynomial.
Anyone ever messed with ESP-NOW protocol?
>>2943149That’s fine as long as you don’t want to recalibrate it over time and/or different temperatures, and your μC has ultra-fluffy things like hardware multiply.Interpolation is an add and right shift p.
>>2943155Well I’ll be collecting humidity-temperature values together, so it would be a bilinear/bicubic interpolation that takes temperature into account anyhow. I’m pretty sure the curve will be pretty simple, like an exponential or logarithm or whatever, without inflection points. The sensor varies its capacitance with temperature and humidity, and I’ll be measuring it’s capacitance as the C in an RC oscillator. I’ve got a datasheet for a very similar part with a dense lookup table in it (though it doesn’t go into the high temperature range I plan on using the device in), but besides that I can only do some pretty coarse humidity calibrations myself. Using sealed containers and saturated salt solutions. So it will be important to get an idea of the trend from the datasheet values, normalise them if needed to my values, and extrapolate them to the extremes.I don’t actually know how I’d compute a Taylor polynomial for a 2-variable system.
>>2943186> I don’t actually know how I’d compute a Taylor polynomial for a 2-variable system.Last time I did something like that I just made a guess-and-check loop converging the chosen coefficients towards making tests on the curve against data points more accurate (maximally accurate, in fact).Took less time than finding my old textbooks and whatnot.
>>2943307Sounds like something I’d do, I passed a physics paper using euler’s method for my integrations after all.So if I understand, I not only have X, X^2, X^3, and Y, Y^2, Y^3, but XY, X^2Y, XY^2 terms to guess through, right? Seems like the extra dimensionality will hurt, but I’m thinking I can match just an X cross-section with X terms, just a Y cross-section with Y terms, and then use the XY terms to make the rest of the graph fall into place.
I have a specific thing I want to create, a multimedia knob with 1 in and 2 out. one to my headphones and one to my speakers. I want to quickly be able to switch outputs, control volume, and mute, ideally with as few buttons as possible: spin the knob to control volume, press it to mute, and press+turn to switch outputs.what do I need to study to know how to make this? where do I start?
>>2943333The easiest thing to do would be to make one that does this as an analog device.If you want to make it digital, and you’re using a PC obviously you can make something that emits keycodes over usb that can do everthing,My keyboard already has a big volume dial and mute on it.
>>2943333>>2943368Doing it all digital would mean a USB device that does both audio and HID. You might be able to program that all on one MCU acting as a virtual hub, but I’d probably use an actual hub IC and wire it up to a TI USB audio codec and a shitty USB MCU running the keybinds.If you don’t mind two cables, having the HID device on USB and the audio stuff on 3.5mm would be easier. You could change volume and maybe do the other fancy stuff without any USB interaction, but then you’ll have PC volume control be seperate to the device’s volume control, which is suboptimal.
>>2943368>My keyboard already has a big volume dial and mute on it.that's how I arrived at this idea in the first place, I got a keyboard with a volume dial and a mute button in the center. it was super convenient until the volume dial stopped working, it's a common issue with these keyboards. the "fix" is spraying under it with contact cleaner which does work, but only for a few weeks.
>>2943397Surely you can just replace the potentiometer / encoder? Assuming it can’t be disassembled and chucked into an ultrasonic cleaner.
>>2943333This is trivial to do on Linux with an off the shelf knob programmable via QMK. Just did it today with my new GMK26. I wrote a script that toggles between any number of sinks exposed by PulseAudio.
I'm building a kind of not really joke alcohol dispenser and I have a bunch of peristaltic pumps driven by servos.My lame ass idea is that with the servos I can accurately control dosage of the various liquors.What shitass microcontroller on a board is up to the task of handling like 16 different servos, and some actual valves that I haven't yet determined what to use. Also shit like 6 switches one for each drink output and maybe some lights. I have in the past used a stm32 on a different project. It may be wise to for this if I want to do anything with rs485/can
>>2943886What sort of servos are they? Common RC servos can't do continuous rotations, I'd probably use cheap stepper motors. As for driver pins, I'd consider just having one driver and using relays to multiplex which motor is being controlled by the driver, assuming you don't need to meter out multiple fluids at once. Or even use a single main motor, plus an additional motor to rotate a camshaft that engages the motor into just one pump at a time.
>>2943889Oh uh they are I think, they are 4 wire things, kinda big.The idea is very much to have multiple at once going. Some are shared between valves. There is like 7-8 bottles and some will have up to 4 pumps to match the flow rate in a 4:1 mix because it's cheaper to buy 4 pumps than a larger one
>>2943941Isn’t it easier to just run one pump at a quarter the speed of the other pump? Or is speed a real constraint? Peristaltic pumps really aren’t designed for speed.
>>2942736Bugger, looks like the tinyDHT library is just bad, while the floating point DHT-sensor-library by Adafruit works fine. I won't stand for floating point on my 8-bit MCU, I'll have to fix the library.
>>2944007Well the pump I selected will do 70ml in ~10 seconds which is an ideal speed for the rig. I would need either a pump that matches that at a staggering 1,6L/min or simply use four.Don't really want to wait 40 seconds for it to pour out a drink.
>>2944132>Don't really want to wait 40 seconds for it to pour out a drinkFair enough.
https://www.youtube.com/watch?v=Pncr6W0m8AA
I'm doing some fixed-point math on an ATmega. I've written a constant value not as 0.00216, but as 142; it's been multiplied by 65536. This is fine, it's a 16-bit number that allows me to multiply it with another 16-bit number, but then I get a 32-bit number that I want to scale back down by a factor of 65536. I know I could use bit-shifts, but these AVRs do one shift per clock cycle, so it's not exactly the fastest option to do 16 of those in a row. I could also just do an integer division and hope the compiler optimizes that out. But something tells me I can use pointers to just grab the upper 16 bits of a 32-bit number, which should only take a few clock cycles. And probably also do the same to write a 16-bit number to the upper word of a 32-bit variable directly, instead of doing a hardware multiply.Can anyone tell me how to do this?
>>2944336Write it in asm if it's time critical and you want it to be guaranteed fast. Then everything should be obvious.
>>2944336>I know I could use bit-shiftsWait, are you doing this in C? On AVR? With its 8-bit registers? If it's possible to just take the two high bytes then the compiler will just do that when you ">> 16".You know how to view asm output from the compiler, right? It's something you SHOULD be doing so that you can understand what's going on. Fuck vibe with an AI, vibe with the compiler is more useful.
>>2944344Haha, I’ve been stealing bulk code from C compilers for decades and shoving it in my assembly. Do likewise gents!Then I usually go through it after the feasibility demo with the CTO (to unlock budgets and funds) and get rid of all the compiler cruft, like their ridiculously inefficient function call semantics and absolutely terrible register use.
>>2944364Yeah, let chatgpt convert the C code to asm.
>>2944342I know, but I'm an ASMlet AND a tarduino.>>2944344Yeah, C on AVR. I could probably find the ASM output, but I decided learning how to do it with pointers is worth doing. Importantly, I needed to do:>uint16_t *pPSat32 = (uint16_t *)&pSat32;which I copied from a stackexchange, and then I get>pSat16 = *(pPSat32);as the lower half,>pSat16up = *(pPSat32+1);as the upper half. No noticeable increase in progmem or RAM consumption.Feels good to learn something, even if I'll forget it in 2 weeks.
>>2944404You will be pleased to learn that this type of pointer conversions is undefined behavior in C.
>>2944404Just know that you've now become endian dependent. It might not work that way on a different CPU.
>>2944407That's the least of his worries.
>>2944406I don't really care, so long as avr-gcc knows what to do with it, and it works reliably.>>2944407Yeah I figured that. Maybe there's a way to decide which way is which, or use an #ifdef or whatever to define the upper and lower halves, but hey I'm happy if it's working for me now.That said, now I'm getting a probably unrelated multiplication bug. I write:>uint16_t val1 = 512;>uint16_t val2 = 514;>uint32_t result = val1 * val2;>display.println(result);And it gives 1024, instead of 263168. It's getting a 16-bit result, despite me telling it that the variable "result" is defined to be 32-bit. I can fix it by defining val1 or val2 to be a uint32_t instead, but why should that be necessary? Are these tarduino compiler optimisations messing with me?
>>2944465>I don't care if my code is broken as shit as soon as I use a different compiler or maybe even just different compilation settingsMicropython and Rust were made for people like you.
Apparently they’re still making new AVRs. Like the AVR32EB32, which specialises in motor driving. It runs up to 20MHz, but has an internal PLL that goes up to 80MHz for its 24-bit timer.
>>2944928That’s not unusual. MSP 430 has like hundreds of variants.They’re a little late to the motor control party, that ship sailed.I’m still surprised we only have 80 MHz on very simple, single cores.While I always suspected the frequencies in high-end CPUs are inflated like the fake process “nm” rating, I’d at least expect GHz level μC cores by now, and all at 1 instruction/clock.
>>2944959The MCU itself still runs at 20M max, it’s only the one timer clocking at 80. Speed has to do with process size I guess, bigger transistors have more capacitance. I assumed smaller processes are significantly more expensive, but it looks like hundreds of MHz are pretty damn cheap looking at the ESPs and such. MCUs probably prefer larger processes, I’d think they’re more immune to electrical abuse.
>>2944465>uint32_t result = val1 * val2;The destination may be 32 bits, but it has no effect on the right side. When you multiply two 16-bit numbers you get a 16 bit result. At least one of the two on the right needs to be casted to 32 bits.
>>2945244Seems less efficient, but I guess it saves the result of the multiplication in the same register where one of the factors was stored so it makes sense. But it would still be nice if I could force 32 bit multiplication.
>>2945246it's not registers, it's the way the C language works, and I told you how to force 32 bits
>>2945247>it's the way the C language worksSounds like a chicken and the egg argument. I assume C works that way in the first place because C was designed to run on CPUs that work that way.
>>2945254>I assume C works that way in the first place becausebecause you're an arduweenie who won't crack open even the most standard of reference books, and depend on forum replies for your clues
>>2945254Dumb faggot. You know nothing. Go program in javascript with chatgpt assistance, moron.
Oh this is neat. I wonder if avr-gcc does this too?
>>2941253Thanks anon. Yeah, that's what I'm looking at for noodling, but I kind of dig shenzhen clone junk when it works. I'd just buy a j-link for paid work, because the first unsupported hitch would pay for the real thing anyway.
>>2945267this is just integer promotion isn't it. compilers are allowed to optimize machine instructions during integer promotions for size but not signedness and i think most probably would.
>>2945267That's not neat. It's commonplace.Tons of hardware multiplies generate an output that is double the size of their input words otherwise they'd be wasting the bulk of the input bits all the way back to the 6809 and before that in microcode.Get into using in-line assembly and this won't be surprising.
>>2945442Integer promotion is the thing where variables of types smaller than int are implicitly converted to int before arithmetic is done on them. I suppose they cast src1 to int16 first to make sure the compiler gets that the input is 16 bit, and then to int32 to make sure to get the full 32 bit result, all while it's possible that int on this architecture is only 2 bytes (so integer promotion wouldn't make it int32 automatically).
buy pi pico w pair it with a 6v solar panel, program it to cycle wireless ssid names of choice, encase the hole thing in epoxy, so no one can re-purpose it without destroying it, throw them all around town 20$/each
has anyone here had success running a microdisplay with something cheap like a raspi pico 2w? im looking at creating a wearable display that shows a TUI and interfaces with a keyboard with another pico inside it over bluetooth. none of the microdisplay sellers ive seen so far have much or any information about their driverboards available so ive emailed one, but i dont have any hopes the docs are in english, if there are any at all.
>>2945524id say get a display with a chip that has a lady ada library but last time i messed with her fucking libs tit became a dependency mess that i had to spend hours fixing whatever kike is managing her github is using the code errors to shill all her other overpriced crap
>>2929798>>2936278> Be me> JR embedded dev.> Told to write drivers for motor controller> Took some work but felt great because I was getting everything done without help> Not getting expected output> Double check everything like 5 times> I was measuring at a test point where I was expecting the signal> Other senior engis don't know what to tell me> After a day and a half someone casually says, hey why dint you try measuring the actual output pin from the connector instead of the test point> It was working perfectly, hadn't thought about it because it was a PITA to get to that pinThere was also a sr (then Jr) that was known for having a senior help him debug a board that wasn't being detected when debugging, the first question was if the board was connected and the Jr insisted that it was, after 4 hours they found out that the board was in fact, not connected.Sometimes it's just what it is.
What are your thoughts? I want to learn how to build yocto images and have various boards talk to each other using Raspi 4 + ESP32 CAM + STM32.I was thinking of using a tiny ML to analyze images from plants for pests, watering, etc. Esp for images + network, STM as controller for actuators, fans, etc. and Raspi for orchestration + edge ML.
>>2945787That's the beauty of debugging. One time I was working on some low level shit, was stuck and tried to get it to work. I spent days on it. I discussed with my boss about the technical details. He had deep technical understanding of the topic, probably knew almost everything about the hardware at hand. But he couldn't help me either (short of taking over my work and suffering the same process, although he'd probably be faster). So essentially, on my question what the fuck was wrong with it, he told me to find out what was wrong.You're on your own. There are no magic tricks. Use logic, at one point the universe can't trick you with the "it should work, but it just doesn't" thing. It looks like the CPU should output a signal on this GPIO, but it doesn't work? Measure whether there's actually a signal on the GPIO. The motor still doesn't work? Check the entire damn electrical path.I want to see the day zoomeroids jump out of the window because chatpgt doesn't know the answer to their problem. Too bad I'll probably kick the bucket a little too soon.
>>2928655>that crystal+loading cap layoutAbsolutely horrific. I will have nightmares
Why is anything embedded and close to the hardware dominated by windows babies? Other areas of software dev don't have it this bad.
>>2946141Mb because Windows still has 73-4% market share, so companies develop support for their software for Windows first? Mb it's because Linux has a lot of distros and maintaining support for all of them is development hell and just waste of resources? Mb because Windows already have a lot of industry-grade software many engineers are experts in, while there are no alternatives for Linux and MacOS? For web dev you can use whatever, as software requirements aren't that strict, usually just text editor is enough. As soon as your requirements move to serious stuff...Overall idk you decide why, but Linux and MacOS still aren't up to Windows gold standards, so...
>>2946181>As soon as your requirements move to serious stuff...Doing anything close to hardware is a fucking pain with Windows and much easier on Linux.Using Windows is a fucking waste of time. I can see how inefficient windows devs are from how they work. They jump through hoops to do the simplest shit, which is trivial on Linux, and make it more complicated for everyone.I don't know how web dev is supposed to be different. For a web dev, the main environment is a web browser and perhaps a web server. For the embedded dev it's a cross compiler and a bunch of UARTs.
never seen a HAL deserving the name and windows will collapse under its weight of pajeetcode, nothing golden about it
>>2946141I don’t know, but it doesn’t matter much. Vendor IDEs are always trash and there’s GCC or similar open compilers for basically every architecture out there. Less so for GDB. The other problem is getting drivers for the programming hardware. No clue about FPGAs, but I suspect those guys are Linux nerds. Just don’t pick the wrong family of MCUs I guess.
>>2945868I really loved this from my old job. Although I had a not so great experience from 2 overworked Seniors helping me out once. > Debugging issue that appears only after board goes to low power mode> Can't replicate it on my debug board so I need to try it on a giant HW simulator, this thing is like 1 cubic meter> Spend 3 days with the dev I'm helping setting up the environment and replicating the bug and another 3 days trying to find the bug> Asked the first senior for help finding the documentation for a specific module> He yells at me for not reading documentation, when he asks me if I even know where it is, I answer no> "Has the team really become this dogshit since I left"keep in mind that this team worked on integrating 20+ projects, if I would've asked any other dev, he would just tell me where to find shit .> Spent almost a year on the same team as him and it seems pretty similar to me> He kept being a PITA and then pointed me to the documentation, afterwards it took me like 15 mins to find the bug> Ask another senior for help figuring out how the bug is produced, because by the looks of it it wasn't our jurisdiction> So if I fix it I can't push it since it will piss people off for some reason> explicitly told by my boss not to do this, just find a person from the responsible team, tell them what/why to fix it> Gets upset at me because it is not how he would have found the bug> Finds the bug I just told him about> "See it's not so hard, just fix it"> Fixed and pushed> I get another rant about wasting his timeNever asked those guys for help again, 1st one thought he was some kind of rockstar but the dude didn't have a life outside of work and whenever we would do team building activities he was a major asshole (pissed on a coworkers car once). The other guy wasn't too bad but, if you didn't do things his way it was wrong. Stuck with the other 2 seniors that were chill AF and would help me solve instead of trying to do it for me.
>>2946337Glad I didn't sign that automotive industry job offer, probably would have gotten fired by now anyway because the industry is going down the shitter.
>>2946186>For the embedded dev it's a cross compiler and a bunch of UARTs.Nigga u makin it sound like there's some difference between writing and compiling C code that's basically just toggling some register bits on and off using Windows vs using Linux. It's only really for propietary shit like PLCs and obscure microcontrollers that you really have no alternative to using Windows-based IDEs/build tools.Also, the main reason why people use Linux for embedded systems programming is so companies don't have to pay for Windows licenses.
>>2946623Yup. I really enjoyed my time there but there we're things I hated.I basically only did 1 year of good solid embedded work and I was there for 2.5 years before getting fired, got a crap load of cash though.I spent quite a bit of time dealing with autoshit, python scripting and a good ol' 3 months setting up a SDK we were never going to use before spending another 3 months in limbo watching everyone around me loose their job.
making this tomorrow
Got a RP2040-Zero from Aliexpress. I have to unplug and plug it back in in BOOTSEL mode every time I want to upload from Arduino IDE - once the first upload is done, I get an error if I try to upload again unless I reset it as described.Anyone experienced this before?
>>2948144>buying chink shit>using arduino IDEYou deserve it. Let me laugh at you.
>>2948147>2012+13>being elitistGlad I'm not you, faggot.
>>2948159>not being stupid is elitism nowOf course it is...
I just found out that on the Pi Pico in micropython, "interrupts" are not really interrupts but it just schedules a python function to run a bit later.Can micropython be used for anything serious at all or will people just laugh at me for not knowing C?
>>2946141>Why is anything embedded and close to the hardware dominated by windows babies?It used to be worst. Ignoring the hobbyst tools, at least STM nad PIC stuff is also on Mac and Linux and you can configure VSCode/Zed/Vim/etc to work well with ARM toolchain. It sucks that uVision is only on Windows though.>Other areas of software dev don't have it this bad.There're 3 reasons.First is obviously the massive market share. Second, which is a consequence of the first, is that most other engineering software is also only on Windows.Third, is that most enigneers, who are the ones that tend to use embedded tools the most, aren't really that great with computers. At least the ones I met. Mechanical engineers really only know how to use SolidWorks/AutoCad and Office (and barelly). Electrical engineers are slightly better as they usually can do some coding outside of embedded too, but nothing fancy.t. System engineer, but I do everything.
>>2948293C itself isn't that hard.If you can do python, you can do C by learning on the go.The harderst part is not really the C language but the library and know how required to use the SoC. MicroPython abstracts and streamlines the shit out of everything. There're libraries on C that do that (mbed is one in my experience, but that project is dead). Regardless, I wouldn't recommend because as you experienced with the interrupt, you really don't have control of the hardware. For embedded application that you need to know how every register is behaving, it's simply unacceptable.
>>2948293IIRC there hardware interrupts are supported on some chips, found mention of it here https://docs.micropython.org/en/latest/library/machine.Pin.html#machine.Pin.irqDepends on the context but micropython can absolutely be used for serious projects, but you have to understand its strengths and weaknesses to best use it. Of course it will never replace C for the cheapest of the cheap micros in mass volume items, but it's surprisingly decent in other circumstances.Of course, you should learn C regardless.>>2948303>you really don't have control of the hardwareCommon misconception. Micropython gives you full access read/write to the entire address space, lets you inline assembly, compile functions for speed (either before or at runtime, your choice), and even load compiled C modules or embed C extensions into uPy itself. Whenever it doesn't have/you don't want to use abstractions, you always have full freedom to drop to a lower level on the fly.I also thought it would be a joke because of reduced freedom and speed concerns, but having actually used it now that's simply not the case. It's not a perfect fit for everything, but I think it does still have a place in embedded development.
>>2948309While I think there is very little point to using micropython (it only bares a slight resemblance to python)…Similar things have existed for years, on μCs, like Forth which is interpreted. Also Altair Basic was like 3.7 KB so that was popular even on μCs in the early 80s.I mean, the interrupts are actually handled by the runtime assembly code, and the drop off data for the runtime to pick up usually (ring buffer).
>>2948293Learn C anon, it's really not that bad. Pick up the K&R book and have fun, won't be more than a weeks' study.>>2948303>You can do C by learning on the goThe hard part for most is writing good C>Self documenting code?>Best I can do is pass unsigned ints in arbitrary order to my function>I explain in detail what the args "flag1" "flag2", and "flagb" do in the docstring, you see>Oh woops, forgot to add a docstring actually>Error handling?>I'm just opening a file, what the fuck are you talking about?>Null checks?>But this pointer is always instantiated wherever I use it. When could it possibly be null?
>>2948405> Self documenting codeEverything is relative.My code is self documenting to experts in C89 and 8051 machine code, support chips (A/D converters and RS485) and to engineers in the fields to which our products are applied.It’s not going to be self documenting to some intern foreign exchange student that surveyed python indentation methods for their phd thesis at an online university i never heard of because hr didn’t look into it.
>>2948405>Learn C anon, it's really not that badIt is scary for Python babbies who have never had to manage memory and have everything abstracted away for them
>>2948438No disagreement there. "Self documenting" is a general heuristic and can look wildly different depending on end user.More broadly I'm talking about variables named "q", "a0", "var1", "myString" etc, using primitive types for switch expressions instead of spending 30 seconds writing an enum, etc.Feels silly to complain about it but people really write this stuff after 4 years of college. Debugging even a 20 line method that someone checked in becomes a fun little puzzle.
I fiddled around with a Arduino Nano at work during downtime (I'm an automation techie in the maintenance department of a factory) and my boss saw it. He's now asked me to make a system for his pellet boiler silo so it'll tell him when it's low.Guess this is how it starts.
>has one job>fails
>>2948538If you try to power one of those from a USB brick and want to get 5V from it, it's not gonna work because it wants to run it through the regulator.I have so many 5V bricks and would rather use them than trying to dig up a 9V adapter all the time. I usually just cut up a "bad" USB cable and solder the power wires to a couple of header pins.
>>2948600I’m pretty sure 5 v usb adapters are already regulated (more or less). When i test the voltage coming out of them, it’s like 5.0 or 5.1 V.On the other hand, testing old wall wart adapters are always over voltage by a few volts at least.
>>2948613The problem is that those breadboard things are wired to always run the power through a regulator and you can't change them. Trying to put 5V into a 5V regulator does not give you 5V at the output.And I have many many more 5V power supplies than I do 9V, so I'd rather not have to dig up a 9V.
>>2948614Perhaps you can replace the regulator with a LDO version.This, of course, will probably cost more tgan the whole unit, lol
>>2948618The entire point of getting one of those chinkshit things is not having to fuck with it.If I first have to reverse-engineer it to figure out how to fuck with it, that's even worse.
Well I am nearly done with this thing, I have been using a vacuum pump I found to reseal 3d filament spools bags and on occasion used it as a smt vacuum pickup tool. Anyways I wanted to add some stuff like a solenoid, and wanted to turn it on remotely which I can with esp32 and checks voltage of led that illuminate on which pressure threshold triggers the motor if it falls below that pressure.I couldn't come of with a housing model in CAD, so I just printed a honeycomb storage wall panel to throw together and mount it on my hsw for now, may move it to the back so I can still turn it on through esp32 webui.
Let me guess, you need more?
>>2949115Yes, a better antenna.
>>2949122That actually works?
>>2949131I haven't tried it but apparently so.https://peterneufeld.wordpress.com/2025/03/04/esp32-c3-supermini-antenna-modification/The cheap boards don't actually have enough clearance for the chip antenna to work well.
>>2949139neat
>>2948519>I'm talking about variables named "q", "a0", "var1", "myString" etc, using primitive types for switch expressions instead of spending 30 seconds writing an enum, etc.Oh shit nigga. I got a temperature and humidity gauge project I'm working on right now, and I've noticed a lot of my variables perform basically the same function except for another "item". For example: I got one variable called temperatureReading and another called humidityReading.Do you think I should just use OOP or structs/enums to make things easier?
>>2949543What’s the processor? If it’s a PC class type deal you could probably get it to work with java.If it’s an 8051 you use every preprocessor and every pre-computation trick you can and avoid any vtable lookups and runtime shenanigans.OOP doesn’t have to have any overhead though, and doesn’t need a specific language. You can do oop in assembly.I use ‘q’ for the destination pointer tracking the source pointer always named ‘p’R0 is RAX after we dropped that silly self limiting naming convention, although we *might* need to call it Z0 … Z127 under the amd128 architecture.The other option is just to call it R0 and just know it’s 128 bits, like imagine if LDAA was a 64 bit register load in some enhanced 68HC11 clone.
Apparently Qualcomm is buying Arduino.R.I.P.
>>2936567Fully updated gentoo has a six hour boot up on an m68k laptop and that’s when the kernel is being configured by a Grey Beard in communion with Elder Gods.Give up on the past it isn’t there to help you anymore.
>>2948519Your code is not professional unless you name your variables myStringFactoryAdapterSingletonBean.
>>2949565>What’s the processor?It's an Atmega328p (Arduinoshit, I know). Last time I checked, I was roughly 85% done and taking up nearly 60% of the program space. I tried commenting out the Serial.print functions and trimmed down the program space from roughly 17kb to roughly 12kb, a slight improvement, although not much. I'm guessing I could probably slim it down even further by using a register-level TWI (I2C) function instead of the Arduino Wire library, but I haven't quite figured out how to do that yet.Also, a lot of the variables I got are just pairs named X and previousX (for example downButtonPressTimes and previousDownButtonPressTimes) that I'm using to jankily keep track of the number of times that a certain variable was updated (usually, the number of times a button was pressed), under the assumption that the previousX variable will keep the number of times something happened or was done, and that the X variable may be set to 0 when not pressed. Do you reckon there ought to be a better way of handling this?
>>2949583> Give upBefore giving up, I go with bsd 2.11 or bsd 4.3 quasijarus. These are common revs to port to beefier embedded controllers.
>>2949593Where to begin…There’s never any need to use serial.print, 99% of everything is written on the emu, prod/retail diagnostics are through gpio to a 7 segment led display or morse code on a single led.Some libraries are dogshit in that they make a *runtime* determination about your processor and have multiple code paths for different cfgs. That’s dead code to you. I find this intolerable.Making variable names longer doesn’t imply they’re better. Come up with standard abbreviations for things and remove names that don’t add disambiguation or are obvious, or unnecessarily lock you in to a changing datatype. Here’s some standard abbreviations to get you started:https://www.ibm.com/docs/en/i/7.6.0?topic=keywords-cl-command-abbreviations
>>2949661 >emu*Emu War flashbacks intensify*>Some libraries are dogshit in that they make a *runtime* determination about your processor and have multiple code paths for different cfgs. That’s dead code to you.Duly noted. I'll see if it's possible to replace some of those Arduino library functions with lower-level functions.From the link you posted:>DSP means display instead of digital signal processing/processor>EXT means extract instead of external>PIN means personal identification number instead of pin (as in, input or output pin)I don't think it would hurt much to add in a letter or two to the abbreviations to help with disambiguation (say: DISP for display and DSPR for digital signal processor).
>>2949578gentlemen, at your discretion >>>/g/106831672>>2949661>https://www.ibm.com/docs/en/i/7.6.0?topic=keywords-cl-command-abbreviationsIBM is IBM, take it with a grain of salt.>>2949666Nice trips, Stan.
I'm beginning to regret designing something that requires addressing 24 DACs over SPI because 24 chip select pins is a lotMy best idea so far is to propagate a single bit through some shift registers connected to the CS pins, so that I address and update each DAC in turn. What would be the proper way to address this many devices, though? Just use I2C instead?
>>2949666> >DSP means display instead of digital signal processing/processorThe point was they were consistent. There’s probably some useful ones in there, but I didn’t know of a comprehensive list for embedded.
>>2949741get a bunch of picrel.a bunch because they come in handy:I have some from when I made my trans-am look like KITT 2000 and, of course, the original cylons.
>>2949741https://www.electroniclinic.com/multiplexer-or-data-selector-with-circuit-diagram-and-operation/
>>2949661Arduino seems particularly bad. Who the fuck uses C++ on a 8 bit microcontroller.
>>2949741>through some shift registersWhy not? also maybe daisy chain the chips, which has the same effect.
>>2949798It's not the "8-bit" that's the problem, it's that most 8-bit architectures are a horrible match for C.Z80 and 6502 are pretty bad8051 and 68HC11 are okay6809 is perfectAVR is good except for PROGMEM which is a bit annoying
just buy a STM32 with a few MB of flash and RAM then fill it with spagh00ti from cubeIDESilicon is cheap
>>2949784>>2949792>>2949799The thing that concerns me about using 3-to-8 or 4-to-16 decoders is it will still use up a lot of pins on my microcontroller (Pi pico in this case) for addressingI thought about the shift register approach some more, and I think it could be viable, especially given that my application has the property that sometimes I'll want to send the same data to multiple DACs and they will always be offset from each other by the same "stride". The disadvantage here is that I need to manage both the serial communication and then separate data/clock lines for the shift registers. But I don't think there's a way to also drive the shift registers off the serial connection without sending unwanted data into the DACs when I want to change the address.
>>2949831You could chain a few of 4017s together and pulse it a bunch of times, but I'd worry about getting an off-by-one error creeping in there. Then you have to put in diagnostics and shit.If you use 3 pins of gpio, you could just do a "triple load" into some flip-flop shift-1 latches to get 9 bits total (only shifting one bit out into the next latch).It's pretty much what you have in your diagram except using binary so you'd need the decoder at the output of the latches.How many GPIO do you have?Aren't DACs expensive? You might want to consider using one DAC and switching the output or something.I assume you can't do that for some reason.Oh, most important thing is: don't forget to put LEDs on all the lines it so it looks cool when chicks come over and you turn out the lights!
>>2949578Nothing of value was lost. The worst they could do is enshittify the IDE and related platformio files. That or flood the market with really cheap really easy to use dev-boards that can only be used with proprietary software and/or python.>>2949741Single DAC with sample+hold circuits instead, if you don’t need the output bandwidth.
>>2949941>If you use 3 pins of gpio, you could just do a "triple load" into some flip-flop shift-1 latches to get 9 bits total (only shifting one bit out into the next latch).I'm afraid I don't quite understand what you're suggesting... but regardless, I think a solution that requires fewer GPIO pins is preferable, if nothing else because it avoids more wiring. The Pico has 28 GPIO pins and I already have plans for at least 16 of them.>Aren't DACs expensive? You might want to consider using one DAC and switching the output or something>>2949985Single DAC with sample+hold circuits instead, if you don’t need the output bandwidth.I like the sample and hold idea but I found 12-bit DACs that are about 4 USD each (MCP4822) and S&H will introduce more components and complexity. The 8-bit version will be cheaper, and still appropriate for some uses here.The plan is for a digitally controlled analog synthesizer, where the DACs control 6 parameters of each note that is being played. Ideally they all get updated at least a couple hundred times per second.I alternate between days of optimistically thinking it's a good idea and despairing that it won't work. Here's a diagram I drew while far too caffeinated but I think it communicates the general plan? Thanks for coming to my TED talk
>>2949941>Oh, most important thing is: don't forget to put LEDs on all the lines it so it looks cool when chicks come over and you turn out the lights!and yes impressing the ladies is a vital design consideration
What's a good super cheap chip for doing something like turning a joystick pot into a midi pitch bend and mod controller? I've got a teensy but it seems like massive over kill for the task.
>>2950014How small and how much money?A $3 esp32 super mini will probably do that or perhaps a stm32 Stm is definitely overkill but can be cheap though you will need a programmer for it The esp has usbc and goes into vscode or whatever you like I like stm because assembly and cmsis looks nicer to me Not too sure about the esp, I know it can run arduino and espidf's own c library(?) But pretty versatile + has a few diff wireless methods built in to the devboard
>>2950019Oh and iiirc the esp is <= 240MHz So in theory, easily fast enough
>>2950001Why use 24 separate single channel DACs and not a few 8 channel DACs like the AD5668. I believe sequential use AD5668 and multiplex it. Also I think you'll want to avoid 8 bit DACs for pitch CV, but I'm no expert. I'm building something similar (but less analog) but am still breadboarding the voice (then I'll look into a data bus/multiplexing probably).
>>2950075I had become locked in to the idea that all components need to be through-hole (so I can build on stripboard), and I could only find affordable dual channel through-hole DAC ICs. But recently I've broken that rule anyway for a surface-mount voltage controlled filter chip, so maybe I can just go back and look at surface mount DACs too, good point. Those are indeed more expensive though...You're right about 8-bit being too coarse for pitch CV, but my oscillator pitch will actually be digitally controlled and the DACs are to control things like mixing proportions, loudness of the VCA, etc, all of which require less resolution. Having said that, I think I will need a 12-bit DAC for filter cutoff frequency, because steps in that will probably be quite audible.
>>2950081Consider ordering some (assembled) PCBs for the SMD DACs. It’s not economical for one-off boards, but it would be cost effective to make multiples of 5 boards, with pin headers to solder up on stripboard. Put some supporting passives on the board while you’re at it, and arrange the pinout to be most convenient.
>>2949999Huh, didn’t know they made nano clones with OLEDs on them. Nice get, and nice Frieren. Just rewatched it all on the BDs, the localisation makes it worse.
>>2950100>Consider ordering some (assembled) PCBs for the SMD DACsman this started off as an idea to connect a Pi Pico to some TL072's and make bleep bloop noises, but it's rapidly getting out of handI suppose a possible compromise (what I did for the filter ICs) is to just acquire pre-made surface mount to through hole adapter boards. The next issue I'll be contending with is 10 MHz SPI signals probably not being happy about being sent over bits of wire and stripboard......
>>2950106I wish you luck. What filter chips are you using out of curiosity?
>>2950107CoolAudio V3320, which is apparently a clone of the older and more famous CEM3320. It's super convenient. The V3320 4-pole low pass filter circuit is on the left here, and it does the same job as the VCF made from op amps and OTAs on the right, plus it has a built-in exponential converter for control of cutoff frequency. It almost feels like cheating to use it lel
>>2950108Nice, I think the original CEM versions were used in some of the old Oberheims. I was looking at the SSI2144s, but they only come as SMD as well and I'm shit at soldering those to adapter boards, but I guess I have to get better at it eventually
>>2950019>How small and how much money?As cheap as possible while being sufficient for the job. Doesn't need to be big or have any wireless stuff, since I'm thinking of only using it with the single joystick... It is always tempting to add a bunch of extra pots and faders and shit but I don't really need them and would rather just get the job done than mess around designing things lol. Also intending to do MIDI over USB and not bother with the 5 pin MID connector since I want to use this with VSTs, so USB and Arduino libs would definitely be nice to have.
>>2950415Esp32 has a lot of probably excessive extra stuff but only costs a few bucks on ebay/ali/bang or any china "certified" retailer lmao Can use arduino or freertos/c libraries for it Plenty of support for that and no additional programmer required since upload works over the built in usb
>>2950415If you're adventurous, the CH32V003 may be worth a look. Less than 20 cents per chip, more powerful than the ATmega328p (arduino uno), arduino compatible, and pretty sure there's a USB library.That said, for a one-off there's no reason not to use a ESP32 or RP2040 (my preference since it has more powerful IO). Either one is available on boards for 2 to 4 dollars, integrated USB, and leaves open plenty of headroom to expand your project.
>>2950506Huh, hadn't seen these For 78c I foresee an order in my future
>>2950506>>2950512The V003 lacks native USB, and I wouldn’t recommend trying to bit-bang USB but CNLohr does have a software USB implementation for it if you must. Instead the V203 does have native USB (and specs more like an RP2040 than an AVR), but is more expensive than the V003 at 3 times the price per chip. It also doesn’t come on any compact prototype-ready dev-board, just a bulkier dev-kit for bench-testing, though I think that applies to all of these CH32V chips from what I’ve seen.
>>2950103>didn’t know they made nano clones with OLEDs on themhttps://www.aliexpress.com/item/1005006990745594.html
>>2950506When will there be a cheap chip with USB 2.0 at least?
Damn, my isolated USB hub behind my workbench that’s connected to my desktop by a long cable stopped working. I was wondering why my USBasp wasn’t getting detected. Maybe I should get a USB isolator and a normal USB hub instead.I guess I’ll try and fix it.
I accidentally connected 24v to my custom arduino board and Im pretty sure the pullup resistors are fried. Would other ports work because everything connected to C isnt working properly.
>>2951626Impossible to say. I wouldn’t be surprised if 24V fried the entire thing. Give it a try, but I wouldn’t expect reliability from a half-dead microcontroller.
I am the anon who wanted to address 24 DAC chips with shift registers, I have come to my senses and of course the better solution is fewer, 8-channel DACs.Am I going to have a bad time if I try to send SPI signals over wires from a Pi Pico to a number of "daughter" boards, each with their own serial-addressable DAC? I've read that SPI isn't designed to be sent over wires and will be subject to interference, etc, but at the same time, these would be very short wires connecting boards that are all very close together. And I could use a clock frequency as low as 1 MHz.The alternative is I put all the DACs on some kind of custom PCB so the serial connection is robust, and then send the DAC voltage outputs over wires. But I'd rather not have to order a one-off PCB for the DAC board.
Found some old arduinos in a drawer from a middle school science fair project. I don't know exactly what happened to them but the ft232rls on both seem to be fried. worth attempting hot air rework and replacing them or just toss? I think the duemilanove at least can be upgraded with an atmega328, the decimila idk. I guess it could also be something else fried (pullup/down). I plugged another ft232 into the tx/Rx pins and they are frantically transmitting garbage.I know modern arduinos have moved on but it would be cool to fix these since I broke them 17 years ago (holy shit I'm old)
>>2941476>the pinout doesn’t seem to describe what those central pads are for.unused central pads are often used for thermal sinking
>>2952095It's not great to send what is basically a high speed TTL signal off-board, but you should be able to make it suck less by using a twisted pair with ground. Maybe you can get some from an old Ethernet cable.You should probably also try to run the data and clock as a daisy chain instead of three home runs.You might also be able to use a ribbon cable where every other pin is ground, then you could use headers to make it real tidy. If you're getting PCBs made, you could have the CS be re-routed down by one position on every board. A pair of 2x5 headers on each board would do it.Also 2 means that you can get 5 of one board made instead of having to get 5 each of two boards.
>>2952155On further reflection, I wonder if I can do option 2, but with a stripboard "distribution board" instead of wires. Just have a bunch of female pin socket headers in a row, providing the serial connections, and plug the daughter cards in to that. I understand that I should run each high-frequency line alongside its own return ground.It would be nicer with a custom PCB but I don't want to have to order the minimum quantity of 10, for something I only need 1 of.
>>2952261if you're going to get boards made you might as well take the time to put a proper signal distribution on them, do #2 and route them like this:pico == B1 == B2 == B3where == is a 10-wire ribbon cable with 2x5 connectors, five grounds, clock, data, 3 selects, and each board reroutes the other two selects down by one position. It's also easier when you need to scope the thing, just clip to the last board output connector to watch the clock/data.you might want to use a piece of perf board between the pi and the first connector (strip board is annoying with 2x headers because you have to make a tiny cut between pins instead of just using a drill bit on a hole)Don't underestimate being able to pull out and swap around the boards easily.
>>2952106It would be good for practice or shits and giggles, but Unos are $3 shipped from China so a complete waste of time otherwise
I have this M33 device (EFR32MG21) that would not show up when I try to connect over SWD (with a blackmagicprobe) UNLESS I hold the reset pin. Is this normal? Does this mean the chip has debug locked?Never touched this platform before.
>>2952273yeah I think these things are fukt
>>2952261maybe this is more complicated, but there's also the "backplane" approach where your MCU and DACs are on the backplane and your 3 boards are slotted into the backplane sideways, reducing distance between all
>>2952095I got a better idea.Just use two-tier DACs. Here's your new plan:Connect your Pico to one "inner" DAC, and using the *output* of that that DAC through a series of comparators to "strobe in" the appropriate "outer" DAC. Instead of binary, or trinary, it's like 256-ary on a single pin.Genius is a pretty strong word, but I think I can handle it.
>>2952647>>2952647>>2952647NEW THREAD