[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 39 KB, 470x372, ic-clone-1.jpg [View same] [iqdb] [saucenao] [google]
2707804 No.2707804 [Reply] [Original]

Previous thread:>>2690224

Here 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 parts
digikey.com
mouser.com
arrow.com
newark.com

>but that's too expensive
aliexpress.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

>> No.2708337

If I connect a PWM pin to L298N board that's connected to a 5V DC gear motor through a buck converter (XL4015), what's the highest PWM frequency? I'm using a W801 for now but I have other options (ESP32C3 or S2). This configuration should give the motor more current. But maybe I should get a higher voltage motor instead?

>> No.2708377

>>2708337
I can’t see the datasheet suggesting any kind of voltage dependence on its maximum PWM frequency, though I may be wrong. Remember that the saturation voltage of the L298N is nontrivial, you may want to turn up the buck’s voltage a bit to compensate. You could also try to adjust the buck converter’s output voltage using the MCU instead of PWMing the motor.

>> No.2708404

>>2708377
Thanks! At first I thought I might have to remove the trim potentiometers but it's not necessary as shown by https://www.instructables.com/DIgital-Controlled-Bench-Power-Supply/

>> No.2708522
File: 80 KB, 770x663, wireless.jpg [View same] [iqdb] [saucenao] [google]
2708522

Can someone explain to a retard why calling functions from inside another function makes the code run significantly slower?

>> No.2708543

>>2708522

It doesn't in any particular way. If you have access to an oscilloscope it's fun and informative to use spare GPIO pins to show how often a function is called and how long it takes relative to everything else.

>> No.2708727

>>2708522
Every time you call a function there's a tiny bit of overhead, but that's not specific to functions within functions. Probably the only time you'd notice is if you're calling a tiny function in a really hot loop, in which case it either shouldn't be a function at all or should be inlined.

>> No.2708770

Powering an arduino nano project. I've set up a power supply that's putting out 5.2V and rated ~300mA, sending power to the 5V pin as well as the other stuff connected to it. It's a salvaged Nintendo GBA wall wart. Should be more than enough current for everything.
Had zero issues running it from battery, but when I switched to the AC supply, the OLED screen fuzzed out, and it started randomly firing the relays attached to it. Trying to run from USB, it was dead. Reprogrammed it and now it's fine.
Ideas on what's going on?

>> No.2708875

>>2708522
Are you doing recursive calls or calls to many dynamically linked libraries? Running with very very little free RAM? If not, there's no reason that the call should be causing latency issues. The only overhead associated with a function call is pushing the function parameters to the stack, and moving the instruction pointer to the location of the function in the binary's text. It's only a couple of instructions

>> No.2708931

>>2708875
>It's only a couple of instructions

a jump to subroutine will typically have to save all (or most) the registers.
a return from subroutine will have to do opposite.
in general, that makes these instructions use more cycles than any others.

>> No.2708950

>>2708770
seems like some sort of inrush current causing the power supply to dip causing a brownout which will screw up your cpu until you reset it after the power supply stabilizes

>> No.2708952
File: 39 KB, 656x552, 1689008598323512.jpg [View same] [iqdb] [saucenao] [google]
2708952

You're not supposed to make everything into a function and just have loop() look like
{
if(function1 == TRUE){
serial.println("cum");
}
Where function 1 contains calls to other functions that contain calls to even more functions so you have thousands of lines of code in functions and only a couple in loop?

>> No.2708990

I got a chink bluepill. Couldn't find any information on it online at all. The markings I see say "STM32F103C8T6" and "DevEBox", seemingly no other information. Just messing around, not sure what I'm doing. I'm trying to connect to it by gdb using openocd, but no matter how I mess with the config I can't seem to get anything but "Error: open failed". Also the board isn't visible at all as a usb device. There are 2 leds on when plugged in, one led labeled d2 is blinking while the other (d1) stays on.
Any ideas?

>> No.2709010

>>2708952
Yes. that's roughly how I did it. But the functions are for loops, so I have no choice but to call other functions from within the for loop.
>>2708875
>>2708543
>>2708727
Nah, I was just retarded and forgot I had done something stupid in one of the functions I called.

>> No.2709025
File: 1.18 MB, 1200x1600, IMG_20231110_144321.jpg [View same] [iqdb] [saucenao] [google]
2709025

Can someone identify this IC? I suspect is some sort of power regulator.

>> No.2709028
File: 108 KB, 726x363, Screenshot_2023-11-10_08-49-57.png [View same] [iqdb] [saucenao] [google]
2709028

>>2709025
>Can someone identify this IC?

Protip: find a child who can teach you how Google works.

https://www.analog.com/media/en/technical-documentation/data-sheets/max17543.pdf

>> No.2709030

>>2709028
It seems searching "17543A datasheet" brings no results, but remove the "A" and somehow all results appear. I blame google.
Thanks.

>> No.2709075

>>2709025
>power regulator
/ohm/ is thataway ---->

>> No.2709366
File: 110 KB, 1000x817, IMG_6774.jpg [View same] [iqdb] [saucenao] [google]
2709366

I need to deploy some smart door locks for a client (as part of a software solution for a store)
Initially i though of using a raspberry to handle this but i think it’s overkill and impossible to get.
Thought i could just get one of those esp32 relay pcbs.
From what I investigated i could either do MQTT or install a solution that connects to something like the tuya app.
Mostly looking for something that just works.
But on the other hand i know that depending on someone else’s service could be a bad idea.
Has anyone done something similar?
Mostly looking reliability, i can host mqtt brokers no problem

>> No.2709391

>>2709366
I know there’s one or two self-hosted home automation services out there, maybe dedicated security server firmwares too. But I don’t know how flexible those are in getting custom hardware to run on them.

>> No.2709476

>>2709366
> esp32
That’s good, if you forget how it works the chinese can open it for you. They probably backdoored every one and sell them at a loss.

>> No.2709536

>>2709366
Depends on how you actually want to control it. You can try ESPHome for MQTT and HomeAssistant, or Homespan for Homekit, or ArduinoHome, or Blynk.io or Tasmota or custom code it (ask GPT4 for help).
ESP32 boards are cheap and great. It's easy to flash different firmwares and try them out all in the same afternoon.

>> No.2709543

>>2709391
If you install an established firmware like the ones listed above, the protocols will comply with whatever control software expects. The only thing you really would worry about is Apple or Amazon suddenly changing their protocols just to fuck with everyone. In that case, you can lean on one with Web interface, but then again anyone on your wifi can unlock the doors.

>> No.2709913

>>2707804
suggestions on *cheap* programmers (preferably from amazon) or diy clones using an Arduino for "most" CPLD's and PIC32 devices? or at least anything that the tl866 doesn't support, and can adaptors to go with the tl866 for 48 pin soic's (the long memory chips) be bought from amazon, as normie parents dont trust anything else such as chineze sites

>> No.2710010

>>2709913
https://black-magic.org/
... might help with many microcontroller families. Note you can use a blue pill among many other devices as your programmer, needn't buy their thing. See supported hardware @ left sidebar top.
CPLDs, like FPGAs, are unfortunately more obscure.

>> No.2710313

W80X_SDK_v1.00.10 failed to flash, while a older version was okay. It turns out they changed the device reset action from "rts" to "at" in the tools/w800/rules.mk. W80X SDK is refreshing after wading through esp-rs's layers upon layers of indirection and 10s compile times.

>> No.2711182

I got a TI ek-tm4c123gxl to learn embedded systems on. am I missing out on anything by using vim + Makefiles + shell scripts? I don't want to use windows just for the Keil IDE.

>> No.2711197

>>2711182
proper debugging might prove annoying. you might have to run it all in the command line. besides that nothing i can think off

>> No.2711257
File: 1.17 MB, 1000x967, 5f08a37a2d4a60.46822757.png [View same] [iqdb] [saucenao] [google]
2711257

henlo, frens.
i posted this on /csg/ yesterday, but has just now realized the project may also interest /diy/:
>>>/g/97276664
>>>/g/97276678
after comments in the thread and further thoughts, i'm also
>replacing ATMega328P's with ESP32-C3's
>replacing it 74HC595's and SN74141's with HV5222's
t. picrel's what the pcb will end up looking like but with much larger tubes

>> No.2711315

>>2711257
lol im also in csg, what convinced you to go with the esp32?
I think your reasoning was right in that a clock doesn't need internet

>> No.2711394

>>2711315
well, atmel is old and needs to be bootloaded first before use.
https://kevinrye.net/index_files/bootloading_atmegas_with_my_bba.php
esp32's can be used w/o bootloading and has a lot more QoL stuff in case i want to add more fn's, all for relatively the same price (~$2ea).

>> No.2711423 [DELETED] 

Stupid RasPiPico question: I just got one, got Thonny set up, and am running the initial tutorial.

I can't get the fucking LED to turn on on ANY of the ones I have. I bought three. NONE of the LEDs work.

Initially I mounted the Pico as USB storage using the BOOTSEL button. There were two files, a .txt that said it was the Pico and a .html that redirected me to the RaspberryPi.org website when I dragged it onto a browser.

I copied that

I downloaded the micropython .tf2 file from the Pi.org website and copied it to the Pico. The Pico promptly rebooted.

Thonny appears to be connecting correctly. I can enter commands and run them and the print statement shows up. Thonny throws a shitfit if I just unplug the Pico with no warning or shutdown.

But the fucking LED doesn't turn on when I run the "from machine import Pin / led=Pin(25,Pin.OUT) / led.value(1)" three-line command.

What the fuck? Is there anything else I can set up to prove whether or not these things are actually functioning?

>> No.2711425
File: 103 KB, 450x600, 1439801651_65742.jpg [View same] [iqdb] [saucenao] [google]
2711425

Stupid RasPiPico question: I just got one, got Thonny set up, and am running the initial tutorial.

I can't get the fucking LED to turn on on ANY of the ones I have. I bought three. NONE of the LEDs work.

Initially I mounted the Pico as USB storage using the BOOTSEL button. There were two files, a .txt that said it was the Pico and a .html that redirected me to the RaspberryPi.org website when I dragged it onto a browser.

I copied that

I downloaded the micropython .tf2 file from the Pi.org website and copied it to the Pico. The Pico promptly rebooted.

Thonny appears to be connecting correctly. I can enter commands and run them and the print statement shows up. Thonny throws a shitfit if I just unplug the Pico with no warning or shutdown.

But the fucking LED doesn't turn on when I run the "from machine import Pin / led=Pin(25,Pin.OUT) / led.value(1)" three-line command.

What the fuck? Is there anything else I can set up to prove whether or not these things are actually functioning?

I just want to make glowing LED buttplugs, halp pls ;_;

>> No.2711437

>>2709366
>Initially i though of using a raspberry to handle this but i think it’s overkill and impossible to get.
Why do you say that? The older models are in stock all over now. You probably can't get a Pi5 or a Pi0-2 easily, but there are tons of Pi0 and Pi4.

>> No.2711473

>>2711425
are you using the official pico board or some other that uses the pico?
LED could be placed in another GPIO
also kindof related to this, where is the code you're running taken from? are you sure it works? could be an old API
disclaimer: i havent used micropython

>> No.2711627

>>2711473
>are you using the official pico board or some other that uses the pico?
It's a RasPiPico. I stated exactly that.

>also kindof related to this, where is the code you're running taken from? are you sure it works? could be an old API
I'm using the initial tutorial from RaspberryPi.org. The exact code that I copied-and-pasted directly from the website is here:

https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/4
https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/5

>LED could be placed in another GPIO
Has the RPF made any modifications and not updated their own tutorial?

>disclaimer: i havent used micropython
Got any other questions, then? Like asking whether I'm using curly braces like in C rather than begin/end like in Pascal?

>> No.2711779

>icarus verilog suddenly not producing output vcd file
>iverilog acting as if everything is fine
>same with vvp
>both returning success return code
>but no output file
>finally find that I accidentally added a BOM to one of the source files
I really fucking hate this piece of shit tool.

>> No.2711925

>>2711425
If it's the wireless version of the pico, you have to use "LED" instead of the number 25.
https://forums.raspberrypi.com/viewtopic.php?t=336836

>> No.2712015

Reminder to always check the schematics and the datasheets instead of relying on tutorials or forum posts written by retards who barely get it.

>> No.2712236

>>2712015
>always check the schematics and the datasheets

i'd rather be water-boarded. it's less painful.

>> No.2712239
File: 76 KB, 1080x431, IMG_20231116_121952.jpg [View same] [iqdb] [saucenao] [google]
2712239

MangoPI MQ Pro
Can i use an usb hub with both usb c ports?

>> No.2713776
File: 313 KB, 1315x685, Screenshot 2023-11-18 083912.png [View same] [iqdb] [saucenao] [google]
2713776

Trying to attach pic related display to an Orange Pi, to mirror the HDMI display.
I can't find a single tutorial that will walk me through how to do this; appears the way it used to be done (fbtft) was deprecated and now uses DRM, plus some overlays? All I'm finding looking through Raspberry Pi stuff is a bunch of conflicting info and older deprecated stuff.

>> No.2713805

>>2713776
DRM (the Linux subsystem) is definitely the preferred high level way to do it. Good luck with dealing with the fuck mess of chinks trying to update their drivers to the latest new thing.

>> No.2713860

>>2713776
some dude used an OLED display with the i2c bus in the hdmi port i think it really its detected as "screen" by the os
not saying it's the same but you might find some relevant info here
>https://mitxela.com/projects/ddc-oled
>https://youtu.be/TfBQi_peHI4

>> No.2713863

>>2713805
Bleh. Found this for fbcp-ili9341. Appears this can be config'd to work with my board. Is there a more recent option? Looks like it was last updated sometime last year.
https://github.com/juj/fbcp-ili9341

>> No.2713871

>>2713863
> 32bit only
... so now I need to find something similar that works for 64bit, b/c this won't compile.

>> No.2713877

>>2713863
>C++
>cmake
>all this trash just to use SPI
Glad I don't have to deal with that cancer.

>> No.2713992

>>2713877
I thought this would be straightforward, given the number of projects I see based on screens. Appears basically that SBCs work under 32bit, and RPi's have some new configurator that is just pushing buttons, *or* they use a screen "hat."
I'm seriously considering just re-writing the Orange Pi I have with 32 bit and using fbcp since I can't find another straightforward solution. Not really interested in getting deep on screen display coding for a hobby project.

>> No.2714006

>>2713992
The main tricky part is usually initialization, it's best to copy that from something that runs on your hardware and that works. From then on, it's pushing pixel data through SPI. But I agree, doing it yourself is annoying if you don't want to get deep into it.

>> No.2714061

>>2714006
Yeah, if I get anything to show up on the screen at all, it would be an improvement where I’m at right now.
It’s a good idea to look for existing projects, the problem, I’m having is that all the pre-existing project use retropi as a starting point. I’m trying to make an Atari boy, that uses Stella running on a minimal version of Linux and x11.

>> No.2714229

>>2713860
>i think it really its detected as "screen" by the os
It is not, he had to code it that way in the host computer.

>> No.2714283
File: 168 KB, 400x600, file.png [View same] [iqdb] [saucenao] [google]
2714283

maybe not the best thread to ask, but what's a good spot welder?
I never found one that can weld reliably the nickel plates on bosch batteries, they're thick af

>> No.2714288
File: 374 KB, 1049x748, 553816DE-E6F2-4C04-B301-87776B545C31.jpg [View same] [iqdb] [saucenao] [google]
2714288

>>2714283
Lots of people successfully solder them—just be careful not to get them too hot. In the end, it’s not that different from an electrolytic capacitor.
Or get them with tabs.
Or use flat lipo4 batteries.

The reason they are spot welded is it is cheaper (no solder) and a lot faster.

The reason they’re not in holders as in picrel is because spot welding supports higher current.

So, if you’re doing thousands of these things and you’re drawing more than 1 Amp from each cell… by all means, go for spot welding. For everyone else, it’s a meme.

>> No.2714291
File: 1.21 MB, 720x1280, file.png [View same] [iqdb] [saucenao] [google]
2714291

>>2714288
thanks for your reply Anon, but I don't care about commercial reasons and alternatives to welding
I just need a tool to solder the batteries in place when I replace the cells
what I do now is replace the nickel plates for thinner ones and solder them with pic rel, but I'd like to use the thick plates that came with the battery

>> No.2714373
File: 169 KB, 1400x899, MOT spot welder1.jpg [View same] [iqdb] [saucenao] [google]
2714373

>>2714283
>what's a good spot welder?

the one you build yourself from a microwave transformer.
just look at that thing: best build quality you can get for 20 minutes of work, and zero planning.

>> No.2714434

>>2714291
> alternatives
The reason I mentioned them is that it’s common to get rid of the whole lower half of the pack’s shell, and make ones’s own bottom shell case to fit whatever you want.

For me, the most maddening part of battery replacement duty is cramming that shit in those tiny press-fit cases.

>> No.2714451

>>2714373
> On/Off is a breaker strapped to the side
Seriously, setting up a microcontroller to pulse the 120VAC side of this wouldn't be that complex.
>>2714434
Do you clamp the batteries down into the shape they need to be prior to welding? Do you maintain clamp as you install? Never made one of these packs, curious now.

>> No.2714455

>>2714283
I would like to know this too
I built one using a smaller lead acid battery and some copper probes which just burned holes right through the battery top even though visually it looked like it was spot welding properly.
the battery was small enough that it would sag down to 4-5v when welding too which should be good

>> No.2714459
File: 321 KB, 1283x1253, tempWelder.png [View same] [iqdb] [saucenao] [google]
2714459

>>2714283
>I never found one that can weld reliably the nickel plates on bosch batteries, they're thick af
I think the answer is you need a higher output welder. Not sure what those Chinese boxes put out, but this will weld 2 sheets of 20 gauge (1/32") steel together.
This would need reworked obv... And not sure at what point you blow apart the battery's insides w/ heat.

>> No.2714462

>>2714451
> clamp down batteries?
If I’m making my own custom case, I just duct tape the batteries and solder wires to the cells. I never bother with that nickel strip nonsense. You can immerse the bottom 7/8 ths of the cell in cold water to prevent it from getting too hot.
Cells are duct taped and I use a bit of foam to hold them in the case without rattling around.
Simple as.

For microcontroller projects, I use >>2714288 battery holders because the current is sweet fuck all.

>> No.2714465

>>2714451
>microcontroller to pulse the 120VAC side

why? dont need microsecond timing on this.
i find that a half-second is no diff from 2 seconds.
i push down with one probe to hold strip in place, then touch second probe close by for fraction of a sec and pull away.
will do a second touch elsewhere if the burn mark is not impressive enough.
doing destructive testing tells me this second touch is actually unnecessary.

>> No.2714656
File: 1.21 MB, 1164x645, tempWelderArduino.png [View same] [iqdb] [saucenao] [google]
2714656

>>2714465
Oh, so that's actually your device. I guess you're right; it's "on" when you press down and "off" when you let up and if timing doesn't matter then you don't need a better switch.
What's the output voltage/current on that thing?
LOL just googled this; I've seen microwave welder designs prior but not for batteries like this. And they already did my arduino voltage controller: https://www.instructables.com/DIY-Spot-Welder-From-Microwave/

>> No.2714721

>>2714656
>What's the output voltage/current on that thing?

3Vac-rms at (supposedly) 500A.

>> No.2714735

I'm too retarded to figure this out. I want to run multiple servos from a samd51xx and don't understand if I can connect them all to one TCC? i.e TCCW0, TCCW1, etc. If I do will they all run at the same time or will I be able to control them independently?

>> No.2714793

>>2714373
did you just take an angle grinder to the coils that were originally there?

>> No.2714841
File: 217 KB, 1414x938, block diagram.png [View same] [iqdb] [saucenao] [google]
2714841

Each WO (waveform out) pin is connected to a seperate capture-compare-unit, which compares a value in its register (CCx) with the current counter value. Though in reality you'll write to CCBx instead of CCx, because CCBx will only update once the counter hits its its maximum value (maybe minimum too, idk). So long as you set the TCC peripheral to act as a PWM generating timer (fixed frequency, reset count value when it reaches the PER register, etc.), you'll be able to put independant duty-cycle values in the CCBx registers for each of your PWM channels and they'll be PWM'd independently. These values can be updated independently of one another, and you can also enable and disable WO channels independently of their capture-compare register values.

Just read the datasheet, it's only 2000 pages long.

>> No.2714843

>>2714793
This (or hacksaw) is the best way of going. You can cut the welds in the transformer core and remove the secondary that way, but the result is a shitty (and possibly damaged) aluminium winding that you'll never do anything with, and a transformer core that rattles the shit out of itself. Sure the open core is easier to add your own windings to, but that's a non-issue if you're just adding 4 turns of 2-gauge.
If you glue it back together it's probably fine.

>> No.2714872

>>2714735
someone correct me if im wrong. your mcu will have multiple TC hardware units inside it. for each one of those youll have individual channels. you can independently run different channels using the same TC hardware. the limiting factor is what you set your low level timer properties to. in your case you can have timer running at a specific frequency, and you can set for each channel (motor) the duty cycle of the control pin

>> No.2714922

>>2714793
>take an angle grinder to the coils

cut off one side with hacksaw then used flat punch and hammer to knock it out the other side.
the size of the punch is critical; too small and it drills in, too big and it wont budge the wires.

>> No.2715176
File: 102 KB, 1237x851, This_DoesntFeelRight_png.png [View same] [iqdb] [saucenao] [google]
2715176

I need to send data from a sensor to a gateway to a server. the first two are in embedded C and the third is in Go.

The transmitter api works by feeding it a uint8_t array as input.

I understand that there are serialization protocols like protobuf that would allow me to get the serialization part done. the problem is is that I don't know how to structure my code so it's not absolutely and completely stupid.

There are different "kind" of packets. for example, one type just has some headers and then a single byte as a command code. by changing that number, there are multiple "non-argument-commands" that can be sent.

Some packets need to get/set a timestamp so they add a timestamp, and so on.

Anyways, there are different types of packets and some but not all can have different codes for the same type of packet.

Problem is, I can't find any literature on how to order this properly such that new commands can be added to the command-base without making the code fucked.

I refuse to believe that "making custom packets for devices to communicate" is not an extensively talked about problem. i'm just not finding the correct keywords, I just get sent back to general network TCP/IP stuff.

>> No.2715190

>>2715176
One thing you should do is add a very important header: length. Early on… right after the packet type.
That way you can extend the packet types, and still get them read in a stream even if one of them doesn’t understand the new type.
Adobe flex/AMF started to make this mistake after the first (based) version, and then the little weiners turned it into shit because the length wouldn’t always work when decoding the stream.
Also, they started choking through huge XML blobs in the string packet anyway, so the entire ship was lost. Just like that whole company.
Last thing they did that was worth a squirt of piss was postscript. And maybe kinda-sorta PDF but it’s fuckulated in multiple was that make you want to punch more holes in the wall with your fist.

>> No.2715251

>>2715176
looks fine to me. but i think youre misusing the header. the header is "supposed" to be the smallest part. you have most of your payload there.
secondly, if youre using raw tcp/ip ip i recommend adding start/end/escape code symbols, a payload length byte, and a checksum.
honestly, its a custom serial protocol, just do whatever you want thats the whole point of custom

>> No.2715261
File: 52 KB, 274x219, file.png [View same] [iqdb] [saucenao] [google]
2715261

>>2714283
Just get a good old thick ass old skool iron and solder 'em
simple as
I've soldered whole DIY E-bike 18650 packs without any problems.

>> No.2715262

>>2714283
as long as you don't heat them more than 4 seconds they take no damage.

>> No.2715307

>>2715176
>uint8_t[6] timestamp
Surprised that compiles.

>> No.2715310

>>2715176
Also I don't understand your question. Is it a basic programming problem? Protobuf seems overkill for something this simple, but sure you could use it. Are you just looking for a way to frame your data into packets?

>> No.2715322

>>2715310
Yeah, I guess it could be just a programming problem. I'm confused on the "there are 7 types of packets and maybe around 20 that could become 50 total command numbers, so what's a smart way to link command-numbers and types" in such that everytime I add one 3 months from now I don't have to get deep into understanding everything all over again and writing in lots of different spaces.

I already did this in a custom way, I made an excel which holds all fields for all packets with all names and command codes, then a python script turns it into .h files, and it sucked. On the other hand, I have a different function for every single command code to fill one of the structs. I'm hoping to find best practices and approaches already made by other people in order to refactor the mess into a more standard solution.

>> No.2715332

>>2715322
Why don't you just add a length field to your packet header, then the receiver can simply skip unknown packets and it's extensible.
>I made an excel which holds all fields for all packets with all names and command codes, then a python script turns it into .h files,
What for, why not write that .h file by hand? Does it contain anything other than a bunch of structs an an enum with all the commands?

What I find weird about your header is that you make everything an uint8_t array. Using proper types would be simpler. You just need to be careful with alignment, or the compiler will add invisible padding depending on the platform.

What I would do (I have a preference for keeping things simple): just document which command type uses which struct. Don't have a function for each command type, just have a single packet sending function that takes the packet struct and size as a pointer. Initialize the command struct using C designated initializers to make it concise. On the receiver side you have a big switch(), or an array indexed by the packet type if it gets too big.

If you have complex data structures with nested arrays or many strings, it's probably better to use something complex like protobufs. But at that point I'd probably prefer using JSON, unless the use case requires BOTH very complex data structures and absolutely compact binary serialization.

RPC isn't a new topic. It's the old idea of making function calls transparent across network, like calling a function on host A, which transparently gets marshaled to a packet, and turned into another function call on the receiver side, all using a header-like description language like IDL. You can make it arbitrarily complex and high level, but is it really worth the trouble, just to make it slightly more elegant? Even the web just standardized on manually sending JSON text around.

>> No.2715337

>>2714922
Almost wonder if a wood punch wouldn't be a better option here. Not hard enough to dig into the windings.
>>2714721
Assume this is USA, so a 120V microwave. Do you run it as a welder on 120V or 220V?

>> No.2715373

>>2715337
>120V or 220V?

it's 120V.

not sure if my brain is working this morning, but it now occurs to me that if i was at 240V, i'd need 6 turns instead of 3.
which is counter-intuitive, coz doubling input voltage should double output voltage. so, you'd think you need FEWER turns to get same voltage.

but, for a given wattage, a 240V input coil will have double the turns of a 120V input coil.
so you'd need to double the output coils to match the ratio.
which is right, but feels wrong.

>> No.2715394

>>2715373
Most stick welders run on 220V; I know there are microwave transformer designs that do this, and assume they run 2 - 120V transformers in series to make it work.
I'm not that up on transformer design, all I know is the ratio is based on windings. V=IR, so I guess when you double voltage, you double resistance to maintain a given amperage. Practically though, you typically are doubling the current too when you jump up to 220V in USA, to a 40A service or some such.

>> No.2715411

>>2707804
hello,
i am sorry if this is not the correct thread for my question
i am working with an LPC54606 by NXP, i need to write SPI Frames using the DMA module, more specifically the DMA writes to FLEXCOMM0
currently i am trying to set everything up through "MCUXpresso Config Tools v14" and it just doesn´t work properly
i only have access to the LPC546xx Family Guide an User Manual, so i would need a device specific data sheet if i have to configure it all through register directly

does anybody have a clue on how to solve this? the NXP support doesn´t talk to me

>> No.2715425

>>2715411
>the NXP support doesn´t talk to me
kek

>> No.2715530

>>2715425
He shoulda gone with CH32V003s, then he could ask the WCH official AliExpress store for help. They’d probably just respond with “please understand” but still.

>> No.2715550

>>2715530
Sounds like this guy somehow got a job doing this, lied about his experience, and now we’re stuck with it.
>>2715425
They probably got tired of doing your job for you. I had this one unpaid customer that kept sending me emails all night from India

How did you end up getting this project without a data sheet to the specific device?

>> No.2716038

how am I supposed to write a delay function if the delay is shorter than the time it takes to call the function

>> No.2716047

>>2716038
For loop incrementing volatile variable (so it doesn't get optimized out) or inline asm nops.

If you need it multiple places like a function, define it as a macro.

>> No.2716099

>>2716038
it should take only a couple of cycles to enter and exit a function, if it's less than that just use noops.

>> No.2716546

Any recommendations for a cheap microcontroller with a good BLE chip and usb C? For some reason all of the rp2040 clones with usb C dropped the Bluetooth. Otherwise, I’d just pick up some of them…

>> No.2716555

>>2716546
Ah never mind, the challenger rp2040 comes in a BLE+usbC format. $20 though.

>> No.2716563

Oh lol ESP32 has 5.0 ble. Guess I’m just getting some $2 boards then

>> No.2716679

>>2716555
There's a BLE rp2040 thing now? Where?

>> No.2716683

>>2716679
https://www.digikey.com/en/products/detail/raspberry-pi/SC0918/16608263

>> No.2716735

>>2716683
The datasheet doesn't seem to explain it, what is the big metal covered chip on the board?

>> No.2716799
File: 112 KB, 600x436, Laird Connectivity Sterling™-LWB5+ WiFi 5 with BLUETOOTH® 5.2 Modules.png [View same] [iqdb] [saucenao] [google]
2716799

>>2716735
>big metal covered chip on the board?

Laird Connectivity Sterling™-LWB5+ Wi-Fi® 5 with BLUETOOTH® 5.2 module is based upon the Infineon AIROC™ CYW43439 chipset

>> No.2716810
File: 668 KB, 1100x647, 8379C452-F864-43A2-A6CE-6535CC108B0A.jpg [View same] [iqdb] [saucenao] [google]
2716810

>>2716735
I think it’s just a ‘can’ or a shield to prevent emr from getting out. There’s probably some components under there, perhaps a small inductor and/or capacitor. The pcb antenna is going to be on the outside.

>> No.2717104

I'm doing a simple web server with ESP32. It reads a temperature and prints it on a web page for me, along with an SVG plot so the web page is big, but not enormous. Much of the time it works, but frequently it starts to lag, and sometimes hangs.

All the action is in loop(), with a yield() in there. The heap is huge according to getMaxAllocHeap(). The arduino site says WiFi.h is old and retired and not maintained, but I can't find a simple replacement. Any suggested WiFi libraries for ESP32 that work well for you? My board is the Doit ESP32 Dev Kit V1.

>> No.2717105

>>2716799
Right. It's actually mentioned in section 3.8. It's also in the schematics, but on a second page.
Apparently it's connected with SDIO. What protocol does it use? Apparently there's a standard to use WLAN modules with SDIO. Does that include the BT host protocol?

>>2716810
Obviously. The RP2040 doesn't have BT hardware, so it had to be a specialized chip.

>>2717104
>loop
>yield
So you hammer the CPU with a pointless busy loop?

>> No.2717109

>>2717105
>So you hammer the CPU with a pointless busy loop?

loop() runs non-stop and handles clients, and reads the temperature. How else should it be done so that i don't "hammer" the cpu? and yield() supposedly allows housekeeping, watchdog, etc. What are you suggesting I do differently? This approach has worked for years with nanos and esp8266s. Is there a better approach for ESP32, which has far more processing power than a nano or esp8266?

>> No.2717111

>>2717109
I'm pretty sure it puts 100% load on the CPU, with yield allowing it to schedule other threads. I'd just not use the Arduino crap and do it properly.

>> No.2717114

>>2717111
>I'd just not use the Arduino crap and do it properly.

all CPUs that are not sleeping run in a continuous loop, and check to see if something has to be done. What do you mean "properly", other than that you hate arduino?

>> No.2717159
File: 15 KB, 460x253, only_c_programming.jpg [View same] [iqdb] [saucenao] [google]
2717159

Is there a way to add another separate USB port to a Pi Zero W?
A hub that connects to the one USB port won't do. I want to do USB man-in-the-middle stuff. For that I need one USB port in OTG gadget mode and one in the regular host mode.

Already got a pi zero w. I also have a Pi 3B, but that one doesn't support gadget mode on its ports.

>> No.2717164

>>2717159
if you're fine with usb 2 speeds you should be able to do it with a tx rx connection right

>> No.2717192

Trying to program an stm32f103.
I am connecting by openocd and use gdb to load and interact with the program.
It doesn't appear my program ever runs, though. I can't actually use gdb to examine if this is true so I instead setup a volatile static var and examine its value by having the code write to it, which is the closest I can get (when an interrupt happens, the pc points to the NMI handler but that, too, doesn't seem to execute beyond that).

I tried but st-utils and openocd for providing the transport and the server. While they behave slightly differently it amounts to the same thing.
I tried configuring GPIO pins to get feedback that way too, but I get nothing (they stay floating which is the default instead of configuring to pushpull, for example, and I get nothing out of them).
With st-utils, trying to step in gdb causes the programmer to blink its lights showing activity, but the step never completes. Using openocd, trying to step causes a hard fault.
Also, hitting a breakpoint in openocd causes a fault because "only two byte breakpoints" are supported and gdb insists on using hardware breakpoints. Additionally, BKPT "is not supported on this processor" according to gcc, even though it's in the official ST library for the stm103xb.

I also tried flashing with st-flash but that didn't seem to run the program either based on gpio pin states.

I'm fairly certain my init sequence is correct and I use the ST stm32f1xx headers for the symbols so that should be good, too.

What the fuck is going on and what can I do to make it not be fucked up?

>> No.2717194

>>2717114
Wow, you're some special levels of retarded. Embarrassing.
Not that I expected much from an arduinofag.

>> No.2717205

>>2717111
> 100% load on the cpu
Yeah. This is a standard practice for many many years. Your original IBM PC was in an idle loop. Back then processors didn’t get that hot.

Enter modern processors, intel processors execute the HLT instruction and literally “halt” until there is an interrupt and then it goes and does some work.

So, most of your early and low-end architecture µCs are going to be in a polling loop. This is also common in “real-time” systems, and pretty much defines how real-time needs to work.

>> No.2717206

>>2717205
The reason it happens in realtime is totally different, namely you actually need to do that to ensure timing.
Otherwise it's exactly as you say: long deprecated and relegated to extremely old or extremely low-end chips. That's also mostly because they're so slow that hammering them that hard doesn't actually hammer them that hard.

>> No.2717209

>>2717159
Connect two Pi Zero Ws.

>> No.2717213

>>2717114
>>2717205
Looping your scheduler is OK. That makes the idle thread on any threaded OS ok, as it does with no-OS firmware. But he seems to be looping on some user thread. I bet that leads to less than ideal scheduling.
Granted, his actual problem is probably due to packet drops.

>> No.2717478

is there yet an esp32 that has the specs of the esp32-s3 but in risc-v? i see the esp32-c6, but it doesn't have nearly as many gpio pins and the clock isn't as fast

but it is better in some other ways, like having wifi 6 and ble 5.3

>> No.2717620

>>2717478
The tensilica-based cpus can also do more in one clock cycle in addition to being clocked faster.

I think the point is to move away from tensilica since there is a cost associated with that (despite the fact they were practically taking a loss on them).

maybe you could just use two RISC-V based ESPs

>> No.2717751

>>2717620
>The tensilica-based cpus can also do more in one clock cycle
I didn't know that, is there some reason for that? I've always found it difficult to understand how you could get anywhere close to 1x 32-bit instruction per clock cycle anyhow when your program memory is accessed via SPI, unless the flash memory's SPI clock rate is PLL'd up to the GHz range. This applies to RP2040s too.

>> No.2717759

>>2717751
Probably better optimized micro-architecture. RISC-V is pretty new and obviously a CPU for a new ISA isn't as optimized as an old platform that has been around for a while. But yeah it depends on the exact benchmark.

>> No.2717783

Anyone have any experience with Rock Pi S single-board computer? I've been testing it a bit and it seems great for its low price. Everything has "just worked" so far. If no one here has any horror stories I'm about to pull the trigger for 100 units

>> No.2717842

>>2707804
Hi, absolute retard here. I'd like to make a self diy project involving the following
>a board
>a display screen 5"x5"
>small battery to power it
>SD card slot

My main goals would be to display a simple gif or webm on repeat just for fun. But I'm retarded and know literally nothing about any of this stuff. Where do I start? What should I use?

>> No.2717844

>>2717842
google shit for two weeks. also gpt4.0. Together, that's unironically a good way to learn.
I had no idea how do iOS anything and now I have a neat app on the App Store. Just googled and googled and googled.

>> No.2717853

>>2717844
Ok I will try that. You pay for GPT4?

>> No.2717860

>>2717853
yeah. mainly for programming. For swift/swiftUI at least, it's quite capable.

>> No.2717870

>>2717860
Thank you. I will give it a try.

>> No.2717900

>>2717842
Gif files are simple bitmaps with a relatively simple compression algorithm (run length encoding iirc). A bit of programming experience and some trial and error should get you able to display gifs on a SPI or I2C screen. Webm files are going to be a lot tougher, requiring much more nuanced video decompression, probably also Fourier.
Display driving isn’t that easy, but with any luck your display has a relatively comprehensible and comprehensive data sheet.
SD card interfacing is easy.

I don’t think I’d trust GPT to write microcontroller code that isn’t full of bloaty libraries, or to understand hardware differences, but idk.

>> No.2717903

>>2717900
LOL. if is simple, but probably, requires some effort to implement manually. Webm supports multiple video codecs, so good luck with that. Pushing raw uncompressed image data to displays on the other hand is pretty easy, mostly just a SPI transfer, though initialization is tricky because everything is misery.

>> No.2717933

>>2717900
I dread the day I get called into a meeting to discuss replacing our microcontrollers with something 10,000 times more beefy and capacious because the only thing the new devs can do is python <spit>

That fact that someone is actually using chatgpt to write code sinks the mood from mere depression into the abyss.

>> No.2717935

>>2717933
I am proud of my chatGPT use for coding lol. Frees up my time, and in exchange I am like 3x more productive (I don't have any real coding training). Sure, I admit that it produces unoptimized, sometimes strange code, and that I perhaps am not 'leaning' properly - but it's good enough for me. I sort of see it like using FEA packages while not really understanding the finite element underlying mechanics. idk.

>> No.2717968

>>2717935
> “Frees up my time”
All your free time should be spent coding.
Either that, or your not like me for some reason. Only reason I’m even here is because I’m waiting for a compile.

>> No.2717989

>>2717933
One can only hope the covid MCU supply shock was enough to stop companies going overboard with the chips. I doubt it though.

The highest-level I think you can justify pushing an embedded project up to is a full TCP/IP stack to use ethernet as an easily expandable and long-range network between sensors and nodes and stuff. Like ethercat servo drivers, or security systems.

>> No.2718005

>>2717989
> tcp/ip
Signalling is a bitch, and ultra complicated. Routing.
It’s way to easy to connect the uart to a rs422 or rs485. That’s the microcontroller sweet spot. Or, of course, RS232 if you got some wyse terminals lying around instead of buying displays and buttons or whatever.

>> No.2718051

>using the arduino IDE like a pleb
Is there a good way to somehow integrate arduino with spell checking and shit into vim/nvim?

>> No.2718064
File: 224 KB, 1320x1094, m328PBdef.inc.png [View same] [iqdb] [saucenao] [google]
2718064

>>2718005
I guess RS422 or 485 can work if you have a routing protocol for it (e.g. a master polls individual addresses), but existing network hardware in a building is still a nice thing to piggyback off for larger systems. I think about a single server enclosure is the scale where I'd transition from one to the other.

>>2718051
I have the same pathology. The easiest thing I could suggest is to move to VScode + PlatformIO, but that's a laggy piece of shit built on electron, so I can't really recommend that in good faith. Also it's arduino'd by default and undoing that is a PITA that requires figuring out where some funky source directories are (idk i think it's in /usr/bin or wherever but i can't find it), there's a youtube tutorial on it. MPLABX and Microchip Studio are too proprietary for me.

Personally I don't know how a programming environment like notepad++ or VIM (or some companion to it) is meant to generate a makefile, but it's the makefile that specifies the microcontroller you're compiling for. Though maybe you'd put something like
>#define CPU mega328p
and that automatically gets into the makefile, and defines what files avr-gcc accesses (e.g. m328PBdef.inc, pic related), and hence what autocorrects you'll get.
Ideally you just add that #define line and you end up with autocorrects to PORTB and bitmasks and stuff like that by way of your text editor being smart. I remember having to extract the ETCdef.inc file from MPLABX to work with the newer ATtiny1614 MCU via avr-gcc, but it has all of the older .inc files already. Somewhere at least, I'm bad at finding directories.

Does Arduino even have spell checking? It doesn't even tell me when I miss a semicolon, let alone when I put TCA.PER instead of TCA0.PER.

>> No.2718065
File: 216 KB, 1048x1262, has the same stuff but more.png [View same] [iqdb] [saucenao] [google]
2718065

>>2718064
oh it looks like iom328pb.h might be what you need instead. it has the same memory addresses but it's also got the interrupt vectors and bitmasks for the fuses. though it looks like the more nuanced bitmasks are in that def.inc file:
>; ADCSRA - The ADC Control and Status register A
>.equ ADPS0 = 0 ; ADC Prescaler Select Bits
>.equ ADPS1 = 1 ; ADC Prescaler Select Bits
>.equ ADPS2 = 2 ; ADC Prescaler Select Bits
wish we had code tags

>> No.2718070

>>2718065
those iom328pb.h numbers aren't memory addresses, i'm retarded, but they are still good for autocorrecting and writing legible code, i guess

>> No.2718154

>>2718064
>Though maybe you'd put something like
>>#define CPU mega328p
>and that automatically gets into the makefile,
The makefile can call gcc with -DX=Y which is like adding a #define X Y . What you describe should be possible but usually (rp2040, esp-idf, w80x) is stored in another file you can edit `make menuconfig` or `idf.py menuconfig`. I would not want to have the contents of the sdkconfig shitting up main.c

>> No.2718258
File: 19 KB, 873x514, mspaint_UbEW8tZN18.png [View same] [iqdb] [saucenao] [google]
2718258

I wanna make a little box with a display
I want it to display 2x 3digit LED displays (literally like an alarm clock, just the simplest thing)

I'd like to be able to
( + ) increase
( - ) decrease
( R ) reset
these displays so they display numbers separately

what's the best way to achieve this? does a tutorial for this exist or would I have to learn how to make simpler things first before figuring this out on my own?

>> No.2718269

>>2718258
There's probably over 9000 arduino tutorials for buttons and 7-segment displays. It's trivial to get what you need from there.

>> No.2718292

>>2718269
ive found a few but a lot of them have a single 4 digit display, or 2x 2 digit displays with no reset button (scoreboards usually), and a lot of them are in a language I do not understand.

I am a total beginner, my only experience is with raspberri pi in school, and I think if there was a tutorial for exactly what I need to do, I could succeed building this, but not if I have to figure it out on my own based on some tutorials that are for a slightly different thing.

>> No.2718300

>>2718292
Figure out how to make a button, figure out how to make a LED, then use your knowledge to add the buttons and LEDs you want. Where is the problem? You still have to think yourself.

>> No.2718306

>>2718300
>Where is the problem?
I am not that interested in getting into a longer term learning project ie following tutorials for other projects and then figuring out how to make my own, making the schematic and writing my own code and all that, it does sound very intimidating...

but I would be interested in building this following instructions, and there are -some- tutorials like that but what I've found so far are slightly different. I believe because this is not a super unique/specific thing, there might be a writeup or tutorial out there that matches this exact description, and I'd like to find it!

>> No.2718314

>>2718306
Then ask google, not us.

>> No.2718559

>>2718306
because of how simple (and useless) the thing you have in mind is, there is almost zero chance youll find an exact step by step spoon feeding tutorial. so youll have to get into a slightly longer project where you might actually learn something. and as the other anon said, goto google if you dont want our advice.

>> No.2718587
File: 89 KB, 1230x896, 2023-11-27-230829_1230x896_scrot.png [View same] [iqdb] [saucenao] [google]
2718587

I'm in a bit of a bind. Someone on my senior design team insisted on writing his code in the Arduino IDE, for the STM32f411ceu6 that is going on our board. The code (essentially driving one of those hitachi LCDs with an i2c expander) works perfectly fine when it's uploaded to a blackpill f411ceu6. But, the code refuses to run when uploaded to the on-board stm32. The arduino IDE confirms that it does indeed get uploaded, but then nothing actually runs.

I'm tearing my hair out, I need this fixed by thursday or we all lose a letter grade or two in our senior capstone class... any ideas as to what might be going on?

here's the code
https://pastebin.com/EQPmeFHc
and pic related is the relevant bit of the schematic.

>> No.2718588

oops, forgot to make thread for /ohm/:

>>2718585

>> No.2718592

>>2718587
>Someone on my senior design team insisted on writing his code in the Arduino IDE,
Quit. Run as fast as you can.

>> No.2718600

>>2718592
I wish I could
I have my own version of the code duplicating some of the functionality, and it's written entirely in register-level C/C++ with the CMSIS library, no HAL. But I didn't write a working display driver. I told myself I should have months ago but I've been behind all semester. I just don't have the time at this point, so my best bet is to get his code running on the on-board STM32

>> No.2718644

>>2718587
what sucks big dick is I can't even do in-line debugging in the arduino so I know fucking dick all where the problem might be

one thing I notice is that the I2C never even starts when it's running from the on-board stm32. I'm not sure how far it gets into the boot process before stopping, if it even runs at all.

is there some common configuration step for standalone MCUs in the arduino environment that I might be missing?

>> No.2718647

>>2718587
Have you considered going to the teacher or the lab assistants office hours with another member of the team and all your shit?

>> No.2718667

>>2718587
Did you set BOOT0 pin to correct value? It must be pulled low for code to load from flash.

>> No.2718694

>>2718600
this is one of the reasons you need to figure out if it really is important to be as autistic as that. you could have completed this in mere days had you at least used the HAL. and yet, here you are about to fail because you can't figure out simple priorities. lol. lmao even.

anyway check your boot0 pin and reset configuration. this is also a lesson in always having a system alive LED, and an independant watchdog. those things would tell you whats going wrong just by looking at the fucking LED. something i always do is make the LED do a startup sequence before further initialization, that way i know that the bare metal starts up. should have also got the tarduino faggot to put some printing through the USB or an ftdi so you can monitor it

>> No.2718695

>>2718587
well for a start that module on the right isnt even connected to power. is the mcu connected to powrr properly also? i see no smps or linregs assuming yiure powering from usb

>> No.2718698

I have BOOT0 jumped correctly when trying to execute the code uploaded from the Arduino IDE. It's acting similarly to what would happen if BOOT0 was tied high (deadlocked), but I know for a fact it's not.

right now I'm trying my best to port the stupid ass LiquidCrystal_I2C library to the stm32 as fast as possible. I have it writing characters but the backlight's acting weird when I enable/disable the cursor.

>>2718694
my man, my non-HAL firmware works flawlessly
it was the other guy's job to handle the high-level software side of things, not mine. My only duty was to design the hardware and write the low-level firmware to communicate with some DACs and to drive a multiplexer. The fact that I have my part of the software working 100%, and also implemented 75% of the other guy's code for redundancy/safety is above and beyond what I was supposed to do, and is probably what's going to save our asses given that I'm now writing the rest of his part of the code as well. If anything, it should have taken HIM mere days to write a fucking rotary encoder driver and menu interface, but it's been 5 months.

>>2718647
this entire university is dysfunctional. The professors would tell me "we can't help you, this is how it is in the REAL world", and the TAs wouldn't know their asses from a hole in the ground.

>>2718695
I totally forgot that's how I made it look on the schematic. Essentially, the hitachi board is connected to an i2c shift register/expander, which is 4 pins only. So, even though the hitachi board is like 16 pins, it only needed the 4 pins that I assigned to a jumper. Thus, for the purpose of my PCB, they're all NC.

>> No.2718701

>>2718587
First of all, write the simplest possible arduino "sketch", like one that pulls PB6 low.
If that works, then start chopping the tarduino coder's shit into bits and testing them one by one (sensor, LCD, etc.).
If it doesn't work, then start digging into the nitty gritty of STM32 via arduino. Things like looking at the blackpill schematic and altering your PCB to be as similar as possible, or looking through the fuse settings. I can't see a crystal or other clock source in your picture there, maybe the Arduino IDE is defaulting to using an external crystal but you need to tell it to use an internal oscillator (sometimes you need to tell it to burn bootloader to set the fuses).

If neither of those work for you, then consider migrating the sketch into PlatformIO. It has support for debugging code, but I'm not sure if it can do so for Arduino sketches.
The only other options are to copy-paste bits of the arduino code into your own C/C++ code (with find+replace to swap out shit like digitalWrite) to get it working, or to try extracting the arduino code as-is along with all its reference files and flash it to the micro without using the Arduino IDE itself.

Also make sure the arduino code isn't waiting for a serial connection before its main loop lmao.

>> No.2718710

>>2718701
>Also make sure the arduino code isn't waiting for a serial connection before its main loop lmao
this, the retard is probably got some infinite while loop waitimg for some tarduino shit

>> No.2718712

arduino and platformio are the worst things to happen to microcontroller development. Pure niggerslop all of it.

>> No.2718714

>>2718698
if youre trying to directly port his code over its probably trying to access some unassigned memory and is seg faulting out. also arduino uses c++ so its immediately incompatible with the C code youre writing for your non-HAL firmware. another possibilty is that it may be screwing with your clock settings. as some other anon said, we see no xtal on your schematic and the blackpill board definitely uses one, if going by every other arduino initialization

>> No.2718715

>>2718712
I found it pretty useful for quick prototyping and just to check if the hardware works correctly before I use a real development environment.

>> No.2718716

>>2718712
agreed. id sooner use vendor ides than that shit desu. at least the vendor shit *works*

>> No.2718727

>>2718698
If those are same chip there is no reason why arduino code shouldn't work on your board. Did you flash arduino's bootloader on your board? Arduino bootloader executes before main program. If you don't have bootloader it probably won't know where the program starts as it's most likely very different from your standard stm32 binary.

>> No.2719154

maybe this will give you some ideas (like that cubeprogrrammer thing to be able to use the arduino ide).

https://www.electronicshub.org/getting-started-with-stm32f103c8t6-blue-pill/

>> No.2719187

I'm hoping to port some software that was written for an attiny25 to an attiny1616, how should I go about doing this? I've messed around with arduinos a little bit but I've not really got my hands dirty with this kind of thing. I gather the 1 series uses different registers to the old 25. Anyone got any tips for how to get started?

>> No.2719228
File: 452 KB, 1230x658, tempSTM32.png [View same] [iqdb] [saucenao] [google]
2719228

I've built a few things with arduino, and want to try working with STM32's.
Is below a good starting point?
https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_STM32_:_STM32_step_by_step
Are pic related what I'd need to get started?

>> No.2719260

>>2719187
The timer registers and GPIO registers are different, so are clock registers and fuses and all the low-level stuff but the Arduino IDE takes care of most of that for you. If your code just uses digitalWrite and analogWrite and delay() then it will probably port easily, so long as you pay attention to pinout. Post the code, I write a fair bit of code for the 1614 myself so I can probably give a decent overview of what needs changing.

>>2719228
Those AliExpress STM32s will be fake, because the chips themselves cost more than that. They might still work fine, but I’d read Greaseweazle’s guide on fake STM32s first.

>> No.2719290

>>2719260
Thank you for that info. The code is called Bistro-HD, it's firmware to be run on a flashlight driver. It's all available here:
https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/249/Flintrock/bistro-hd
Specifically the TAv1-OTSM-HD configuration (there are a load more .h files in the /config/ directory).

>> No.2719293

>>2719290
The most relevant hardware config file seems to be this:
https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/249/Flintrock/bistro-hd/fr-tk-attiny.h

I didn't write any of it, just trying to get it working on newer hardware

>> No.2719330

>>2719228
no. the F103 sucks ass. use a L433 variant

>> No.2719365

>>2719330
>F103 sucks
I'm going to be running literally blink and basic motor controls for the first tests. Does the variant really matter?

>> No.2719505

>>2707804
i want to build a machine that solves the rubik's cube. But firstly i need a way to get the cube's scramble from the color of the stickers. I think that getting the scramble is one of the hardest parts of the project, and i feel like simple computer vision would be the easiest way where it just gets the color of each sticker in the 3x3 grid of stickers on each face (and it does that on 5/6 facds). So what is the cheapest (and most available) camera module that would do the trick. And also i am open to other ways of getting the scramble. Thanks

>> No.2719514

>>2719505
also what model motor/servo would be suitable since pretty much only 90/180 degree turns will be done

>> No.2719591
File: 7 KB, 400x400, tegaki.png [View same] [iqdb] [saucenao] [google]
2719591

>>2719290
>>2719293
Ok I will have to say, that guy is a much more proficient coder than I am. That said, it looks like it should be doable to translate the code across. Swapping the pinout around is trivial and left to the reader.

The first thing we see being defined is the MCU frequency. Considering the tiny13 uses 4.8MHz and the tiny25 uses 8MHz, I doubt this is critical. Then theres:
>timer interrupt mask
>timer overflow interrupt vector
>EEPROM size
>ADC voltage reference
>ADC clock prescaler
All of these should be relatively easy to find in the corresponding datasheet. Though I'll note that the EEPROM is handled differently in the tiny1 series compared to the older series, they're in different address spaces. So you'll likely have to find all the code that makes calls to EEPROM and replace them with corrected code that you copy-paste from examples or whatever.
Also, considering it's only asking for a few register names that are different between the tiny13 and the tiny25, it's probably hard-assigning all the register names that are the same between the 13 and 25, making the code minimally portable outside the old series of AVRs. You may well have to completely rewrite it. If nothing else, I'd attempt importing it into Atmel Studio or whatever and seeing if it has a method for porting projects.

>>2719505
Instead of robot arms or whatever, I'd just have a table that can grip the cube with 12 fingers, three on all sides of the cube. If the cube is in a fixed baseline position it's trivial to just have a little RGB colour sensor beneath all nine sections on the base, and to flip it around to read all 6 faces. Pic related. Blue are the fingers that pull together or apart with something simple like a solenoid or bowden cable or whatever, pink are the colour sensors, and brown are gear surfaces used to rotate the cube faces via stepper motors or whatever. Not sure how you'd have gears for X and Y at the same time though, maybe you'd just have one plus a turntable.

>> No.2719651

>>2719591
Bistro poster here: Thanks v much anon I will give it a crack

>> No.2719856
File: 367 KB, 910x591, fere.png [View same] [iqdb] [saucenao] [google]
2719856

>>2719228
I dunno. I just ordered 7 of these fuckers

>> No.2719857

>>2719228
>>2719856
It's just atmega328 with double the clockrate

>> No.2719858

>>2719260
How are they "fake"?
Can chang just cook any semiconductor he wants in his basement? How does he do it?

>> No.2719880

>>2719858
It's not hard to clone an ARM microcontroller, the STM32F103 is nothing special but very popular.

At least 4 different Chinese semiconductor manufacturer produce clones of it:
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20230227/GD32F103xxDatasheet_Rev2.14.pdf
https://datasheet.lcsc.com/lcsc/2304140030_CKS-CKS32F103CBT6_C556577.pdf
https://www.micros.com.pl/mediaserver/UIMM32f103cbt6_0001.pdf
https://datasheet.lcsc.com/lcsc/2308151436_Geehy-APM32F103CBT6_C526178.pdf

>> No.2719956

>>2719858
> cook up silicon in basement
Yeah, it works fabs work like jlcpcb does.
In 1M quantities, cadence (tensilica) will help you design it, too.

others just get the wafers and package them in black epoxy themselves. I suspect these companies used to have a fab, but became out-dated so now they have to outsource it. Like Intel.

>> No.2720003

>>2719858
I heard it's very common that the Chinese clone chips using lithography. They just etch away layer by layer and make an exact copy.

>> No.2720046

>>2720003
a lot of “fake” chips are actually real.

Imagine you’re a big semiconductor manufacturer and you start noticing failures in random testing (doesn’t work at rated voltages, frequencies, etc.) and you pick out the good ones, what do you do with the bad ones. if you guessed “sell them” you’d be right.

the main reason you see chips without any markings is because we laser-etch the fact that its bad right on the chip. then we sell them in bulk to whomever, with full knowledge they’re gonna re-test them to see if they can eek some marginal functionality out of them. some re-laseretch them with seemingly legitimage markings.
yes, we know they’re gonna do that, but as long as they don’t have our name on them, we don’t care.
would you rather us loose money!

some chinese companies dont even bother sanding off the bad-batch or failed test markings, most commonly bad nand flash chips. you can even sometimes see their hand-written notation for how much usable nand is accessible, sometimes just 128k.

anyway, I hope that helps clarify where a lot of these things come from.

>> No.2720061

>>2719856
i can't buy lgt8f328p chips on lcsc, is there a proper vendor that does sell these? i want to see what other clones that company makes.

>>2719858
did you read the guide?
https://github.com/keirf/Greaseweazle/wiki/STM32-Fakes
Some are QC rejects like >>2720046 talks about, some are rebadged clones, some are just rebadged cheaper chips (e.g. stm32f003, or even one with a completely different pinout that's probably going to smoke when you hook it up), some are a combination of those last two where they make the clone present as the correct chip as far as its id code and such goes, but has less memory and probably can't handle the same speeds, maybe not even have the same core capabilities.

there's also the non-rebadged clones, like >>2719880 mentions, which are usually pretty reputable since you actually get a datasheet with them and they're not trying to sell you something it's not. well they aren't but the dev-board seller is. the problem with buying bluepills from alibay is you don't know what clone or fake you'll get. with any luck you get a clone from a good company like gigadevice, but it's hardly certain.

>> No.2720078

New to MCUs, have been playing with a Pico.
I don't have a problem, but I'm curious about something.

As I see it, having access to the debug interface seems almost mandatory. Without it you're reduced to dragging UF2 files across a weird USB interface while holding a button every time you want to change something, and troubleshooting options are limited to printf over a USB console or squinting at some LED blink patterns.

However most of these noob-friendly boards seem to de-emphasise the debug connection and treat it as an advanced nice-to-have. I'm using the "H" version of the Pico W with a socketed debug port and the official pi debug probe, which works nicely- but it's a very recent development. The original Pico didn't have a socket unless you soldered your own; most Arduinos still don't seem to have a good story for debugging, instead telling you to buy pro-tier hardware for it.

Am I overestimating its importance? Is it less essential on other MCUs/boards than on the RP2040/pico?
I'm surprised these boards don't just have two USB ports (one for power and acting as a usb device, one for debug and uart access).

>> No.2720089

>>2720061
Who even buys the clones that are not going to work? Sure you can sell some chips to retards on aliwhatever, but the real money is in big volume sales.

>> No.2720092

>>2720078
All MCUs have debug capabilities. I assume some of those boards are just marketed to retards who don't know how to use them, or who won't have the hardware for it, like debug adapters. So they go for simple shit like that USB mass storage interface. I like the solution the Pico came up with: they provide firmware to have a second Pico (cheap as shit) act as programmer/debugger adapter, instead of making you buy one for dozens of dollars.
>I'm surprised these boards don't just have two USB ports (one for power and acting as a usb device, one for debug and uart access).
USB makes this just more complicated. An UART (for logging) is a trivial peripheral every MCU can do. USB would either require another USB peripheral (many MCUs don't even have a single one) or a UART-to-USB converter chip. So what's the problem with using UART directly? JTAG is also a thing that's easier to do with direct pins.

>> No.2720118
File: 1.11 MB, 2609x1848, 7F7F29F3-5970-4112-BC23-517E88D5980E.jpg [View same] [iqdb] [saucenao] [google]
2720118

Does anyone know what this big boxy component on my cars key fob is? Nothing comes up for the numbers printed on it.

>> No.2720124

>>2720118
My guess is the antenna btw

>> No.2720174

>>2720061
> read guide/greaseweasl
yeah, I was talking about a broader range of chips; not just STM from an industry perspective. Not what some vlogger thinks from buying a few boards from ebay.

>>2720078
> debug
To the maximum extent possible, code/test/debug on a simulator/emulator first before trying it on the actual hardware

>>2720089
> clones that dont work
they’re just counting on people not returning them or demanding refunds in time from ebay. Same with coupons… the redemption rate is less than 1%… similar model.

>> No.2720218

>>2720078
Debugging has largely been ignored by the hobbyist MCU community, because tarduinos have gotten used to just using serial.print for debugging and ignoring its use of more resources than the rest of their code. It's rather telling that despite the simplicity of the debugwire interface, and the fact that it's basically identical to the newer UPDI interface, debugging is basically non-present on any hobbyist-level AVR hardware. Not that you couldn't use a serialUPDI programmer as a debugger, and I think there is support for it in GDB now, but the software side seems to be either Arduino IDE (which supports debugging in limited capacity for some newer 32-bit boards), PlatformIO (why does it eat so much fucking ram) and text editor + avr-gcc + AVRdude. Then there's the vendor software, which usually sucks ass and doesn't support bootleg programmers.

Personally I see it as a complete lack of foresight on behalf of the developers of Arduino in the first place. They had a platform with a socket for an ATmega328P, an extra MCU that can act as a programmer, and they just ignored that potential and require a bootloader on the 328P and only have the extra MCU do USB-to-UART instead of SPI ICSP or debugwire. And now we're stuck in a pit of mediocrity. PICfags didn't exactly help, considering ICSP wasn't even intended with the PIC-kit in the first place.

STM32s and other conventional ARM chips basically get debugging for free because the legit hardware that supports debugging is cloned real cheaply (STlink V2). If I were you I'd stick to solely programming the chip via the debug port.

>>2720089
China has basically zero consequences for small-time scams. Scam someone, change the business name, start again. Especially if you sell legit parts for small batches of hard to find chips, and scam them on large batches only. See that guy who got scammed on like 50 6502s that turned out to be sihtty AT89C chips. Also AliExpress is pretty bad at siding with customers.

>> No.2720221

>>2720218
To be fair, I prefer printf debugging too. It probably uses less resources than their C++ trash though. You can also write your own reduced printf-like function that's just some dozens of bytes. Sometimes, gdb is a life safer though, and anyone messing with MCUs should know how to use it.

>> No.2720343

>>2720221
How do you use GDB? As a command-line tool, or in some sort of program with GUI?

>> No.2720489
File: 2.18 MB, 4080x3072, PXL_20231201_161834685~2.jpg [View same] [iqdb] [saucenao] [google]
2720489

I've never used a raspberry pi for any application before but it seems like I should be able to use one here, got a gate operator thats about 20 plus years old and the last guy to try and fix said the board circled in pic was fried so he took it out and we've been opening the gate by hand. Gate works when I force close the contactors so Instead of replacing the whole thing with an underpowered chink motor I want to program the pi to sense the signal when the keypad is activated, Open or close the gate depending on limit switch position and maybe have an ir sensor or something so nobody gets crushed by the gate. Is this feasible and where should I start to figure how to make it happen?

>> No.2720527

>>2720489
I'm halfway there to finding a board schematic,do you know what the model number of the board or the gate is?
Biggest problem is aaws or a.a.w.s. isn't very friendly to search engines apparently.

>> No.2720586
File: 3.14 MB, 4080x3072, PXL_20231201_161840263.jpg [View same] [iqdb] [saucenao] [google]
2720586

>>2720527
Thanks for looking into it. Turns out A.A.W.M in the garage door operator world means advanced audio warning module.. Would an audio warning module even have anything to do with signaling the relay to trip the contactors? Unless it only did so after making the sound..Seems to not work without it, but I still feel like I can make it somehow. To answer your question though, what's on that schematic is the only info I have.

>> No.2720618

>>2720343
“printf” debugging is not really debugging.. it’s more like “logging” or “tracing”, it is the simplest and most ineffective/inefficient way to do it.

First, obtain, and learn to use simulators.
Unless you’re doing strange shit with time-sensitive devices or real-time systems, it can solve 99 % of common problems.

Gdb is a horrible debugger, but it’s waaaay better than LLDB. Anyway, it’s a command line debugger you could use through a serial, or ethernet terminal, and worth learning so you can set breakpoints step through, examine stack, trace function calls, change memory and continue, etc.

>> No.2720622

>>2720343
Command line.

>>2720618
>“printf” debugging is not really debugging.. it’s more like “logging” or “tracing”, it is the simplest and most ineffective/inefficient way to do it.
I don't agree. printf debugging can be very effective. Yes, it's like tracing. But you can decide in code where and how much you trace.
>First, obtain, and learn to use simulators.
Where the fuck do I get a simulator for our custom hardware? I normally make my code portable enough so I can test parts of the firmware as Linux executables, but as soon special hardware peripherals come into play this idea is over.
>Unless you’re doing strange shit with time-sensitive devices or real-time systems, it can solve 99 % of common problems.
Totally not a common use case for MCUs.

>> No.2720722

>>2715411
>the NXP support doesn´t talk to me
Kek, lesson learned. Buy an Analog Devices part next time, our support will reply to you, or me if I'm bored and on Engineer Zone
> t. Analog Employee

>> No.2720731
File: 1.43 MB, 2343x3409, 1528268032638.jpg [View same] [iqdb] [saucenao] [google]
2720731

Is there a microcontroller/SoC available that's analogous to an 80s spec 8-bit microcomputer? I mostly want to learn assembly and mess around with device I/O, graphics, etc.

>> No.2720734

>>2720489
Raspi is overkill and probably more difficult to set up, unless you want to go full home automation or security camera setup. You’re better off going for a microcontroller board of some sort, doesn’t even need to be powerful at all. A ubiquitous 328P arduino nano clone would do the trick ($3), an ESP8266 would work if you wanted wifi.

>>2720618
I don’t think there’s ever been a case where I haven’t been writing code that interfaces with real-time devices. Motor driving with feedback, responding to analogue sensors, etc. I don’t know how easy it would be to simulate these.

>>2720731
FPGA board emulating a 6502 or Z80 or 8091 or whatever.

>> No.2720770

>>2720618
>most ineffective/inefficient way to do it.
Depends on the writer of the code.

>> No.2720858

>>2720622
>>2720770
In the early days of microcontrollers, you’d see guys standing around the water cooler chatting about how the six million dollar man’s real superpower was that he got Farrah Fawcett and other bullshit. Why? They were waiting for the UV to erase the eprom or blowing a new one every time they cycled on their “change something and see what happens” programming/debugging cycle[1]. They all got fired eventually.

Not using a debugger is like being a hardware guy, and having a $100,000 logic analyzer and a $100,000 scope sitting next to you in the lab, but you don’t know how to use them, so you solder LEDs or light bulbs in various places in an attempt to determine what the problem is.
You have free access to all these things. Do you those times when you’re trying to port a forth interpreter to a new microcontroller platform and you’d have killed for a simulator but it wasn’t available yet?

There’s no excuse, printf debugging is almost never appropriate. Learn your craft. I can’t believe people have no appreciation for the practically endless fount of essentially free stuff out there.

[1] The modern equivalent is the change multiple things/add printfs, compile/re-flash/re-test.

>> No.2720861

>>2720858
>there is only printf debugging or using a debugger
Actual retard detected.

>> No.2720932

Anyone know a good Youtube channel for embedded systems for beginners?

>> No.2720986

>>2720618
>Gdb is a horrible debugger, but it’s waaaay better than LLDB.
GDB has a "TUI" (text user interface) mode that is less unusable than the naked command line. I used it once with a bluepill project. It was unstable as fuck I could easily break it by doing the wrong thing, but still just usable enough that I could find my stupids with it. I kept a list of the commands to set it up that I could paste into it, because I had to restart it so much.
The main point about GDB is that you need a "server" that talks to your debug dongle (STLink, etc.) and then GDB talks to that. The GDB needs to be built as part of your cross-GCC, so it would be built as arm-eabi-gdb or something.

>> No.2721325
File: 700 KB, 2048x1459, agon-2579898411.jpg [View same] [iqdb] [saucenao] [google]
2721325

>>2720734
I came across this little unit, it runs an eZ80 at 18 MHz, 512k RAM, and uses an ESP32 for graphics and sound https://www.electronics-lab.com/meet-agon-light-a-microcontroller-and-a-microcomputer-in-one/
The board has GPIO pins too, so I could use it for all kinds of projects as well.

>> No.2721346

>>2721325
>it runs an eZ80 at 18 MHz

couple of big problems with this approach

1) to learn something in 2023 you need to be constantly googling your questions.
but you have no internet on this thing, so you're constantly jumping from one computer to the other.
as for copy/pasting, that's not happening so you're gonna have to *gasp* type out a lot of code without errors.

2) the software included is all gonna be written by 1 or 2 guys, so the quality and variety of software is gonna suck ass.

the easy solution is to go with a popular emulator on your PC which fixes all these frustrations.
e.g. C64 Vice emulator: https://www.youtube.com/watch?app=desktop&v=vviBPEPh_0w

this option is also completely free so it wont hurt so much when you give up on this programming nonsense, and start dating girls.

>> No.2721370

>>2721346
It comes preloaded with CP/M and BBC Basic, which already opens up a huge amount of legacy software, and people have ported Forth and other languages to it as well.

>> No.2721557

>>2721346
> googling in 2023
Almost useless. First three pages of results are ads and AI or Indian web pages full of verbal diarrhea.

I remember the early dev boards for the first 80386 and the 68000. You’d get these soft-cover books with everything you’d need to know. I still have some of them, they were invaluable. Definitely not grass level though. In those days there was definitely a “learn by doing” mentality. Maybe that’s the best way to learn. I was actually interested in my field back then, I’d take the books home and read them from cover to cover so I’d know what was in there so I could reference it quickly to look something up.

New CPUs today I know very little about, and it’s probably not possible to know that much about them. Do they even give the general public a pinout? It just seems like they give this information to motherboard manufacturers. Maybe. Like there’s these “security processors” that were discovered in them to make your CPU an on-line service.

>> No.2721564

>>2721325
It’s amazing they haven’t put these things into single chip solutions yet. Another prime candidate might be the IBM PC chipset—easy to fit that and 640K nowadays on a single die for, say $5. Think of the amount of software available for it. Maybe add USB and VGA support though.

>>2721370
6809 based systems had OS-9. Another head-scratcher as to why these kind of boards are not being produced. Again, easy to implement on a single die. Gonna go dust off my Vetrex and dream of what could have been.

>> No.2721821
File: 121 KB, 776x835, 20231203_213401.jpg [View same] [iqdb] [saucenao] [google]
2721821

>scrolling twitter
>see this
wtf are those chinks smoking?

>> No.2721824

>>2721821
>https://archive.md/EHIYh
>I'm just not ordinary me
>SG200x is a relatively new MPU processor with built-in ARM, RSIC-V and 8051. It also has 0.5T/1T computing power and ISP, 5M@30fps H.265/H.264 hardware encoding and decoding capabilities, and rich peripheral interfaces to meet the needs of open source hardware, AloT, security and other fields.
>SG200x supports dual operating systems running at the same time: the large core runs the Linux system, while the small core can run the FreeRTOS system at the same time.

>> No.2721839

>>2721824
> Multi-core ARM
Why the hell wouldn’t you just emulate the 8051. Makes no sense.
I was going to say, “why give royalties to pad intel’s profits for something like the 8051 hen they used to employ smart people” but the chinese don’t really care about that.

>> No.2721921

>>2721839
>8051
>royalties
It's been off-patent for decades, anon, that's why it still gets used so much.

>> No.2722227

>>2721821
No idea, but it's not an interesting chip in any event.
Sophon has some P650-based chip, with V1.0, coming next year, as well as atx-compatible boards. Q3 supposedly. Those are gonna be interesting.

>> No.2722302

Just got myself an ESP32-C6 dev-board to mess around with. One with two USB C sockets on it, one for programming and one for native USB projects. These native USB MCUs with bluetooth feel like they'd be really useful for making keyboards and mice and stuff like that, since you could choose either either. The older ESP32s also have native ethernet hardware, which with the wifi also makes them versatile networking peripherals, though the C6 lacks this ethernet hardware.

>> No.2722426

>>2720622
>I don't agree. printf debugging can be very effective. Yes, it's like tracing. But you can decide in code where and how much you trace.
I feel like this is true for programming on a proper OS.
But I think with hardware, debugging simple issues is a non problem, you can print it, you can attach a debugger to it, the REAL problems happen when you got those bugs where it will happen on release builds, but you can't reproduce it with a debug build.
It's less about debugger vs print statements, it's more about you can't use your debugger (effectively, reading assembly takes too much time), you could try to print data, but your print statement only makes sense if you print it at the top of a function, because if you can recreated the bug while disabling inlining, at least you can guarantee that the print statement won't teleport into a location outside the scope of the function (but you still don't know if the print statement happens before or after anything inside the function scope, unless there is a side effect that forces it to be ordered, aka printing a variable that isn't optimized out).

>> No.2722428

>>2722426
>I feel like this is true for programming on a proper OS.
cut that out, I don't know what I was trying to say.

>> No.2722430

>>2722426
I acknowledge the argument, but I don't agree with it. You probably want to use -Os for firmware, and in that mode the debugger tends to be annoying, often useless.
Minimizing the difference between the release and development version is a good idea. In my opinion the release version should only disable logging and maybe asserts, everything else should be exactly the same as during development.
What bugs due to differences between release and debug mode did you encounter?

>> No.2722437

>>2722428
Sounds like you were talking about something like WinDbg. And sure, lots of people think it’s hardcore to flash a led on a raspberry pi or latte panda.
I typically tend towards CISC microcontrollers and do everything in assembly so source debugging and breaking and listing the instructions at that point are one in the same. Also the debug build and the release build are also one in the same, because I wrote the code in C, saw how gawdawful
And bloated the optimized code was and rewrote it. This is a more effective use of the microcontroller.
I full-well realize that single-stepping through ARM or RISC-V (#RISCisDead) is a maddening experience, just like writing for it so C is a better choice.

>> No.2722442

I want to create a lighting automation program with my AB SLC500 PLC, the biggest issue is how would I implement a program or process to handle the dimming? I would prob use keypads for controlling and dimming the assigned light fixtures on each keypad which would be the input devices and ofc the switch legs would connect to the 120v outputs, not sure if I should implement any additional relays or devices in handling these tasks.

>> No.2722728
File: 469 KB, 1056x582, Screenshot 2023-12-05 153837.png [View same] [iqdb] [saucenao] [google]
2722728

>>2720489
My guess is that AAWM either bridged some connector in a way that's not obvious (since this is a wiring and not a circuit diagram, impossible to tell.) But it doesn't matter b/c you already figured out how to hotwire it, right?
Arduino board plus pic related. Power Vcc off something in there with DC power , 6-20V. Put the arduino in a project box, glue it shut, along with pic related, which are triple isolated from the arduino.
> t. just did machine automation project using same stack
>>2720586
> Literal rats nest.
Nice.

>> No.2722747

>>2722430
>What bugs due to differences between release and debug mode did you encounter?
memory issues is a very common situation, like corrupting the stack, or leaving variables uninitialized, there is also funny stuff that can happen due to misalignment (but this only applies to x86).
http://pzemtsov.github.io/2016/11/06/bug-story-alignment-on-x86.html
Generally most memory problems are solved using address sanitizer / etc, but you would need to be running linux to utilize it on hardware.
And with hardware you have a unique challenge of maybe the issue isn't from your code, it's due to a hardware related issue somehow messing with the CPU.
take this with a grain of salt I don't work with microcontrollers.

>> No.2722778

Suggestions for rfid transmitters that work well with small chips? Or perhaps a wifi equivalent?
I would like something that can communicate between a row of buttons and a central host. Everytime a button is pressed it transmits an 'On' signal via radio along with the identifier of its button number. So each button would need a small chip (PIC10?) with rfid tag attached.
The button may also receive an On/Off signal from the host and choose to then turn on/off.

>> No.2722797

>>2708990
IIRC BluePill is not accessible over USB by default (it may be possible but you'd need to flash it with another bootloader). Search for "stm32 blue pill datasheet" and/ or information on how to set the jumper pins to boot into programming mode. You will need an STLINK programmer to program and debug it.

>> No.2722826

>>2722227
P670. The one with V.
P650 is the version w/o V.

>> No.2722839

>>2722778
You could use an ESP8266 (maybe an ESP-01 board) using its wireless comms, probably the cheapest easy option. Right next to making a Schmitt oscillator for each button and just broadcasting each unique frequency carrier wave whenever the button is pressed, though I’m not sure what the receiving circuit would be like for that.

>> No.2722912

Chilean moss welding quora

>> No.2723285

>>2722839
>ESP8266
looks pretty neat, nice

>> No.2723405

>>2722778
Two JDY-41 might be enough without any other chips.

>> No.2723413
File: 16 KB, 200x356, fast erection switch.jpg [View same] [iqdb] [saucenao] [google]
2723413

TLDR: Would an opto-isolator (also called an optocoupler, photocoupler, or optical isolator according to Wikipedia) be the right way to electronically actuate a pushbutton on a pre-existing board?

Getting an old and busted sliding gate operator up and running. I'd like to be able to control it via another microcontroller without messing with the existing controller board more than necessary. There are little push buttons for Open/Close/Stop on the control board and I'm thinking of running a separate controller to "activate" the switches on the gate controller by running jumper wires to them and closing the switches via an optocoupler. Is this the right way to go about this? Am I over thinking this or is there a simpler way to do it? I know I could brute force it with a relay or even a solenoid, but that seems a bit overkill.

>> No.2723446

>>2723413
Yes, if the current that the existing buttons sink is less than what the optocoupler can switch without putting too much current through the LED or phototransistor inside the opto. Check the button’s pull-up resistor value to see what this current value is. A relay would also definitely work, and could handle a higher current. If you don’t need it to be electrically isolated, you have more freedom in using transistors instead, there are small signal transistors that can handle half an amp or more.

Personally an optocoupler is what I’d use if I were concerned about different power supplies and possible outside interference, but if the little MCU circuit or whatever is fully contained in the controller’s housing, is powered from the same source as the existing controller, and doesn’t have any electrical connections leading to outside the controller, I’d just use transistors.

>> No.2723447

>>2707804
Is there any fuckin way to add wifi to the teensy?
Really need it's power to drive a nice color display at a decent frame rate.
But I'm making a laptimer and want to be able to download logs from the device without plugging it in, reeeee.

My code runs at 15fps on the teensy at 40% CPU
4fps on the esp32 at 100% CPU

I'm also kind of retarded and this is my first microcontroller project, but I really really need this 1000nit display.

>> No.2723453

>>2723447
Just use an ESP8266 ESP-01 module as a wifi module. Or write more efficient code, Ben Heck crammed space invaders into an ATtiny10 using a bunch of tricks.

>> No.2723513
File: 10 KB, 340x187, zero crossing opto triac.jpg [View same] [iqdb] [saucenao] [google]
2723513

>>2723413
>Is this the right way to go about this?

nope.
optocouplers are DC devices, and you're working with AC.
you'd need an opto-triac instead.
fun fact: when you google opto-triacs, you get a lot of devices which are actually diacs (have 2 pins) not 3.
you use the diacs to trigger an external triac (3 pins). so, that's a bit of false advertising.
anyway, relays are always better, coz easy to understand, and troubleshoot. triacs are somewhat voodoo.

>> No.2723516
File: 1.95 MB, 2292x2636, 20231206_230521.jpg [View same] [iqdb] [saucenao] [google]
2723516

>>2723446
Thanks, I'll poke around the pull up/ down resistors before I commit, but at least it sounds like I'm on the right track. I just want to fuck with the main controller as little as possible and just "push" the manual override buttons with an ESP32 or something.
>>2723513
I'm only controlling the little electronic buttons on the right of the pic, not the AC mains going to the motor itself.

Need to replace the board but just planning out how to make future expansions (AKA FEATURE CREEP) work.

>> No.2723520

>>2723516
>little electronic buttons on the right of the pic

oh. so an opto-isolator could work.
but, because optos are polarized, you have to measure DC voltage across buttons to connect the opto right way around.
(another reason relays are better - they work both ways)

>> No.2723542

>>2723520
>another reason relays are better - they work both ways
>not using a photo-FET
>not using a vactrol
ngmi

>> No.2724347

>>2723447
get a pico... come to the green side

>> No.2724349

>>2724347
The pico is nominally less powerful than an ESP32, but you can overclock them.

>> No.2724426

>>2723447
Use a small SOC like Raspi zero 2 instead?

>> No.2724463

what, if any, micro-controllers that are actually used are completely free and open source. I mean full schematics, firmware, etc available and permissively licensed.

>> No.2724472

>>2724463
SuperH, and RISC-V for starters, off the top of my head.
Someone said 8051 is off patent, but that’s for masochists.
6502 and Z80 are popular, and probably off patent too.

>> No.2724473

>>2724463
There are some usable SoCs or SoC toolkits/generators for FPGA shit.

>>2724472
RISC-V is only an ISA with some open source implementations, but they don't have to be open source. SuperH is also an ISA, I don't know details.

>> No.2724491

>>2724472
>SuperH
No hobbyist uses it because they're expensive, despite being "open source" they're still being elitist about who uses their chips, which they can afford because only one company makes them. Well the chinks might make knockoffs, idk.

>8051
>6502 and Z80
Atmel does some 8051 clones with built-in RAM and progmem and usable GPIOs that aren't too bad to mess about with. Make sure to avoid the ones with one-time-programmable progmem just as you would to PICs. There are likely similar cases for Z80s and 6502s, though I don't know if any of these are in the sub-dollar range. Maybe the chinks do some?

RISC-V is the optimal point for openness and price as far as I can see. IIRC some of the core designs themselves are open source as well as the ISA they're built upon. Other cores are designed by the manufacturer who makes the MCU. The cores are not as standardised as ARM seems to be.

>> No.2724550
File: 2.04 MB, 4032x3024, IMG_0864.jpg [View same] [iqdb] [saucenao] [google]
2724550

Anyone here fuck around with FPGAs? Got this Altera DE II board for 50$. Manage to make a PWM and run a simple 16x2 LCD with it.
Thinking about making a simple function generator with it.

>> No.2724867
File: 30 KB, 700x700, 1000013238.jpg [View same] [iqdb] [saucenao] [google]
2724867

I have a seeed sense nrf5280. it has a USBC which is used to upload and it can also be used to recharge the attached lipo (you solder the lipo leads to battery pads on the bottom). once those pads are getting 2.7-4.2v the seeed runs.

is there any way to work in an on off switch that will still allow me to recharge the battery while I have the switch in the off position, but it isn't powering the seeed and turning it on?

I don't want to use a dedicated lipo charger breakout cause they are too big, space is an issue. but I have space for a few passives. maybe MOSFETs or something?

>> No.2724869

>>2724867
Find a schematic and see for yourself. With any luck there’s a fuse or some other component between the lithium cell and the MCU that’s easy enough to desolder and replace with wires going to a switch. Or maybe you could just have the MCU sense the switch and remain in sleep mode, where the current will be really low. I call that second plan the “fuck the hardware, I'll do it in software” route.

>> No.2724875

>>2724869
I've done the deep sleep route on other projects. I don't think that will work in this one because I need the switch to also turn off lipo power going to a 5v booster which powers a peripheral, I don't want that peripheral on if my system is in deep sleep or off. there's no enable pin on the peripheral.

there's no trace I can cut between the lipo and the charger IC. no enable pin on the MCU.

now we're getting into the territory of needing to put up diagrams, which is probably a bit much for here. if someone knows of a mosfet or similar solution and knows it's possible I'd be happy to then go look it up, but I don't think I'm googling the right things

>> No.2724907

>>2724875
Just use an external USB port and lipo charger then. Or design your boards yourself instead of using inflexible zoomer dev-boards.

>> No.2724962

>>2724550
Yeah.
iCE40 with open synth/place/route stack is fun.

>> No.2724974

>>2724550
I have a pair of old gameduino shields. Got them for free, I'll probably use one for retro games and stuff but they are general-purpose FPGAs I could use for a lot of things. Like maybe an SDR or piece of digital test equipment.

>> No.2725008

>>2724907
that's the next step, when I learn more. I think the difficult part is bootloader onto an MCU. never done that

>> No.2725046
File: 144 KB, 1439x1275, pepe_neutral.png [View same] [iqdb] [saucenao] [google]
2725046

i used to be (probably) the owner of the largest collection of MOS MCS6501s.

>> No.2725108

>>2725046
what happened to them all?

>> No.2725110

>>2724867
Does it even have PD?

>> No.2725747

My CH32V003 and CH32V203 dev-boards and raw chips and WCH-linkE arrived today. Didn't come with any jumper cables so I'll have to make my own. Any recommended development workflows? Looks like cnlohr's setup has support for debuggin with or without VScode, I'll try it without and see where I end up I think.

>> No.2725750
File: 2.40 MB, 3945x2607, swagger.jpg [View same] [iqdb] [saucenao] [google]
2725750

>>2725747

>> No.2725928

>>2724550

What IDE do you use for this board? Does it require a license?

>> No.2725938

>>2725928
Quartus II Web Edition ver 13.0. During install, you can pick to install the free, no license version.

>> No.2726201
File: 74 KB, 1058x1199, 617T65docCL._AC_SL1500_-2491017124.jpg [View same] [iqdb] [saucenao] [google]
2726201

I'm working on an android app that will let me save the 30s of video leading up to a keypress, so essentially a camera with 30s of buffer. I want to be able to send that keypress using e.g. one of those little bluetooth camera remotes. I've found that I can connect one to my phone and walk a pretty good distance away without losing the connection. But the PCB they all use includes a shutdown after ~90s, and if I wait too long before waking it up from the shutdown it won't reconnect to my phone until I bring it very close by again.

My theory for this is that there's some transmission power negotiation happening in bluetooth, and as I take the remote away from my phone the power gets kicked up to maintain a good SNR. But when the remote shuts down either android or the remote forgets the power level after a certain amount of time, and the devices can't see each other at the default power level. Is that about right?

Anyone have ideas for a fix? I've thought about
>find some android setting to max out the transmit power: I can't find one and it might be the remote that's going to a lower power
>find a remote that doesn't shut itself down: manufacturers don't really talk about this feature, so it may be a lot of work to find one. Unless anyone happens to have a recommendation?
>make one from an ESP32: actually not terribly hard, since the remote is just a keyboard with one button and I've found ESP32 keyboard code on github. But this is still a good bit of work I'd prefer to avoid

>> No.2726256

>>2725747
I'm using CNLohr's ch32003fun, and a text editor.
For programming and debugging over SDIO (single-wire) you only need 3 jumper cables: GND, VCC and SDIO.

>> No.2726312

Anyone with any MQTT experience? I want to control a fan using mqtt, but you only keep the connection to a broker for a certain amount of time. This means that if I want to go and change my fan speed after and hour... the microcontroller needs to reconnect to the broker... thus I have lag controlling a fucking fan. Any ideas?

>> No.2726332

>>2726256
Does that also work for the CH32V203, it doesn't look like it. I'd rather have a more unified development environment. Or this plus something that works similarly for the 203.

>> No.2726333

>>2726312
host your own custom mqtt broker or use something else. does it need to be wireless?

>> No.2726346

>>2726332
No, ch32v003fun is only for ch32v003.

>> No.2727082

>>2726312
Send PINGREQ to the broker within configured keepAlive interval to maintain connection. Or set keepAlive=0 on broker and the connection should stay alive indefinetely.

>> No.2727085

>>2726312
What’s the lag to send a udp packet? Like 1 ms maybe?

>> No.2727123

>>2727082
isnt it bad practice to do either of those things? Are those my only options?

>> No.2727213

>>2727123
keepAlive=0 maybe but I don't see how using keepalive feature of the protocol to keep a connection alive could be bad practice, it can be hours long.

>> No.2727488

>>2727213
im thinking more like 6 months long

>> No.2727494
File: 156 KB, 640x879, 1697175703732576.png [View same] [iqdb] [saucenao] [google]
2727494

I've got:
- ESP 32 Wroom
- analogue microphone
- piezo speaker (it says 927~9 on it, is that the impedance?, nothing else on it)
- breadboard

Can I make a shitty walkie-talkie, granted I have an unlimited supply of the above?

Talk to me like I'm a retard

>> No.2727534

>>2727494
short answer is yes
there are even projects that already do that
(for example https://github.com/atomic14/esp32-walkie-talkie))

with your available parts you will need other parts like an amplifier for the mic and transistor to drive the piezo besides assorted resistors and capacitors
using a piezo will probably sound like shit though since they usually have poor performance in low frequencies
On the programming side you can use multiple protocols for the communication (wifi/udp, espnow, websockets, your own protocol)

>> No.2727706

>>2727494
https://www.youtube.com/results?search_query=esp32+walkie+talkie

>> No.2727874

Feeling listless after a couple major failures. I got an ST MPU board hoping I could have some fun using advanced debugging tools to build a tiny OS, but that failed when I learned all the ST MPU tools require you to use their special linux distro. Then I got a Nucleo board figuring I could at least use STLink and have some fun there, maybe even learn RTOS, but when I got the board I found out that the STLink module was broken, and by the time I was able to figure it was the module itself I was outside the return period.

So now I'm just not sure what to do. I want to start doing embedded again, at least at a hobbyist level, but I feel like I'm forever going to be stuck debugging with das blinkenlights. How can I get into modern embedded development?

Also what hobby board should I use for adding smarts to a desk lamp?

>> No.2727939

>>2726312
use a mpu board that can run a web server that can control the ports directly. the can just connect to the web server and directly turn the fan off/on. example

https://www.circuits-diy.com/controlling-ac-fan-using-esp32-web-server/

>> No.2727963
File: 67 KB, 833x679, EC11.jpg [View same] [iqdb] [saucenao] [google]
2727963

I'm trying to use EC11. For some reason the gpio connected to B stays high while the other voltages seem okay. That is, "terminal B" and gpio A both drop when I turn it. The problem gpio is number 11 on esp32c3 which doesn't seem to be a special one. Resistances are as expected, there's no short between the gpio 11 and 3.3V or 5V. I don't know what else to try besides another gpio.

>> No.2728020
File: 79 KB, 1288x709, 1702599710447.jpg [View same] [iqdb] [saucenao] [google]
2728020

maybe try taking out the 10k like in the pic

>> No.2728027

>>2727874
screw the debugger for the time being. get yourself an stm32 that has native usb. they have by default a bootloader mode that will accept dfu over native usb (and other peripherals). you can use that, and the stcubeprogrammer to flash code, set other things like the option bits and fuses from a more lightweight interface. and im sure theres some command line tool that does this too. read up on it. keywords are: dfu usb, boorloader mode, boot0 pin

>> No.2728092

>>2728020
Shorting the resistor makes it trigger the brownout detector. I have a couple other gpios left hopefully it will be different.

>> No.2728096
File: 326 KB, 713x716, ST-NUCLEO-30009233F-568966571.png [View same] [iqdb] [saucenao] [google]
2728096

>>2728027
I guess I'm hesitent because I ordered picrel and the USB interface was fucking dead, lsusb wouldn't recognize it whatsoever

>> No.2728137

>>2728096
i cant tell which chip that is. but the usb at the top is the stlink. if that chip does have onboard PHY, itll be on the headers somewhere. you also need to have installed the stm32 usb drivers for so itll recognise it. heres my example: instead of ordering an overpriced nucleo, i got myself a stm32l433 48pin mcu. i then put that shit on a custom pcb with a power supply and a usb port hooked into the chips d+/d- lines. ive done this now numerous times on many different stm32 chips and i have never run into the issues youre describing.

>> No.2728145

>>2728137
It's a G0 family chip. I installed the USB rules. Ran through installation by the book, but as mentioned LSUSB was not changing its output depending on if the STLink was attached or detached. I think the STLink module itself is bad, but that just leaves me with a well featured board that has plenty of debugging capability.... none of which I can use.

>> No.2728320

>>2728145
Just buy a standalone STlink? It could also be a firmware problem that could be solved by reflagging the right firmware onto the on-board debugger. Which would also probably need an STIink.

>> No.2728338

>>2728320
ngl I forgot they sold standalone units. Looks like I'll be grabbing one then.

As a side note, I wonder if the Nu Link debuggers are worth using.

>> No.2728543
File: 3.37 MB, 5406x3094, 1702192672182692.jpg [View same] [iqdb] [saucenao] [google]
2728543

Anyone know a good youtube series/channel that teaches electronics and microcontrollers? I know enough from working on cars to have a rough understanding of basic electronics, but I'd like to know how to design my own circuits and make some devices for automating my house with arduinos and shit.

>> No.2728565

>>2728543
https://www.youtube.com/@BenHeckHacks
https://www.youtube.com/@ZackFreedman
https://www.youtube.com/@MakingStuffwithChrisDeHut
https://www.youtube.com/@matthiasrandomstuff2221

a few sorta related i like

>> No.2728689

My Treadmill quit working. I just bought it a year ago, used, from like 2014. Really good condition, but It seems one of the boards in the console went bad, it powers on and the backlight comes on but won't display anything and doesn't run.

I could just get an SCR and a bridge rectifier and control it with a potentiometer but I'd like to have programable buttons for different speeds or even control it from a touch screen. I'm sure I could do that with a raspberry pi or arduino or something but I don't have any programming experience and I'm not sure exactly how I'd implement it. Everything I see on youtube is people making a lathe using a treadmill motor and thats not exactly what I'm looking for. I want buttons for 1mph through 12mph and speed up and down buttons that go in increments of 1/10th mph. Also incline and decline Ideally. Could anyone point me in the right direction on what the best way to do this? I do enjoy projects like this and have some time off work for the holidays, I'm not just trying to do it because I'm cheap.

>> No.2728803

>>2728543
While not dealing with microcontrollers, Moritz Klein is brilliant at analogue circuits, Lantertronics is good too. Andreas Spiess is good at dealing educationally with microcontroller modules and such. Mitxela does a fair bit of microcontroller stuff for audio, he makes showcase videos and leaves the in-depth dive for his blog. Applied Science occasionally uses MCUs.

Also your pic reminds me of Sean Hodgins.

>> No.2728856

>>2728543
If only that Macwas a Lisa. Significantly more epic collection. The GRiD and the Lisp machine are pretty good though.

>> No.2728935
File: 295 KB, 1280x960, tumblr_98c4cd0739e6581cd011cf7699a786f8_aac59195_1280.jpg [View same] [iqdb] [saucenao] [google]
2728935

>>2728565
>>2728803
I'll check these channels out, thanks anons. Normally I'd just read a book on this kind of stuff, but it's a very dry subject and I want to follow some hands-on videos instead.

>>2728856
Between learning programming/assembly, 3D printing, and circuit design I'm kind of hoping to make some homebrew retro 8-bit style microcomputers or cyberdecks to run my projects, too. It's a period of computing that I feel nostalgia for but never experienced, I can only imagine how cool it was to have stuff like the TRS-80 Model 100 come onto the market and have all that processing power in a truly mobile computer for the first time.

>> No.2729080

>>2728689
Cut out the old broken controller board.
Use optocouplers for the incline and decline motors, and a motor driver like the L9110S to control the belt motor. The speed will be controlled with a PWM signal.
Use a microcontroller to control all of this (I'm partial to the Pi Pico), Unless you want a touch screen, then i'd use a Raspi 4/5. You can reuse most of the old buttons or use your own.

With no programming experience it'll be difficult but with raspberry products you can use Python which is the best language for beginners. I'd probably do a short online course to learn the basics first.

>> No.2729352
File: 29 KB, 381x382, 1691919687114327.jpg [View same] [iqdb] [saucenao] [google]
2729352

Given i would like to make a PCIe x1 card, is it a feasible idea to grab an existing PCIe to USB IC as middleman medium to make my card work without getting to much into PCIe specifics, or am i simplifying too much?
Just finished my first own /ohm/ project, a fan controller working with gyroid feedback instead of the usual full PWM.
Now my goal is to make it usable via USB, by writing my own driver. Given i get that far, i'd like to put the whole project into actual use in my server, which has lot of PCIe slots but rather non unoccupied USB ports. Which leads to the original question, as apparently PCIe is a feared fuck all implementation.

>> No.2729365

>>2729352
You'll need to write a driver for it at some point, so you'll need to learn a little bit at the very least.

>> No.2729385

>>2729352
Where to begin…
All I can tell you is that, at the point where you have to deal with PCIe or write drivers (USB or otherwise) is technical failure.

I assume the microcontroller is attached to the fan directly, and you’re not doing something crazy like trying to send real-time feedback into a desktop computer or something over USB or PCI.

>> No.2729571

>>2729352
do uart instead

>> No.2729611

>>2729365
>>2729385
>You'll need to write a driver for it at some point
>All I can tell you is that, at the point where you have to deal with PCIe or write drivers (USB or otherwise) is technical failure.
Good start, i guess.
>microcontroller is attached to the fan directly
Yes. It's basically RP2040 -> mosfet -> fan
>>2729571
You mean instead of USB?

>> No.2729687
File: 27 KB, 706x474, pcb.png [View same] [iqdb] [saucenao] [google]
2729687

With kicad I have a symbol for my MCU carrier board. I have 6 pins for ground, 2 pins for 5V and 3 pins for 3v3. If I connect the duplicated pins in the schematic, the PCB routing is almost right. That is, when I make a trace to connect to the 3V3, it doesn't matter which one. Only one of the three 3v3 pins has to be connected because they're already connected on the carrier board. In other words I want to get rid of my remaining white lines without adding traces.

>> No.2729698

>>2729687
try making them the same pin number. or add a design rule. or, get this, you could ignore it because who the fuck is going to be looking at your pcb source file? on fact its probably a good thing. or, another crazy idea. just fucking connect them again with a fatter trace.

>> No.2729790

>>2729611
I’ll assume it’s independently powered.
If it needs less than 500 mA than you could power it with USB.
Windows or Linux? So if you really wanted to use USB for some reason, the RP could minimally emulate a very common device like a keyboard or mouse.
I’ll assume you’re just going *to* the device to set the speed. I think there’s like 4 leds on a keyboard, and they are controlled by the host, so you could send sets of 4 bits to the RP to set that speed on a “special” keyboard. That’s the “done in an hour” version.

I also believe there is on WIndows a “generic” USB driver that you can use kind of like a COM port: i.e. just send and receive data to it, it’s been a long time since I was in the driver business.

> UART
The uart guy is right, that’s probably the easiest/best solution if your PC side can do UART.
Similarly, RS232, RS422/485 are also excellent solutions, but you’ll have to buy some silabs chips for that. We still don’t use FTDI due to the bricking incident.
You could also go SPI/I2C directly over short distances, but again, that won’t be coming directly out of a PC. UART is similarly going to be short distances, RSxxx is the good version of that.

Ethernet is a very good (especially with POE) general solution, but unless it’s built-in, it’s going to be very complicated to get together on a RP2040.

Drivers were always a scam, it costs $10s of k to get it certified on windows, so you *really* want to emulate an existing driver.

There are some PCs that come with GPIO and stuff, like the latte panda, it’s probably worth looking into a USB “I/O board” for your PC that can do everything you need, like GPIO (much like the ancient parallel port/LPTn), RS232, UART, RS422, I2C, IR (like the PCjr had), etc.

The amount of effort that has been spent to lock down PCs is astounding.

>> No.2729823

>>2729611
>You mean instead of USB?
Yes. A PCIE to UART card would be ideal, though PCIE to RS232 would still be pretty doable, you'd just need to decode it with a MAX232 or discretes. That way you can just give no shits about writing drivers snd just spit out bytes to the serial port via shell or python.

>>2729687
I do wish KiCAD understood the concept of internal connections.

>> No.2729899

>>2729687
>>2729698
Yes, you make the pins share the same net in the schematic symbol. I think you use the same net name for each shared pin or something.

>> No.2730026

>>2729698
The result is the same when I give all the 3V3 pins the same number in the footprint. Design rules look promising, but I'll just go with extra traces -- if I start ignoring the white lines I may leave something important unconnected.

>> No.2730053
File: 77 KB, 850x755, Capture.png [View same] [iqdb] [saucenao] [google]
2730053

I'm trying to figure out how the bandpass filters in the MSGEQ7 chip work. It's an old chip that takes in an audio signal then gives you the amplitude of seven different frequency ranges. Great for sound responsive projects.

Shouldn't a bandpass filter require at least two capacitors? One for a high pass filter and one for a low pass filter. That can't be built into a chip so the MSGEQ7 should need 14 external capacitors. Instead it's only got two (one for an anti-alias filter on the audio input and one for an RC clock oscillator). How is it managing to implement these bandpass filters without capacitors and what purpose does the clock input serve?

>> No.2730054
File: 67 KB, 847x756, Capture.png [View same] [iqdb] [saucenao] [google]
2730054

>>2730053

>> No.2730077

>>2730053
it most definitelty can be built into the chip using discrete transistor amplifier stages.

>> No.2730099

>>2730053
Clock is a clue on what this actually is
>https://en.wikipedia.org/wiki/Switched_capacitor
It's a clever way of using capacitors and switches to implement any transfer function. There are internal capacitors, but they are so small that silicon surface area is not a problem.

>> No.2730386

Prof told us our grades will be weighted such that doing our entire university project to spec will only give us a D, and we have to do "whatever we want" to reach A, with the grade being better the harder what we made is. What kinda crap can i pull off ? I'm good with programming but honestly i have no idea what to do after just being told "do something hard". We also have almost no component so robots and what not are out of the equation.
(For perspective, last year a group made a Google Dino Run bot by programming a keyboard driver and using a light diode. they got a C.)

>> No.2730421

>>2730386
It’s the same with most things.
In diving, you can’t get a gold medal by executing a belly flop regardless of how perfect it is.

>> No.2730423

>>2730053
Decap one and take a microscope photo of it and post results here.

>> No.2730425

>>2730421
i'm not saying the grading is unfair i just want ideas of what i could implement, i don't even need directions.
I thought about doing fluid simulations on an oled matrix display, which is kinda boring to do but very showy.

>> No.2730467

>>2730425
Fluid sim with an IMU chip connected to the display, that would make the liquid slosh about as you move it. Even better, make a POV display with a spinning LED system like Sean Hodgins’ Christmas tree. Or his stacked OLED display. Those cool rotary encoders with screens built in and haptic feedback by using a brushless motor look neat too.

>> No.2730491
File: 228 KB, 474x355, OIP.png [View same] [iqdb] [saucenao] [google]
2730491

>>2730386
Build a mini Eva controlled by VR body tracking.

>> No.2730531

>>2730491
this but make sure it smells like your mom

>> No.2730535

>>2730531
Why would you want a robot to smell like a fish market?

>> No.2730625

>>2730425
Put a few bmi160 and vibration motors on climbers or dancers. Record experienced ones, and then inexperienced ones try to play it back.

>> No.2730700

>>2730386
cow rfid tracker system with climate control integration might as well do home automation as well ie curtains lights door locks,
the bill gates dream discussed in 2005 magazine.
Cow trackers have a large margin of error but it is a starting point distance between sensors increases accuracy, rich and famous type shit easy excuse to chip your kid.
the dog gear is heavily marketed and price is stupid for the increased accuracy.
tech is marketable biz like walmart and target demanded from google for product location.
You want to buy x it navs you to the asile x steps down and shelf height. I propose a two axis version for home comfort. blinds are open only when you are using the window otherwise energy savings same with climate lights ect.

>> No.2730774
File: 75 KB, 580x600, 580px-Bierdeckel_programmer.jpg [View same] [iqdb] [saucenao] [google]
2730774

Here's your avr programmer, bro.

>> No.2730968
File: 18 KB, 582x408, afsasdadsg.png [View same] [iqdb] [saucenao] [google]
2730968

Guys, i have this code, i'm trying to make it so that it adds +1 to the low threshold value of the if condition, but for some reason it isn't working. I also tried giving the variable threshold the value of low target + 1 and adding an || on the if condition but it didn't work either.

>> No.2730970
File: 12 KB, 582x291, gfefdggfds.png [View same] [iqdb] [saucenao] [google]
2730970

>>2730968
Here's the part where threshold value changes.

>> No.2730975

>>2730970
use Serial to print stuff out until you get the math to work. waterrealy and waterrelay seem to be the same but are spelled differently. what compiler let that get past?

>> No.2730992

>>2730975
It's the same, i had to edit some stuff out of the notepad and that got away.

>> No.2731021

>>2730968
I can't read prose without part of speech highlighting. Is water temp unsigned by mistake?

>> No.2731030

>>2731021
No, all good with watertemp,

>> No.2731107

>>2730968
I'm kinda retarded, but I'd put parentheses around the "lowTarget + threshold", in order to enforce order of operations.

>> No.2731111

any recommendations for cheap thermal imagers? i want to use it with my raspberry pi, so it would be nice if it has a easy design that lets me use wires without soldering anything

>> No.2731136

.>>2731111
What's your project idea? They cost 10x as much as other sensors.

>> No.2731152

>>2731136
i want to make an aim-9 sidewinder

>> No.2731247

>>2731107
Didn't work either

>> No.2731359

>>2730968
Isolate the actual problem instead of assuming addition is broken. Whatever your problem is it's not that x + y doesn't work.

>> No.2731420

>>2731111
I think you can use a PIR sensor if I’m not mistaken. The resolution is like 4 pixels but if you put it on a servo and scan around you can develop a picture if you needed to.

>>2731152
> sidewinder
If you live in the US they limit the FPS of such sensors to 7 FPS so you can’t make a heat seeking missile. Of course the chinese don’t care about that so they only end up preventing US citizens from making one. They aldo don’t want anyone to have real-time night vision capabilities, for the same reasons body armour is banned.

Likewise they try and embargo/limit/blockade some country’s ability to import playstations, even as far back as the PS2 since the graphics engines and cpu were capable of being used to make a ground tracking guided missile.

This is why we can’t have nice things.

>> No.2731464

>>2731152
Just make one using the original style of rotary thermal sensor. You can probably use a conventional PIR sensor as the element.

>> No.2731480

Hello gents. Id like the cheapest way to make text to speech please.

>> No.2731550

>>2731480
flite on esp32

>> No.2731559

>>2731480
Get a speak ‘n spell from goodwill.
Radio Shack sells the GI chip for it, failing that.

>> No.2731621

>>2731420
that's gay as heck. is it easy to buy a good chink sensor, or do customs catch it?

>> No.2731623

>>2731464
any resources to learn how it works? there's pretty much nothing on youtube that shows how the gimbal was used to scan. i also don't get what the point of the reticle patterns are for. this article touches on it, but animations would be nice
https://ausairpower.net/TE-IR-Guidance.html

>> No.2731661

>>2731621
Not long ago I was able to buy a chinese thermal camera that well exceeds the restrictions on US manufacturers, had no customs issues.
Infiray P2 for anyone wondering. The high framerate was too tempting.

>> No.2731674

>>2731623
Look for patent documents or a thorough teardown on someone's blog. You could also look for documents on how the russian copy worked.

>> No.2731689

>>2731674
this animation gives me a good idea, i can probably have a wide FOV radar style scan to move the cheap sensor around, and then narrow the FOV of the scan when i lock onto a target. then i can increase the FOV as the source gets bigger
https://youtu.be/n34w_-O6FOQ?t=126
anyways, i am getting ahead of myself. i still haven't done any research on gimbals i can use

>> No.2731924
File: 155 KB, 1102x471, Screenshot 2023-12-23 004407.png [View same] [iqdb] [saucenao] [google]
2731924

https://www.tag-connect.com/product/tc2030-ctx-nl-stdc14-for-use-with-stm32-processors-with-stlink-v3
Do they have a monopoly on this type of connector? I hoped there would be some chinky imitators

>> No.2731943

>>2731924
Make one on a PCB with pogo-pins soldered to it. For my 3-pin UPDI programmer I just modified a clothes peg, no pogo-pins required. Would likely be fine for 4 pins too, but for 5+ pins I think pogo pins are a requirement.

>> No.2732022

>>2731943
Can you and I DIY something that can attach to the PCB so both hands are free?
Tag-connect makes these accessories
https://www.tag-connect.com/product/tc2030-retaining-clip-board-3-pack

>> No.2732252

>>2731924
just make your own connector

>> No.2732265

>>2732252
Why didn't I think of that? I feel so stupid now.

>> No.2733333

>>2733332
>>2733332
>>2733332
NEW THREAD