[ 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: 123 KB, 1490x872, Evolution.png [View same] [iqdb] [saucenao] [google]
2491169 No.2491169 [Reply] [Original]

Previous thread:>>2463383

Here we discuss microcontrollers, SBCs and microcontroller accessories, such as Atmel mega and tiny AVRs (Arduinos), PICs, ARM boards such as blue/black pill STM32, ESP8266/32s, 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 or mouser'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

>> No.2491176

>>2491169
Prototype project list incoming. I'll split it into categories and difficulty levels:
category (easy, medium, hard)
>retro computing (6502 terminal, maybe make a NES game, Apple II?)
>low-power automation (simple sensor reading and response, sensor reading and communication, RF datalogging with power saving?)
>intense computation (high data throughput)
>logic (traffic light idk, speedy shift register muxing/demuxing, FPGAs)
>analogue-digital interfaces (midi synth, Z-transforms, FFTs)
>human interfaces (mech keyb, controller/joystick, VR/FPV hardware)
>RF (simple 2-symbol keying, QAM, SDR)

But it feels like I'm conflating difficulty and category a lot. Like they should be a tree instead, only branching out after the easy stages. Traffic lights and a 6502 terminal are not equivalent. Feedback welcome.

Also does that box on the right op the OP pic turn an 8-bit binary number into 3 BCD numbers? Can you buy that? It's pretty nontrivial last I checked, I can see why Ben Eater just went for hex-to-7-seg.

>> No.2491179

Do you use some simulator or do unit tests?
I think it might be somewhat useful if the firmware was structured in a way that you could run part of it on pc.
My code just uses the peripherals and then there is the sdk so I don't really think making unit tests is feasible...
I'm starting to think that I will just setup one test device to laptop and make the laptop poll our git, build the new firmware, run it and maybe send emails if it fails.

>> No.2491181

>>2491179
Dedicated IDEs like MPLABX (not recommended) can do step-by-step execution simulations, I assume you can feed them inputs from peripherals that don't exist. Even if that means writing those inputs manually.

>> No.2491186

>>2491181
Tried the segger studio simulation with real project but it didn't even get to main.
With new simple project it worked okay.
The simulator also runs on command line with emSim which is nice.
I don't think I'm going to use for automating tests though.

>> No.2491259

>>2491179
using a debugger you can achieve something like a unit test. but it requires designing your code with it in mind. so, make a unit test state machine that runs through a bunch of functions with a break point set at the end. with a debugger you can modify volatile type variables (state variable) during the time when the cpu is halted. then hit continue to run the functionality you want to check. if youre using an rtos this is even easier because you can have a unit test thread/task.

>> No.2491332

I am fairly new to microcontrollers. I would like to make my own alarm clock, coding in C (or a non-Arduino language), as follows:
> 1 small screen to set alarm time, with 2 arrows to navigate by minutes and a 'SET" button
> 1 small screen to reflect the current time, again with 2 arrow buttons to adjust by minutes (possibly a button to adjust hours as well but not necessary).
> A mini-speaker to play alarm melody (Maybe a beep device at first and later something that supports an mp3 file)

The arrow buttons will work as interrupts on the main loop. Unmolested the main loop would increment the time by seconds using some oscillator thing, and send the signal to sound the alarm to the necessary component when the time is right.
Are there any ready-made components you would suggest? Or how would you suggest I go through with this project, especially hardware-wise? The only experience I have had to-date is some slight tweaking with ancient (pre-Harmony) PIC boards.

>> No.2491357

>>2491332
I think the screen determines which kind of MCU you can use, they might require lot of pins.
There are screens with i2c and spi interfaces though.
Playing piezo buzzer is easy using PWM and you can do simple tunes.
I don't think you can play straight mp3, you would need to convert it to pcm audio and then convert it to C array.
For real audio sample piezo buzzer won't be enough, you would need a speaker.

What you are doing is pretty simple and you can find lot of stuff if just google "screen arduino". Even if you don't plan to use arduino.

For the MCU, if you don't use arduino SDK you might have to write the screen and speaker driver yourself.
It might be ~1000 lines so it's not that big of a issue.
You might still want to choose the screen for chip that you know there is a driver already in github or in the vendors own libraries.
You are going to build it with breadboard first? I think you want to choose MCU with dip-legs.
Remember to make sure how the MCU is flashed and that you can get cheap flasher for it if you don't have one.

>> No.2491369

>>2491332
Increment the time and set a timeChanged flag in an interrupt from a timer.
In main, update the display if the flag is set.

>> No.2491400

>>2491357
thanks for the piezo buzzer idea, that'll be adequate for sound for now
> breadboards
i'll use them if I must, but i'd prefer ready-made circuit boards for which i would just have to program and maybe make some minor hardware adjustments

>>2491369
sure, for now I am just at the stage of acquiring hardware parts

>> No.2491410

>>2491400
>i'd prefer ready-made circuit boards for which i would just have to program and maybe make some minor hardware adjustments
I think then try to look into development boards with screen included, the buttons and buzzer are easy to add.
Depending on how much you are planning to use...
For esp32 there is m5stack https://m5stack.com/..
It has battery, buttons and screen.
I think some version have buzzer build in.
You might find cheaper dev boards from aliexpress

>> No.2491444

FYI, if you don't like your clock losing a second or two every month, find a chip with a clock trim register. The STM32F10x has one.

>> No.2491453

>>2491357
>you would need a speaker
Be kinda fun to use a speaker, but ditch the audio DAC in favour of 3 square channels and a noise channel like a NES.

>>2491444
>not using GPS

>> No.2491560
File: 97 KB, 598x602, mm3pu22-SCPH-750x.jpg [View same] [iqdb] [saucenao] [google]
2491560

>PS1 modchips (repost one)
i would like to DIY a modchip from basically trash, a PIC12F510, pulled from a satellite dish head (the one of the smaller boards that has low frequency/control stuff on it) but the hex file is for an PIC12F508, and microchip's website refers to PIC12C5xx as all mostly the same... so i am wondering about compatibility of "MultiMode 3 USA.hex" ment for a PIC12F508, with the salvaged PIC12F510 and would it work

>/g/ was no help at all
go figure, useless consoomer board

>> No.2491596

>>2491560
Well that F means it's got flash (alas I still find C chips in my e-trash), so it's not like it could hurt to try. As long as it uses the same CPU core and has similar I/O, it should be fine. PS1 mod chips just bit bang as far as I know, so it's not like you have to get real specific with the I/O. But with a chip that's not 8 pins you still need to look up which pin is which.
Most of those firmwares have the code available so you can try to figure out what's happening.

>> No.2491618

>>2491560
Worst case scenario you can open it with a hex editor and change an address or two. Which sounds fun but really hacky.

>> No.2491784

What would it take to get driving a motor with one of these?
https://www.farnell.com/datasheets/3758325.pdf
I kinda want to buy some and make motor drivers with them, but I'm afraid I'll get there and be unable to program them to do what I want. ARM scares me.

>> No.2491790

>>2491784
It would be a good idea to get the eval board first and familiarize yourself with software part. Last thing you want is to try and learn software part when you did the PCB completely wrong. But eval board is expensive so it could be cheaper to build multiple revisions before it would become cost effective.

>> No.2491798

>>2491560
probably completely incompatible since presumably you don't have any idea about what is on the hex file? what parts of it need to be the same. so you have to assume all parts need to be the same. so why would they make two chips exactly the same?
the datasheets are completely free to download, check out the registers and memory maps, have a look through the hex file and figure out what its doing, what registers it touches, check these registers are the same between devices.
pretty simple.

>> No.2491866

For something like Vivado, do I actually have to write the test bench? Like there isn't a Bitstream randomizer?

>> No.2491870

>>2491866
Vivado has some pre-made components or you can make randomizer yourself.
But yes, you pretty much always have to write test bench for your components.

>> No.2491884

>>2491870
ah fuck, do you have any particular reccomendations for writing them

>> No.2491889

>>2491884
I don't have that much experience with vhdl/verilog.
I wrote the components and test benchs first for ghdl which is simulator that I could run from command line.
I used emacs and I made few functions to generate the test bench template from the component definition.

If you have asynchronous processes, you might want to test with different clock frequencies.

>> No.2492040

>>2491790
I etch my own, should be possible to make a bunch of revisions and desolder the ICs from the wrong ones if I get my reflow plate up and running. Just don’t put any components on the back side, or use any THTs at all.

It’s more the ARM I’m worried about than the physical hardware. The thing says it can do FOC (what I need) but I suspect it isn’t plug-and-play at all. It’s half motor gate driver and half Infineon XMC1404 ARM MCU, and I don’t really know how I’d go about programming it. Both software and hardware. I’ll have a better look for evaluation boards or appnotes later.

The alternative is using a 3-phase gate driver (or 3 half-bridge gate drivers) controlled by an MCU of my choice (ATmega128), which would be a lot easier but probably more limiting. I think I can still get FOC from that though.
Also if I use a parallel value for position sensing, I could write the logic table into an EEPROM. That’s a kinda strange idea. Just use a small AVR for handling temperature sensing and fault finding, and the position-sensing ADCs that output an angle value to the logic table. The PWM would be frequency dependant, but maybe that’s a good thing.

>> No.2492070

>>2492040
>and I don’t really know how I’d go about programming it
Well it's cortex M0, so gcc will work. For programming it speaks SWD which is also standard across ARM devices. It allows you to program and debug with breakpoints, inspecting memory, registers... You need to have something like J-link from segger if you want a plug and play experience, otherwise there are many china jtag dongles (openocd based) on the markets, but I'm not sure how difficult would it be to set them up with Infineon's IDE. You can always revert to makefiles and just steal their HAL, libraries, register definition headers and startup code. Any tutorial for arm m0 will work only difference will be additional hardware that's present on that chip. It's a bit more complicated than atmegas because processor itself has a lot more features (1000+ page programming manual vs 300 for atmega).

>> No.2492172

>>2492070
What about the software end for actually pushing data to the programmer? Is it just Segger's own "J-Link Commander" software? Can't figure out if it will run on linux, which probably means it doesn't. I'll look into alternatives for both the hardware and software side, but for now I think I'll stick to using AVRs. I've figured out a data flow that should be relatively easy, using two seperate MCUs and some discrete 3-phase or half-bridge gate drivers.

>> No.2492206

>>2492172
jlink has their own command line tool for linux that is as simple as
>jlink
>flash
after setting up the interface type and speed

>> No.2492237

Few questions.

1. I was cleaning out some drawers that had electronics shit in it, and obviously they are covered in dust, some of these modules are small and wiping them is ineffective, and using compressed air will just make them fly out of my hand, is there a liquid I can use that safe to "bath" them essentially?

2. Any good clones for chips used on arduino, and STMxx chips? I found out about gigadevice since its being used in a controller board in one of my 3d printers, and want to know more good clones to look for.

>> No.2492386
File: 330 KB, 1488x1166, attiny new parts.png [View same] [iqdb] [saucenao] [google]
2492386

>>2492237
Isopropyl alcohol should do a reasonably good job. A bath in an ultrasonic cleaner is what I'd do if that fails.

>Any good clones for chips used on arduino, and STMxx chips
For STM32 clones just search "32F103" on LCSC and watch the results roll in. I think most of the ones there should be fine in quality, but you'd be best off picking one with a legible datasheet and no significant deviations from the chip being cloned. That said, Gigadevice and WCH also do RISC-V versions of the STM32s (GD32V and CH32V respectively) which may be worth checking out. No clue what kind of hardware and software you need to program them though.

I've never seen an AVR ripoff. If you're after AVRs that are cheap and in stock, look for pic related. Comparable specs to the older ATmega series. This new series needs a different programmer compared to the USBasp of yesteryear (just a USB-to-UART bridge with added resistors). I've had good experiences with them for the most part, but they're still a bit finicky to get working via AVR-gcc (needed to copy files from MPLABX), especially when trying to use their progmem.

>> No.2492442

>>2492386
>I've never seen an AVR ripoff. If you're after AVRs that are cheap and in stock, look for pic related. Comparable specs to the older ATmega series

Thanks anon, when I saw this
https://www.aliexpress.us/item/3256804044855489.html

I read comments, and by the naming scheme that its possibly a clone of a atmega328, and it had me think what other kind of clones I could get.

Thanks for the pic, I have been curious about other attiny other than the 85.

>> No.2492523

>>2492442
I can’t find that MCU being sold anywhere than AliExpress. While it’s probably legit, I’d avoid it for the small chance of getting fakes, and because the programming hardware seems a little nebulous at the moment. If you’re just programming via USB, or otherwise already want to make a USB-to-UART project, there isn’t really anything wrong with them.

See also:
https://ww1.microchip.com/downloads/en/DeviceDoc/30010135E.pdf

>> No.2492571

I'm not sure where to ask this, but I guess I'll try asking here.

Does anyone know of a device that can be controlled by a PC that emulates a USB keyboard? I want to control another PC with my main PC to run some scripts and automate some things with a hardware solution only as I will not be allowed to install software on the other PCs. In other words, on my main PC, I write a program telling it to type 'foo' and the device sends 'foo' keystrokes via USB to the other PC.

I could use one of my Pis for this, but given how hard they are to get nowadays I don't really want to waste one if there's an off the shelf product like this.

>> No.2492594

>>2492571
A variety of MCUs much cheaper and more available than a raspi will do this with some work. Easiest would be an Arduino Pro Micro, Leonardo, or Lillypad, as these have the ATmega32U4 chip on them which can handle native USB. ESP32s (bluepill/blackpill) and Teensys also have native USB. Then depending on the range you want you'll have to figure out some sort of communication protocol from the controlling computer to the MCU. If it's only a few meters I'd use a cheap USB-to-UART cable, if it's longer you may have to use RS485 or ethernet, both of which would require extra hardware on the MCU end. Ethernet has the advantage of being able to use existing networking hardware, allowing you to avoid routing extra wires or even control it fully remotely, with sufficient security that is. The same applies to using wifi via something like an ESP32S2, or just one of the aforementioned dev-boards with an added wifi module.

>> No.2492638

I want two MCs to communicate with each other. Say one MC has output pin connected to other's input pin. How much of a delay I should expect after setting that pin and receiving "true" on other MC's input?

>> No.2492734

>>2492638
>How much of a delay I should expect

the sending chip will probably have a turn on time in the nanoseconds, let's say 11.27 ns
then the signal travels along a wire at 2/3 light speed, so calculate that and add.
then the receiving chip will have a turn on time similar to the sending chip's
but all of that is nothing: what's really really gonna matter is how often the CPU is polling the receiving pin.
this delay could be like 10000x the other delays.
it'll help if the receiver has an interrupt, but that still takes much longer to service than the electrical delays.

>> No.2492761

>>2492734
Some MCUs have asynchronous interrupts, though I'm unsure what those are actually useful for.

>> No.2492814

i wanted to buy a few more rasperries recently and all shops have them out of stock how come?
is there some gay ass chip shortage again?

>> No.2492815

>>2492814
>is there some gay ass chip shortage again?
Always has been.

>> No.2492816

>>2492815
but rasperries were always in stock here until recently

>> No.2492817

>>2492816
Just a delay from the actual worldwide market. They've been out of stock globally for a year or two.

>> No.2492818

>>2492817
getting really tired of this shit
can't buy fucking atmega328p for years unless i want to risk buying shitty ones from chinks and now this

>> No.2492820

>>2492818
Buy an AVR that isn't a hot meme by tarduinos, much more likely to be in stock.

>> No.2492990

>>2492820
Any suggestions?

>> No.2492996

>>2492990
Literally any part that isn't 20 years old.
The DA series has some nice features, and the timers were redone to get rid of most of the legacy cruft.

>> No.2493068

I got a book on 8051/83C552 microcontrollers
Is it any useful nowadays or should I spend my time reading on newer hardware instead?

>> No.2493082

>>2493068
8051 MCUs are like cockroaches.
There's probably a couple of them near you right now, hiding inside unmarked epoxy blobs or unmarked chips.
It's probably a good thing to know if you ever wind up trying to hack some hardware, but there are better option for MCUs if you're making something from new.

>> No.2493145

>>2492990
see the pdf here >>2492523
and the png here >>2492386

>> No.2493396
File: 43 KB, 1200x900, deck.png [View same] [iqdb] [saucenao] [google]
2493396

I'm looking at building a handheld UMPC/oscilliscope out of a raspi 4 and an espotek labrador, but aside from a knowledge of automotive electronics I'm out of my depth.
My goals are:
>battery powered, with the ability for the OS to see the battery charge capacity
>salvaged netbook/custom keyboard that has a small form factor
>trackpad or mini trackball, maybe thumbstick
>wifi and 4g connectivity
>screen with adjustable brightness

How would I go about making this work?
I doubt the keyboard and trackpad will be USB compatible, will I be able to run them off the GPIO pins? Is there some kind of battery controller available that gives a digital output of the state of charge of the batteries?

>> No.2493697
File: 44 KB, 1240x837, file.png [View same] [iqdb] [saucenao] [google]
2493697

>>2492734
I will do the pooling myself as well so that part does not matter. I am planning a communication like pic related. Each MC has a one input and one output pins that connects to other MC's corresponding pins.

MC1 will pull its output high when there is data and when MC2 is ready to receive it, it will send the a square signal and using that signal two will sync with each other

Basically I need to ensure that MC2 sleeps enough before flipping the square signal

I think this is basically SPI, but it is only one way communication, which is what I need

>> No.2493702

anybody got project ideas? Im not very creative and I've just wrote drivers for random peripherals.

>> No.2493731

Can you program attiny (or similar chips) via 3.3v? Using arduino (or any other ISP programmer I guess)?

Those MCs often works at 3.3V as well but for some reason all tutorials tells using 5V fur supplying attiny

>> No.2493900

>>2493731
In your mind, you must seperate between "arduino projects" as made by morons, "ATtiny85 or ATmega328P projects" as made by midwits, and "AVR projects" as made by actual humans. Only the latter is going to actually be thought out and free of the cancer that is the bootloader. Fritzing is a red flag.

Look up the datasheet of your AVR. Chances are it can run at 3.3V, but reference the safe-operating-area (SOA) graph to ensure that you're not setting the clock fuses to be too fast.
See:
>https://eleccelerator.com/fusecalc/fusecalc.php

A programmer like the USBasp has 3 pins with a jumper that can be either in the 5V position or the 3.3V position. Some care should be taken when designing your circuit not to put a reverse voltage across a linear regulator, and not to backfeed current into something that's powering it as you program it at the same time.
This is more troublesome when it comes to UPDI programming, as not many USB-to-UART bridges have a switch from 3.3V to 5V. So I'd advise making your own.

>> No.2494062

>>2492594
Are the SAMD21 (seeed XIAO) better? Specs seem better, price isn't much different, keyboard lib seems to work with SAMD or 32U4. Form factor is also better in this case.

Also I'm retarded and I never understand why UART and RS485 have different numbers of pins for different boards/dongles/cables. For a 4-pin UART, RX to TX and TX to RX obviously. Does VCC (and ground) go to the power supply on the arduino? If VCC is plugged into 3.3v, does that mean RX and TX are 3.3v? Someone said that I need to work with 3.3v and not 5v logic with the MCU I'm looking at but all the UART arduino examples I find are just connecting 2 arduinos.

If I have this right it should be a pretty compact package with just the XIAO and USB to UART. USB-UART VCC to XIAO 3.3v, GND TO GND and RX to TX and TX to RX. Is that right?

>> No.2494069

>>2494062
If you can get the programming hardware and software sorted, go for it. IIRC the SAMD series has some arduino support, so chances are there are also other FOSS toolchains available to you that are somewhat mature.
>Does VCC (and ground) go to the power supply on the arduino
If there is a stable power supply on the MCU end, you can leave VCC disconnected. In your case there should be, but I'd consider adding diodes from both USB 5Vs to a 3.3V LDO that powers the MCU just so it's powered regardless of which computer is plugged in or turned on first. Not sure what the USB-UART IC will do when the computer it's plugged into is off, probably nothing bad but I'm not entirely sure. Read the datasheet.
Always keep GND connected.
>If VCC is plugged into 3.3v, does that mean RX and TX are 3.3v
Yes, if the circuit is designed right. For my one, I just read the datasheet for the CH340G, and the thing comes with the option of either 5V or 3.3V output, such that a single jumper could change both the VCC output and the logic level output at the same time.

>RX to TX and TX to RX
I got it around the wrong way once. I much prefer MISO/MOSI terminology.

>> No.2494228

>>2494069
>I much prefer MISO/MOSI terminology.

Master Out Slave In
Master In Slave Out

i like coz it makes my nig co-workers seethe.

>> No.2494492

>>2493396
>wifi
your rpi4 should have it build in, just need an antenna perhaps
>4g
you need to buy an external module for it that has the interface the rpi needs - pretty expensive
>keyboard
all keyboards use hid, should be fine
>trackpad/ball
they also use hid (mouse class)
>screen
most lcds with rpis have brightness control as standard. only thing you might need is a sensor to measure light level
>battery controller
most charge controllers have some sort of analog output pin which will give you a voltage depending on the charge level of the batteries. failing that, some have status pins telling you if its charging or not charging and you can probe the batterues directly. rpi has some adc on it so it should be fine (just keep your voltage levels in check)

>> No.2494495

>>2494492
do you think it's worthwhile to run an ofs nas as a main nas?
i still have an rpi3 as main nas for the bridge

>> No.2494497

>>2494228
the fact is it's there, fix it or fuck off
it breaks legacy a lot

>> No.2494507

>>2494492
>all keyboards use hid, should be fine
>they also use hid (mouse class)
Even internal laptop ones? Because they're the kind of compact thing you'd want to put into a UMPC.

>> No.2494508

>>2491169
Besides trueType, which works, so thanks.
There's not much alternative to AutoCad on a consumer level.

>> No.2494516

>>2494508
Huh?

>> No.2494517

Do people really fiddle with dupont wires every time they want to program or debug with their chinky ST link?
It amazes me that the chinks don't sell a real cable to go with it

>> No.2494622

>>2494507
you can confirm that yourself by checking device manager. i dont have one on me right now to do so

>> No.2494623

>>2494517
no. i cut the stlink v2 off a nucleo board and made an adapter board for it so that it can play straight into both the pc and the mcu that im debugging/flashing

>> No.2494625

>>2494622
If this blog is anything to go by, there’s just row and column outputs, though it is for an older laptop:
https://larsee.com/blog/2018/06/thinkpad-usb-keyboard-adapter/
I mean, there might be a USB encoder on the laptop man board, but considering this anon would be plugging the keyboard into something directly, he won’t have that.

>> No.2494644

>>2494517
I tape together some F-F wires and leave them plugged into the header of a bluepill board, and also the other end if I'm using a gumstick STLink. But I need the reset too, so I have that wired nearby to a right-angle header pin in the breadboard. Then with some of those gumstick clones I have to go in and rewire the reset for it because they bring out STM8 reset instead.
And then I stick a cheap USB hub in with everything, especially if I'll be using a USB serial adapter too. For maximum cool, put the breadboard on the outside of a box and hide everything inside, with just the USB wire sticking out.

>> No.2494651

>>2494623
What cable/connectors do you use on the mcu side of the adapter?
>>2494644
I was wondering about the reset on the gumsticks, is it not strictly necessary for stm32? When do you need it? All the gumsticks I could find are advertised as stm8/stm32, so I assume it's the stm8 reset on their pinout

>> No.2494656

>>2494651
You don't need it when just pushing a firmware load, but apparently you need it for a debugger to reset the chip. Arduweenies don't have debug support, so they don't need the reset.
What boggles me is how ST decided that STM8 and STM32 needed separate reset pins on the STLink.

>> No.2494660

>>2494656
And here I thought the chink links were a cheap and easy way to get debug capability, but that was apparently too much to hope for. Those redundant gnd/3v3/5v pins must be super important in chinese industry somehow.

>> No.2494669

>>2494660
It took me like 15 minutes to rewire the reset pin in a gumstick. The hard part was that the reset pin connection snaked around that tiny board, so I had to be triple sure by beeping out the traces.
Or you could just get a real STLink v2. (I've seen info about the V3 and you don't get much for the extra price on the deluxe model unless you're using the SWO an sheeit.)

>> No.2494859

Easiest way to make a microcontroller trigger an interrupt only when it detects atleast 3 squarewaves of a certain frequency?

>> No.2494886

>>2494859
Idk, does your microcontroller have an interrupt for this? Does it have hardware to detect square waves for you? If neither of this is true, you'll just have to fire a timer interrupt at a regular interval at least 2x (preferably 4x) faster than your target square wave, sample the three lines, calculate the frequency based on that, and call your function if it gets within your target range. Of course, the faster the signal, the more CPU time this'll hog, but it's the only "universal" way I can think of.
If you have pin change interrupts, make sure you have three *separate* interrupts to avoid not being able to tell when two pins go up at the same time, count how many times they've triggered and every so often divide them by the elapsed time and reset them for a new sample. On some microcontrollers you can connect pin change interrupts to incrementing counters, like on the nRF52 with PPI, or probably on the RP2040 with its PIO system. Both of these avoid hogging the CPU on every pin change.
And of course, all of this is assuming your square wave is even within a frequency range your microcontroller can sample at all.

>> No.2494890

>>2494859
cascaded 555 timers lmao

>> No.2494979

Babbys first steps away from Arduino, Im putting an atmega328p on my own board, planning on powering with SMPS. Do I need a voltage regulator or will a phat cap suffice?

>> No.2494996

>>2494979
Depends on the ripple, but if it's a 5V ~1A supply and you're drawing 0.1A or less, it's probably fine. You're using an ICSP header, right?

>> No.2495040

>>2494996
No icsp, doing the chip swap thing. Babby steps.

I just realized I'll be running relays off the same ps. I think I'll add the regulator just in con queso.

>> No.2495061

>>2495040
>I just realized I'll be running relays off the same ps. I think I'll add the regulator just in con queso.
Not a bad idea, low voltage relay coils can draw a hundred mA or two. You are using freewheel diodes, right?

>> No.2495254
File: 2.36 MB, 4032x3024, xStation PSX.jpg [View same] [iqdb] [saucenao] [google]
2495254

>>2491560
You'd be better off buying a 3.3v Arduino pro mini and flashing it with PSNee.

>> No.2495274
File: 16 KB, 639x479, Figure_1.png [View same] [iqdb] [saucenao] [google]
2495274

>sample from adc0 constantly and periodically from adc1
it's fucked

>> No.2495276

Just got myself a Z80 off from Amazon, what should I do with it?

>> No.2495282

>>2495276
>Z80...what

add some old TTL chips, drill holes, and hang around neck like a cro-magnon hunter.

>> No.2495291
File: 30 KB, 308x307, Screen Shot 2022-11-02 at 10.38.43 AM.png [View same] [iqdb] [saucenao] [google]
2495291

>>2495276
hook up a crystal to let it free-run, then put LEDs on some the address lines

>> No.2495329
File: 1.97 MB, 4032x3024, Z80.jpg [View same] [iqdb] [saucenao] [google]
2495329

>>2495291
YARRRR I was going to say the same. Neat project, very simple.

>> No.2495413

>>2495276
Make a game console with it. They use external program memory so it's real easy to make flashcarts.
Don't forget about Ferroelectric-RAM for non-volatile storage.

>> No.2495603

>>2494517
I only buy devboards with cortex 10pin headers or tag connect pads.

>> No.2495606

>>2495603
I only make dev-boards that have 3 big pads to clip homemade a peg programmer onto.

>> No.2495629

>>2495329
why do you solder stuff while working on breadboard

>> No.2495642

>>2495629
Where is he going to get 10 extra strips for the leds? I solder my LED resistors the exact same way. Also I like to use really really high value resistors because the LEDs are too bright.

>> No.2495666
File: 41 KB, 623x791, 1605905155280.jpg [View same] [iqdb] [saucenao] [google]
2495666

>>2495629
>>2495642
>not making breakout boards for repetitive shit
>not adding transistors to take the load off of I/O pins

>> No.2495668

>>2495666
this

>> No.2495685

>>2495666
I don't make boards until the circuit is fully tested. And I use 220k resistors for LEDs.

>> No.2495795
File: 86 KB, 1632x1224, 1607205573525.jpg [View same] [iqdb] [saucenao] [google]
2495795

>>2495685
>I don't make boards until the circuit is fully tested.
Well aren't you the good little boy. Have some ice cream.
>And I use 220k resistors for LEDs.
Those are what I got reels of cheap. Who gives a fuck anyhow?
>220k
>k
As dim as your brain? Too bad you didn't fully test your message before posting.

>> No.2495982

>>2495795
>using discrete transistors instead of arrays or octal drivers
Is there a MOSFET version of the ULN2003 yet?

>> No.2496072

Just found out one can use a Debugger for the Microchip ICD3 and it is honestly life-changing ...
I spent months having to abstractly look at code and guess-and-check, while this gives breakpoints and everything

>> No.2496166

>>2495685
>I don't make boards until the circuit is fully tested.
this is retarded. breadboard testing will only get you so far. and i can say from first hand experience, that getting a pcb made is far easier to find actual errors than to waste time fucking around with breadboards and wires. also having to require through hole parts makes your shit expensive and also limits your part availability.

>> No.2496172

>>2496166
depends entirely on the project. but considering most of the parts we talk about here are smts, prototyping them in any capacity is a pain. for sub-megahertz analogue stuff i think breadboarding is usually a good idea as it helps you test a lot of configurations rather easily for stability. digital stuff, idk man we can just fix all the bugs in software, right?

>> No.2496238
File: 68 KB, 400x388, npn-switch-led.png [View same] [iqdb] [saucenao] [google]
2496238

>>2495982
I have a buttload of those tiny transistors (3904 equivalent) from a place I used to work. I sorted them from a few bags of parts someone gave me after vacuuming out the pick-and-place machines. Also
>getting SMD soldering practice
These aren't meant to be high volume shit, so get a fucking grip and stop trying to show off what a fucking anal rebbitard you are every time someone posts a picture of a board. If you care so much then go build your own the "right" way.
It's still better than a naked resistor and LED right on a chip pin (and it's on when the signal is high, not low), and better than anything I could cram on a breadboard from discrete parts, and I won't go insane from it.
I'm still not sure if next time I want to change the power connections to be on top, then there's a lot more places I could literally slap it on the breadboard right next to a chip. As it is, I can still use taped-together Dupont connectors to plug it into a board, but they always want to curl in the wrong direction.

>> No.2496292

>>2496238
>I sorted them from a few bags of parts someone gave me after vacuuming out the pick-and-place machines.
Woah. I bought a reel of SMD inductors from a junk shop owner who thought it was a reel of film.
>etc.
It's actually more about PCB routing for me than it is about saving costs or soldering. Single-sided boards are a lot easier, but even with double sided boards, trying to get power AND ground AND signal to 8 different places in a board gets messy quick. Though in your case it looks like you might have gotten ground routed beneath all those transistors, which would be rather elegant.
Soldering SOT23s is still a pain.

Anyhow, assuming all the ICs you plan on using it have all 8 wires sequentially in a line (EEPROMs can suck my ass) it would be optimal to just have it plug right in. Getting it lined up with a ground and power pin could take some fucking around since you may need 4 different plugs, so I'd likely leave those two to little jumper wires. Silicone insulated jumper wires, that is.

>> No.2496338

I'm new to this and I see peripheral ICs that use SPI and I2C but I've never had to use one that communicated by UART/USART
What is that protocol commonly used for?

>> No.2496370

>>2496338
UART is more of a general-purpose protocol, the spec only defines that there's N bits plus start and end bits, and maybe a parity bit. Nothing about which is master or slave, nothing about what byte is an address or data, it's all up to the implementation. So it's closer to USB in that the host needs to have the right drivers in order to handle data in the right format, compared to how in I2C the slave needs to adhere strictly to the standard. For example, my old oscilloscope was intended to talk UART (RS232 actually) to a plotter, but it's not just UART, it's the HPGL language atop UART, with each byte sent being an ASCII character.

Well, it's not quite that black and white, but you get the picture.

>> No.2496424

Tired of waiting for the arduino code to compile... Is there a virtual led strip which can run my code on?

>> No.2496454

>>2496292
>Woah.
For what its worth, the sorting of the "grit" happened years later, resistors too, into little dime bags. I also put some SMT chips into little paper envelopes. Lots of time for that when social events are fucked. And most of my R reels came from a Goodwill computer-specific thrift store for a couple bucks each. But aside from those LED boards I haven't had anything else to build with them yet, just proving that I could. SMT by hand can be pretty fun.
>I bought a reel of SMD inductors from a junk shop owner who thought it was a reel of film.
That's kind of funny yeah. In my case there were a lot of certain inductor values based on what they were building, lots of boards with buck supplies. Shit's heavy, and those vacuum pickers drop things a lot. That's also how I got a couple hundred slightly bent STM32 chips (gotta straighten the pins by hand), but they were the kind without USB.

>> No.2496617

>>2496370
That's a good explanation of how it works. Are there any categories of components that tend to use UART or USART rather than SPI or I2C?

>> No.2496623

>>2496617
>. Are there any categories of components that tend to use UART or USART rather than SPI or I2C?

"smart" components can take advantage of a complete serial bus like UART, meaning MCUs and such. dumber components are better suited to SPI or I2C. I2C is good for things like ram and RTCs where every exchange is simple and predictable. SPI is sorta in between, like a poor man's serial port, good for communication between two MCUs but not great for communication between higher level devices.

>> No.2496710

>>2496338
>USART
USART isn't a communication protocol, is a hardware peripheral that can be configured as UART/SPI/I2C by setting registers.

>> No.2496751

>>2496338
a common use is GPS modules. another use case is AT commands for wifi/buetooth or cellular modem modules

>> No.2496766
File: 223 KB, 1050x1176, 128A.png [View same] [iqdb] [saucenao] [google]
2496766

>>2496710
Incorrect. USART is UART+USRT, the former being asynchronous (no clock line) and the latter being synchronous (clock line). USART hardware and SPI hardware and I2C (TWI) hardware are usually fully seperate. For example, here's an ATmega128A, with seperate blocks for all three of those systems.

>> No.2496774

>>2496766
If you look at other parts though, like the XMega series, you'll see that the USART does in fact also support SPI.

>> No.2496837

>>2496774
as a feature of those devices. not as a general function of the protocol. and what you might be thinking of is SCI hardware. which is capable of being configured to utilise any of the protocols mentioned in this pointless argument

>> No.2496866

>>2496774
what's the actual difference between synchronous USART and spi?

>> No.2496910 [DELETED] 

>and the latter being synchronous (clock line).
so 3 wire spi, ok.
>>2496866
Hardware peripheral controlled CS GPIO vs software controlled CS GPIO

>> No.2496912

>>2496766
>and the latter being synchronous (clock line).
so 3 wire spi, ok.
>>2496866
Hardware peripheral controlled CS GPIO vs software controlled CS GPIO

>> No.2497145
File: 200 KB, 1241x1000, 2022-11-05-132959_1241x1000_scrot.png [View same] [iqdb] [saucenao] [google]
2497145

I'm gonna ask in here and /ohm/
I'm reading through the book "Musical Applications of Microprocessors" by Chamberlin. It's effectively a textbook for mixed-signal audio synthesizer design, and also full-digital (almost-)register-level programming of microcontrollers as synthesizers. It's got a shitload of applicable information to what I want to do, but it's also from 1985. Needless to say, it's a bit outdated. I don't know if I can program my stm32 blackpill in BASIC. I like this one because it tells me how to implement synths digitally without relying on libraries. More recent books of a similar caliber are all a bit of a sham. They say "learn how to make digital audio synths!" and then you open the book and it says "download this audio synth library!"
Do any of you guys know of similar textbooks that are more recent?

>> No.2497146

>>2495629
It's just easier that way. I always use the same resistors with these LEDs so I might as well solder them together instead of fucking around with them. One less thing I have to stick on the breadboard.

Is that not obvious?

>> No.2497326

>>2497146
it is obvious. that anon is either trolling or just retarded

>> No.2497342
File: 221 KB, 1500x1500, lilygo-ttgo-t-display-v1.1-esp32-with-1.14-inch-tft-display-pinout-1500x1500w.jpg [View same] [iqdb] [saucenao] [google]
2497342

I just bought a TTGO for my ultra-innovative project. Now I need to learn how to make use of this board. I've never worked with hardware before.
What I want:
- power the board via USB;
- create a circuit between <Something1> and <Something2> and measure its resistance.
What do I connect to what?

>> No.2497360

let's say I want to do some heavy DSP while also driving a display and handling input. I want to do the DSP on one higher-end microcontroller (A), while having a second, cheaper microcontroller (B) handle I/O and graphics.

How do I communicate between the two? I'm not talking about UART, I2C, SPI, I'm talking about, what do I *transmit* over the interface?

For example, assume there's an SPI connection between A and B. The user increments a value on a rotary encoder which is read by B. The value incremented by the user corresponds to a value held in a struct on A that should subsequently be updated to reflect the new value.
What is the generally recommended procedure to communicate this change to A?

>> No.2497371

>>2497360
>How do I communicate between the two? I'm not talking about UART, I2C, SPI, I'm talking about, what do I *transmit* over the interface?
Whatever you want. You design a protocol that both sides use.
It would be a bunch of commands and parameters that you encode somehow. The trick is knowing what works and doesn't. If you want to git gud, you have to look at other people's code and see how they do shit. You also have to learn how to tell whether they know what they are doing or not, which you also learn by looking at a lot of other people's code.

>> No.2497373

>>2497342
>and measure its resistance
sounds like a job for /ohm/
Do you even know how a DVM measures resistance?

>> No.2497382

>>2497373
reads the color code

>> No.2497446

>>2497360
This is a nice idea in theory but generally adds extra complexity and cost for not much benifit unless you already observe a bottleneck.
those higher end M4 and A series mcu's with DSP built in can handle driving displays no problem.
Just make sure the comms to the display is using DMA and you're fine

>> No.2497448
File: 567 KB, 1116x838, 00_SysViewer.jpg [View same] [iqdb] [saucenao] [google]
2497448

>>2497360
>>2497446
Also use segger systemview to profile the system, the CPU time per thread might surprise you.
You can either instrument your source with start/stop markers directly or some RTOS's have it built in.

>> No.2497936

>>2497342
>measure resistance
use a known resistance value and and open circuit to connect what youre measuring. apply a voltage, measure voltage between the resistances. if you want a visual aid, use your preferred search engine and search "voltage divider"

>> No.2497967

>>2497448
The problem is that first you have to be using an RTOS that gives you threads.
These days the usual way to write code is paste it all into a .ino file.

>> No.2497974

>>2497967
No, you literally add the systemview source package and call the functions manually.
Running in a single main loop isn't a problem just add
SEGGER_SYSVIEW_MarkStart(0x1)
MyFuckingDSPFunction()
SEGGER_SYSVIEW_MarkStop(0x1)
and you can see how long and when it runs.
Instrument ISR's the same way to know how ISR's affect your code.

>> No.2498093

I'm working on a project that I'm making what is basically an 8 receptacle smart plug. I bought a 8 relay module that has an esp12 on the board and I'm 3d printing an enclosure. what's the most compact and efficient power converter I should use? I need to go from mains to 5vdc.
Alternatively, I'm also thinking about buying a handful of 2 channel relay boards that have the built in esp-01 plug on them to automate a few receptacles around my house but I need a compact power converter for that too so I can jam the relay module and power converter behind the receptacle. I'm a total brainlet with knowledge of components.

>> No.2498113

>>2498093
Board mounted isolated SMPS modules are pretty small, though pretty low power. Figure out the worst case current draw based off relay and ESP draw, from the datasheets.
Mains transformers can be small, especially the expensive metglas ones, but you also need to take into account the big filter caps.

>> No.2500115
File: 856 KB, 3065x1723, airduino.jpg [View same] [iqdb] [saucenao] [google]
2500115

Good morning, sirs!

>> No.2500192

Can anyone decode this period value for PIC32 timer B for me?
(80000000ul + 128ul)/64ul) / (1000ul)

The 80000000ul is apparently a hertz value. If you do the math you get 1250.
So 1250 incrementations of the timer?
On a 1:64 prescale, with a pic that is set to 80Mhz I think (OSCCONSET = 5 << 16).

How many time would this timer activate (complete its period) per second?

>> No.2500251
File: 3.14 MB, 4032x3024, ESP32s.jpg [View same] [iqdb] [saucenao] [google]
2500251

Got these to play around with, what did I get myself into?

>> No.2500333

>>2500115
kinda based

>>2500251
a mess. i got the same stuff, but also 10 esp12fs and an esp8266 dev-board. still haven't got them to work. download the guide book by neil kolban.

>> No.2500351 [DELETED] 

>>2500251
ok what your going to want to do is get some serial in parallel and serial out shift registers. then get a atmel eeprom thats equivalent to a programamble nand gate that has parallel input and out put and run everything off of 3 pins of the esp 32. the shift register parallel output is tied to the eeproms input. the address lines can work like standard out put . input is read like binary. you can byte write the eeprom if you get atmel flavor. go to youtube for instructions on how to do it . no computer needed cool...

connect those address pins to the gates of to92 package mosfets that you get 100 for $6.99 on amazon to do te stuff with the things. you will need to tie the gates to negative with bleed resistors between 4.7k and 10k is good and you will want diodes to prevent current moving back to the gates causing miss fires so a diode for each address line which is like 14 and thats connected to a single resistor . the to92 mosfets are small signal type and can work wit what crosses your body if you have 1 hand on the battery positive and the other touches the gate pin i have tested it.

the other 2 pins connect to the shift register to act as clock cycle and turn on parallel output read

why do it. what madness is this? fewer pins equal faster code because it listens to fewer pins. i know what your saying it shouldnt take that long to read my code your dumb. but the reality is that arduino reads code slow. counting clock cycles and characters read you get a relatively slow read speed. its like 300 lines of code takes more than 1 second to read it would seem and AND you get split ends. fucking code read in parallel if you do a coroutine. the only way to make your robo dogy do stuffs in real time is 3 pins and shift register and ee[rom to make the mosfets tip bigger loads on servos or digital clock to have numbers change fast needs it or your sex bot which just plays sound bytes and and makes autistic faces no realistic autism for you if you dont do it

>> No.2500414

>>2500351
this is bait

>> No.2500416

Anything I should get from aliexpress during their big sales as someone just getting into microcontrollers?

>> No.2500526

>>2500416
A variety of dev-boards that you're interested in, some USB-to-TTL UART converters, an FT232 board (can do more than just UART), and suitable ISP programmers like the STLink or USBasp or PicKit.

As for peripherals, it entirely depends on what you want to do, but getting some cheap monochrome matrix or segmented displays is never a bad idea.

>> No.2500797

>>2495666
Actually neat and a good idea, thanks anon. I'm DIYing an 8bit computer now, I just use a separate small breadboard with dupont connectors for this right now, but making a few breakout boards is much easier.

>> No.2500876
File: 9 KB, 276x183, network-resistors.jpg [View same] [iqdb] [saucenao] [google]
2500876

>>2500797
Yeah, I haven't had time to do any more stuff than that one, plus stuffing three of the boards I had made, but it was a proof of concept for making more little boards like that, like maybe some with switches. It can also be good for right-angle mount stuff like 7-segment displays.
My main concern is trying to make it fit in places that already have 8 signals next to each other, but don't have acceptable power lines next to them. So far it's been more like scotch-taping eight dupont fly wires together, then using two more fly wires for power. I did think about adding power connectors a few rows back to fit on the bus bars, but even with the same size bus bars, the polarity won't work the other way around.
Maybe what I can do is make my next version of the LED board vertical, with pins sticking out to the side for power. I might could even do it with the remaining boards I already have. Then I can use some short dupont connectors to make it tidy.
Note that there already exists a part that works that way, it's a resistor pack. It still needs one extra pin on the side for Vcc or ground, but it can save a lot of time, and you can use it along with a dip switch for pull-ups.

>> No.2500911

my friend memed me into going with the esp32 over stm32. I'm familiar with the stm32 and the msp430, but I'm going in blind with the esp32. What am I in for?
The STM32 and MSP430 both have their own eclipse knockoffs along with onboard debuggers that let me view the internal state of the microcontroller and step through the program.

Does the esp32 have something similar?

>> No.2500918

>>2500911
Also evidently the esp32 is dual core. Now, if I'm used to register-level programming, is it even feasible to make good use of both cores by hand, or am I better off just using an RTOS and letting it handle all of that for me

>> No.2501057
File: 148 KB, 983x1317, 2022-11-12--01:07:53.png [View same] [iqdb] [saucenao] [google]
2501057

I want to program an ATtiny13a using an arduino (3rd party board similar to the Duemilanove, uses an ATmega168, running at 16MHz).
Pins are connected as such:

ATmega168 - ATtiny13
16 (I/O 10) - 1 (RESET)
8 (GND) - 4 (GND)
17 (I/O 11) - 5 (MOSI)
18 (I/O 12) - 6 (MISO)
19 (1/O 13) - 7 (SCK)
7 (VCC) - 8 (VCC)

This is connected to a 5V supply. I'm using pic related as the program on the Arduino. The result I'm getting is:

setup
Sending: AC
Recieved: FF
Sending: 53
Recieved: 0
Sending: 0
Recieved: 0
Sending: 0
Recieved: 0

I tried using the hardware SPI on the Arduino, which also didn't work. I attributed that to
>When writing serial data to the ATtiny13A, data is clocked on the rising edge of SCK.
>When reading data from the ATtiny13A, data is clocked on the falling edge of SCK.
from the datasheet, because AFAIK, the hardware SPI can only either both read and write on the rising edge or do both on the falling edge, which is why I'm now trying to bitbang.

The ATtiny is a new chip, so I'm should have all stock settings.

>> No.2501122

>>2501057
Can’t you just flash it with the “arduino as isp” default program?
Also put a big capacitor from the reset line of the 128 to ground, should stop the Arduino resetting when the CH340 toggles one of its other pins.

Also you should buy a USBasp and a logic analyser.

>> No.2501131

>>2500911
>>2500918
the second core runs the radio at the low level allowing you to use api/hal on the first core to interface with radio. so really if you dont want to reprogram the core that runs the radio, youre still using a single core anyway. as far as im aware most mcus have swd/jtag debugging pins for an external debugger, but you may have to configure them as such and also those pins are then wasted if you need more io. the other problem with esp32 is theres like 20 different versions of the same cpu and drivers but each has different quirks and bugs to get through. theres also like 5 different ways of developing on them. i personally dont really care for esp32 unless im doing anything that requires wifi, even then id rather develop on nrf52's

>> No.2501217
File: 125 KB, 1281x883, ArduinoSeverino400.jpg [View same] [iqdb] [saucenao] [google]
2501217

>>2501122
>arduino as isp
gives me a error message along the lines of "error during upload: usb device (xxxx:xxxx) not found", where xxxx are some hexadecimal numbers.
>capacitor from reset line of the 128 to ground
What 128? I have a mega168 as part of a board (same type as my pic) and a tiny13a in breadboard
>should stop the Arduino resetting
it isn't resetting, I'm just not getting the correct response from the 13a and I;m trying to understand what the problem is.
>CH340
I don't think my usb to serial adpter is ch340 based, which shouldn't matter ayway since it's npt getting its power from the arduino.

>> No.2501271

>>2501131
Truth be told I don't actually give a shit about the radio, I saw the clock speed and "dual core" and thought "hot damn, I could use both of those".
I was completely unaware of the intricacies of the lineup, though. I was hoping to have an easier platform to develop on than STM32. Maybe I'll have to reconsider and switch back. It would have been nice to have DSP running on core A while a graphics and GPIO handler ran on core B

>> No.2501273

>>2501217
>error during upload: usb device (xxxx:xxxx) not found
I'd dive into that code to figure out what it's actually doing. Maybe worthwhile altering the original code to work with the 168, or at least just looking at the SPI code. My gut tells me that hardware SPI should work just fine, maybe the slave SPI timing is half a clock cycle off from the master SPI timing. You could also probably just add a NOT gate after SCK.

>What 128? I have a mega168
Yeah I meant the 168. The capacitor is necessary for the arduino as isp code to work because the standard USB-to-UART programmer uses the DTR pin of the USB-to-UART IC to reset the MCU. But when you're programming something else through it you wouldn't want that to happen. Depending on how the UART on that board is wired up it may or may not be necessary.
Actually maybe the auto-reset jumper is what does that.

>> No.2501357

>>2501273
Does work with my software SPI now. Realized I forgot to rightshift data, so I was sending the MSB eight times instead of the actual byte.

>> No.2501484 [DELETED] 

Does somebody knows if something like pic related already exists for the rp2040. Basically just an onboard ethernet solution. I found shields like https://www.aliexpress.com/item/1005003381910044.html, but they seem far more expensive than a pico board itself. Considering i may completely missjudge demand here, should i go with W5100 or LAN7820 breakout board trying it myself?

>> No.2501487
File: 322 KB, 800x800, WT32-ETH01.png [View same] [iqdb] [saucenao] [google]
2501487

Does somebody knows if something like pic related already exists for the rp2040. Basically just an onboard ethernet solution. I found shields like https://www.aliexpress.com/item/1005003381910044.html, but they seem far more expensive than a pico board itself. Considering i may completely missjudge demand here, should i go with W5100 or LAN7820 breakout board trying it myself?

>> No.2501497

>>2497448
All SEGGER tool UIs are pure AIDS, without exception. Why can't large companies into UIs or at the very fucking least provide libraries so that users can use their undoubtedly very useful tools with custom UIs that suck less
I haven't found a single embedded tool which had a good UI except stm32cubemx

>> No.2501506

>>2501497
>All SEGGER tool UIs are pure AIDS, without exception.
yes. Don't forget buggy as fuck too. half the time it crashes without warning.
> or at the very fucking least provide libraries
They already do, anyone can link against JLink.dll or any of the other DLLs they provide when you install.
Problem is no one does it because freetards hate anything proprietary. Just use pyOCD and vscode.then.

>> No.2501516

Anybody have experience with the zephyr based nordic sdk?
I have used the original but I think it's not developed anymore so I think I should switch...

>> No.2501526

If I just need to do 4mbs asynchronous uart transfer with some gpio flipping, which chip do I need?
Thinking about some sam / stm32 arm m0 MCU, I guess the big question is that, is 32mhz clock enough or do I need higher system clock.

>> No.2501675
File: 91 KB, 450x450, wiznet-w5100s-evb.png [View same] [iqdb] [saucenao] [google]
2501675

>>2501487
Nevermind, after putting aliexpress byside i found pic related at Wiznet.

>> No.2501965

>>2501526
Anything should work. Even 8 bit ones should be fine desu as long as you have enough clock headroom

>> No.2501980

>>2501271
by default the esp32s clock speed is 80mhz, you have to get the right version to have the 240mhz option, and yeah like i said the other "core" is dedicated firmware controlling the radio so its hard to actually use it like you want. if you can figure it out though, power to ya

>> No.2501983

>>2501965
not him, but doesn't he need to lshift and write the lsb into the port output register? with a 20mhz micro you only get 5 instructions, which i think might be pushing it. the bit bang would take up basically all your clock cycles anyhow, so data processing would need to be done when the uart is not transmitting, at which point better off just lowering the baud.

as for dedicated uart hardware, these tiny1614 avrs say the highest async bitrate is fclock/8, while the highest syncronous bitrate is fclock/2, which might be usable if it only needs to transmit, or if you can add that clock line.

>> No.2501985

>>2501983
You're right about the clock speed, if he needs to output serial @ 4Mbps, he needs an MCU much faster than that. Moreso if he's writing in C with optimizations (may slow down execution in favour of code size)
Hardware UART is always a plus but if your clock is fast enough you can accomplish the same using timer interrupts

>> No.2501987

>>2501985
>he needs an MCU much faster than that
never seen an 8 bit micro run faster than 20mhz but i hardly have a huge amount of experience.
>writing in C with optimizations
can always jam in a few lines of asm if you're really pressed for instructions. if you cut it really close then you dont even need to worry about interrupts haha

>> No.2502093

>>2491169
Add books teaching ARM assembly.

>> No.2502360

>>2501526
>If I just need to do 4mbs asynchronous uart transfer
for what?

>> No.2502395

>>2502360
i agree with this. you should use parallel fifo with a lower clock speed. 4mbps with 8pin fifo means you only need to clock data in at 500khz which is much more doable.

>> No.2502401

>>2502395
you're missing the point of the question.
>>2501526 question is vague and tells nothing about the project except that he needs absurdly fast data rates. The format of the question itself shoes inexperience and therefore the better question to ask is "what are you trying to build" to perhaps provide a better alternative to someone who doesn't even know what question to ask.

>> No.2502650

>>2502395
>you should use parallel fifo with a lower clock speed
no can do boss
>question is vague and tells nothing about the project except
Tells enough, I got those requirements and have to work with them.

>> No.2502767

>>2500414
More like schizo ramblings.

>>2500333
I was able to get ESP-IDF set up along with VSCode and load an example blinky LED program on to the dev board so that's something at least.

>> No.2502802

>>2502650
1Msps DAC into 1Msps ADC with 8bit res on the dac. would give you 8 mbps if you correctly clock it

>> No.2502809

>>2502802
yeah too bad the other end doesn't have adc you fucking retard

>> No.2502951

I'm playing around with a Z80, are these any good?
https://www.amazon.com/24C128-24C256-24C512-Serial-Include/dp/B07PHTS761/ref=pd_bxgy_img_sccl_1/142-3597897-8065066

https://www.amazon.com/CY62256NLL-70PXC-256KBIT-28DIP-62256-CY62256/dp/B015SQB0CW/ref=sr_1_4?keywords=62256

>> No.2503008 [DELETED] 

>>2502951
They are what they are. That's like asking if habanero-flavored jelly beans are good for little kids.
You could make a Z80 talk to those things, but it has no native support for them.
If only you knew how those things work and learned what it takes to use them, and when you want to use them. But no, you just want to be spoon-fed.

>> No.2503010

>>2502951
>24C128 etc.
They are what they are. That's like asking if habanero-flavored jelly beans are good for little kids.
You could make a Z80 talk to those things, but it has no native support for them.
If only you knew how those things work and learned what it takes to use them, and when you want to use them. But no, you just ask to be spoon-fed.
>62256
But those do happen to be just right.

>> No.2503092

>>2502809
Anything stopping you from using SPI instead of UART? If it’s just transmitting data you need to do, then you could probably use SPI hardware in a micro anyhow, and just ignore the clock. If it’s both receiving and transmitting, then any old micro with maybe 40MHz or greater clock should work.

Is 4Mb/s the required average bitrate, or the instantaneous bitrate? Because UART has spaces between its byte transmissions, so you’d actually want to clock at around 6-8MHz.

Adding extra hardware on the other end should be an option either way.

>> No.2503219

>>2502809
no where did you say what your system has and has not. maybe make your question more specific.
>high speed uart
>low clock speed cpu
these two requirements go against eachother, so i was offering alternative solutions based on the severe lack of anything specific apart from a speed requirement

>> No.2503338 [DELETED] 

>>2502650
>Tells enough, I got those requirements and have to work with them.
Well good luck with your FPGA then, because that's about the only thing that can do UART at 4M baud reliably

>> No.2503975 [DELETED] 

it's senator administrator bill ballast!

>> No.2504366

Are you guys aware of anyone who has had any luck with connecting the PS4 controller to an arduino through the ext port?

>Be 30 year old boomer
>Want to make key macros for Fortnite to play with my zoomer friends
>Tried using an ESP32 to spoof a wireless keyboard, but it doesn't connect
>Tried connecting Arduino Micro to usb port, but I have to play with a long ass USB draped across my hobby room
>Tried finding protocol for Back Button attachment to spoof it with an Arduino
>Can't find shit

I just want to "crank 90s" as the kids say and I am terrible at, but mediocre at electronics.

>> No.2504588

>>2500333
>guide book by neil kolban
His book is shit too, and if am not mistaken not up to date with v4+ . It is only good if you have 0 understanding of mcu programming, otherwise you are just better off reading freertos manual and IDF API docs

>> No.2504607
File: 1.29 MB, 1599x609, own made pc.png [View same] [iqdb] [saucenao] [google]
2504607

>>2491169
>>>
As a continuation from his previous Arduino BASIC interpreter project, Stefan Lenz wanted to take things a step further by recreating a home computer from the 1980s with an Arduino Due board and just a few other components. His system combines a 7″ 800 x 480 TFT screen, an SD card reader acting as the disk, and a PS/2 port for connecting a keyboard.

He began by mounting the TFT display shield to the Arduino by slotting it in place and inserting an SD card to function as the external disk since floppy drives have long since disappeared and would be far too unwieldy. After soldering some additional wires to the SPI and I2C bus pins, a level shifter was attached to two digital pins that serve as the data and clock lines for the external PS/2 socket.

Most of the “magic” in this project comes from the programming which handles everything from reading inputs to showing graphics on the LCD and even interfacing with other peripherals over either I2C or SPI. All of the code needed for this retro home computer can be found here in Lenz’s tinybasic repository, which contains a plethora of example projects and demonstrations that can be run/modified.

https://github.com/slviajero/tinybasic

>> No.2504609

>>2504607
try to play with some trnsistors of a computer it can have nice effects while using it

>> No.2504611

>>2504607
>Most of the “magic” in this project comes from

The idiot who wrote this line has no business writing about tech.

>> No.2504993

I'm taking a class on real-time operating systems next semester ("Introduction to specification, analysis, design, and validation techniques for real-time (operating) systems with an emphasis on real-time scheduling theory.")

Any recommendations on a textbook for the subject, or other resources?

>> No.2505055

>>2504993
literally read the freertos documentation. spoiler alert, its super easy

>> No.2505198

>>2505055
ok now what

>> No.2505223

Might need to code device that has fpga in it.
Not sure why they don't just use microcontroller, maybe there is timing critical stuff...
I have done some stuff on zedboard with vivado before.
What do people use for fpgas now days?
I read that the lattice ice are only chips that have open source tooling.

>> No.2505502
File: 103 KB, 704x642, gunge.png [View same] [iqdb] [saucenao] [google]
2505502

Trying to program an ATtiny1614 (the newer series with UPDI) and I just can't get direct port manipulation to work. Pic related, the digitalWrite code works, but the PORTA.OUT does not. The LED tied to PA4 just doesn't turn on. And when I swap it around then it's PA5 that doesn't work, and when I remove the second digitalWrite then the LED stays on, so not even the PORTA.OUT = 0x00 works.

Any clue what's going on here? The PINnCTRL seems to be working just fine, since the pullup resistors are working, the data direction registers too. Using VPORTA.OUT or PORTA.OUTTGL or .OUTSET/.OUTCLR also doesn't work. There is no syntax error, at least not one that's being detected (writing PORTA = 0x00 does present an error so the syntax is correct for this MCU).

>inb4 it's a fault of the arduino IDE and I should be using raw text editor + AVR-GCC instead
I would if the damn thing was actually updated to work with these newer AVRs. I tried to use it with files scraped from MPLABX a while ago but it was bugging out with the differences in memory address space as I couldn't store a lookup table in progmem. This project needs EEPROM use so I don't want to try my luck.

>> No.2505503
File: 5 KB, 362x38, retard alert.png [View same] [iqdb] [saucenao] [google]
2505503

>>2505502
never mind
the endianness was backwards
i guess digitalwrite just overrides the data direction register

>> No.2505516

>>2505198
now download the source and see how they implement context switching for the task scheduler

>> No.2505609

>>2505503
>i guess digitalwrite just overrides the data direction register
stop using arduino ecosystem
program directly
problems solved

>> No.2505631
File: 621 KB, 652x523, file.png [View same] [iqdb] [saucenao] [google]
2505631

pokemon red on tiny2040, unfortunately it is very slow though. And my display is too small

>> No.2505711

>>2505609
No that wouldn't have fixed my problem at all. I was just using DigitalWrite for debugging purposes, and doing so told me that the hardware was working fine, so without it I may have taken even longer. What fixed it was being a good boy and using the same bitmasks for declaring pin names, for setting data direction, and for writing pins high and low. Because I was getting confused by endianness.

As I said, AVR-GCC doesn't seem to like the newer AVRs and their different memory structrure. If I have spare time on this project before it's due I'll try to compile it without the 'duino layer of abstraction, but I'm not hopeful.
>inb4 use MPLABX
gno

>>2505631
Cool as. The RP2040 with its external progmem makes game cartridges pretty easy so I'm looking forward to retro-gaming for it. Is it slow because it's running an emulator? Or just potato code?

I think I'll make myself an arduboy (mega32U4), as it's both an environment I should find fun and easy to program, and one with existing games. Plus one I can add extra hardware to (X/Y buttons, analogue triggers/sticks, etc.) Not sure how you'd make game cartridges though, or otherwise store programs on external memory like an EEPROM or SD card.

>> No.2505777

>>2505711
(>>2505631 here) not sure why it is slow, havent checked yet. There are some definite room for improvement in the emulator I am using (https://github.com/deltabeard/Peanut-GB).). It has callback functions like "getRomByte" "writeRamByte" etc that operates via function pointer that you provide. I will replace those calls with direct access to ram/rom memory and see how it goes. Possibly I can change the rendering part as well

>> No.2506114

>>2505631
>>2505631
Cool, a few months ago I built a GameBoy using peanutGB(pic related). I had to use an stm32f411 since it was for a college course.
My result was kinda ehh mostly because I made some bad choices regarding components and also because i'm a beginner to this kind of stuff:
- I overclocked my mcu at 130Mhz, that's good enough to run simple games like tetris or super mario land at almost full speed but you definitely see it going slow on heavier games like the pokemon series. Super mario land 2 was completely unplayable. The rpi2040 starts out at 130Mhz so you can probably go a bit higher, plus you have 2 cores which means you can for sure get better performances if you use them well
- The display i used was a 2.4'' ili9341. It doesn't completely fit the screen but that was the only display that I could actually fit inside the GB case without cutting stuff because the display comes attached to a slighly bigger pcb with the pins out. I think you can buy the display without the pcb and attach directly with a ribbon cable, that should save you some space.
- Scaling the image is a bitch: the display I bought was 320x240, bigger resolution that the gameboy. Drawing the framebuffer directly gets you a tiny image on the top left of the display so you definitely want to scale. My MCU had too little SRAM so I couldn't store the 320x240 framebuffer in memory, had to scale it on the fly while sending pixels and that lost me around 10 fps. The rpi2040 has more ram though so that might not be a problem for you
- Get a display you can update with DMA. I got the parallel version of the ili9341 where I had to set the gpios and strobe the WR pin, that prevented me from using DMA completely so don't be a dummy like me

There are a few other "challenges" but they're pretty straight forward to solve. If you plan to read games off an sd card then you'll have to implement a cache.
The real struggle was fitting all the stuff inside the GB case...

>> No.2506125

(still >>2506114 )
>>2505777
I also tried changing those functions with direct memory access but actually saw zero performance benefits.
I think the compiler is smart enough to optimize all that stuff since all the emulator's code is in a header file so when you include it then it's all in the same file.
IIRC there are a few memcpy you can skip from before the draw_line callback, I have not tried if those give better performance since I sort of gave up on the idea after seeing the other changes not having effect.

Something that actually gave me a few fps was enabling frame skipping(there's a flag in one of the structs) and only updating the display every 2 frames.

>> No.2506219
File: 2.96 MB, 600x450, output.webm [View same] [iqdb] [saucenao] [google]
2506219

>>2506114
>>2506125
You are right, no benefit from changing those ram/rom access to direct access here as well. I guess the compiler is that good

It looks like a big chunk of time was being spent in updating the screen, not really in the emulator. I improved the code a bit and bumped the SPI clock and got 30-50fps

>> No.2506221

>>2506219
oh also the flickering is not visible to the eye, but my camera catches it

>> No.2506238

AVOID TIMER/COUNTER D ON THE NEW TINY-1 SERIES

>> No.2506639

>>2491169
I have a college class project where I build a fire alarm with an Arduino Nano and a NIR sensor. What is the differences between these two variants?

https://www.mouser.com/ProductDetail/ams-OSRAM/AS7263-BLGM

https://www.mouser.com/ProductDetail/ams-OSRAM/AS7263-BLGT

>> No.2506644

>>2506639
It's in the data sheets, bro.

>> No.2506648
File: 134 KB, 990x871, 2GBOX...jpg [View same] [iqdb] [saucenao] [google]
2506648

Le potato+SDR for HAM radio?

>> No.2506691
File: 189 KB, 252x447, file.png [View same] [iqdb] [saucenao] [google]
2506691

>>2506648
What is that? Raspberry for pic related?

>> No.2506780

>>2506691
I see youre a pi scalper. Please go die now

>> No.2506804

Is it possible to write program in arduino language and then burn it directly to bare avr chip (with old school avr programmer)? I'd like to get easy IO access like on arduino and plcs

>> No.2506811

>>2506804
"arduino language" is just C++ with a bunch of headers that abstracts away the actual hardware

>> No.2506825

Hmm I found a solution using just arduino ide. https://www.pololu.com/docs/0J67/5.4

>>2506811
Well, that's what my teacher said when I asked her what c++ version the arduino compiler uses but she might be wrong. Are the arduino headers compatible with xc8 or avr-gcc?

>> No.2506826
File: 22 KB, 797x242, file.png [View same] [iqdb] [saucenao] [google]
2506826

>>2506825

>> No.2506832

okay so I need to build a spider robot, what kind of microcontroller should I use to be able to use python and its machine learning libraries?

>> No.2506841

>>2506832
Esp32 and stm32 would work with tensorflow + micropython. No idea how complicated it's to get running. Easier might be to use raspberry pi, it consumes a lot of power tough
https://github.com/mocleiri/tensorflow-micropython-examples

>> No.2506907 [DELETED] 

>>2506780
Hey, I only have a small box

>> No.2506909
File: 815 KB, 673x830, file.png [View same] [iqdb] [saucenao] [google]
2506909

>>2506780
Hey, I only have a small box of them

>> No.2506930

>>2506909
Nice. I think ill just get Le Potato though. Id hate to deprive you of such a collection.

>> No.2506936

>>2506648
Might be better off cutting out the middleman USB and connecting the hardware directly to GPIO. Would require knowing what you’re working with though, and software compatibility would be a nightmare.

>> No.2506954

>>2506644
I can't find any differences other than one being cheaper and has more stocks.

Let's just get 2000 of the one and boot up my KiCad.

>> No.2507074

>>2506825
>her
theres your problem.
also, never take anyones word for anything. always follow it up with research of your own, to confirm

>> No.2507075

>>2506954
the "difference" in the name isnt part of the model number. the BLGT/M is likely just a small non fundamental change between versions. it also could denote the batch of the chips that were made. the other common reason for a slight difference in model number suffix is package type. lqfp vs qfn etc. the datasheets will tell you want this reason is.

>> No.2507096
File: 23 KB, 672x136, file.png [View same] [iqdb] [saucenao] [google]
2507096

>>2506954
>>2507075
Generally the last few letter(s) denote packaging.
In this case, T is tape vs whatever M would be that is not listed.

>> No.2507142

>>2507096
that too. i knew i forgot something. every manufacturer does it differently

>> No.2507145

>get missed PWM pulses when PWMing from free-run ADC
>no missed pulses when PWMing from "count++" ramp
>try changing ADC value accumulation from 1 to 2
>right-shift ADC output by 1 appropriately
>no pulses missed at all anymore
>not even any half-sized pulses that would result from one ADC measurement being wrong
kinda strange but I'm not complaining

>> No.2507166

>16-bit multiplication and division on an 8-bit micro
oh no

>> No.2507220
File: 607 KB, 1440x788, 1663347927530919.png [View same] [iqdb] [saucenao] [google]
2507220

>>2507166
>dsp functions using floating points on an 8-bit micro

>> No.2507397

>>2506841
well I would like to teach that robot to walk so I would say the hardware has to be beefy
will any cheap microcontroller development board suffice?

>> No.2507408

>>2507397
>teach that robot to walk
I think you are supposed to train the model on your pc and once it's trained you just push the model to the device?

>> No.2507410

>>2507408
bu that... requires some sort of simulation right?

>> No.2507414

>>2507410
I might be wrong, I don't actually know how machine learning works.
But yes you need simulation.
Or once you got it walking you could try to use reinforced learning to update the model.
I don't think you want to train the model on MCU but you could have some sensors and send the data to pc for processing.
If you want to do the training on the robot you would need something like raspberry pi instead of MCU.

>> No.2507420

>>2507414
well I could get it to stand up and balance itself using standard analytical/iterative approach and only then use some simplified genetic algorithms maybe

>> No.2507483
File: 26 KB, 1024x751, Qt_logo_2016.svg.png [View same] [iqdb] [saucenao] [google]
2507483

Can I use QT Design Studio to work on the UI and then compile it on a STM32mp157 based device later? I'm asking since I have never developed a QT application and I don't want to run into issues later when I deal with the hardware. I don't want to touch hardware yet since my team wants to see the UI first.

>> No.2507486

>>2507483
Qt for MCUs can be ported to any modern microcontroller that is capable of driving a display. If your hardware is not listed, contact us for an estimation of the porting effort, or follow the Qt Quick Ultralite Platform Porting Guide to port Qt Quick Ultralite to this hardware.

>> No.2507488

>>2507486
I mean can I NAIVELY develop an application using qtpy on my windows machine and then figure out the porting business at a later time? Cause really I'm more of an electrical guy and I don't have time right now to deal with the complexities of the toolchain etc. etc.

>> No.2507490
File: 17 KB, 464x254, 1.png [View same] [iqdb] [saucenao] [google]
2507490

>>2507488
I want to design this using QT as quickly as possible and show it to my team in 3 hours

>> No.2507494

>>2507490
It might be considered correct to say "One of your medications is low", since "one is low", not "your medications are low",if your userbase is american. I believe brits might say it the way you have it.

>> No.2507504

>>2507494
That's not important right now. I'll make it say "shove the medication up your ass" as long as I can make it run on my target hardware at a later time.

>> No.2507508

>>2507504
True, but other members of your team might be literate.

>> No.2507509

>>2507508
you want to point out this detail because you don't understand the part that truly matters. Go back to your arts degree.

>> No.2507513

>>2507509
>l because you don't understand the part that truly matters

You are pretty damn insufferable. Good luck with your ghetto grammar and inability to google the simplest of questions. Have a nice day.

>> No.2507514

>>2507513
Thanks.

>> No.2507533

>>2507514
>>2507513
/mcg/ - most convivial gentlemen

>> No.2507629

>>2507488
Honestly I think it would take less programmer time to write the demo in pyQT, then rewrite it in C for the MCU like god intended. Getting QT’s graphical commands ported to work on some low-level display sounds like an absolute pain. Maybe it’s plug-and-play via circuitpython or micropython, but if so there will be google results for it.

>> No.2508137

I am trying to use a st7789 tft display with raspberry pi pico and using TFT_eSPI and it looks like I have to use pin 18 & 19 for sck and mosi.

It works if I use those pins for TFT_MOSI & TFT_SCLK defines but using other pins do not work. It stucks in tft.init() function

Why would that be? library error? I was hoping to use a tiny 2040 but it does not have those pins

>> No.2508192

>>2508137
Two words:
Hardware SPI pins

You should be able to configure alternative pins for the SPI hardware, pins 2/3, 6/7, 22/23 all appear to be alternatives for SPI0's pins 18/19. There's two hardware SPI blocks anyhow, so just swapping from SPI0 to SPI1 should work. See page 14 of the datasheet:
https://datasheet.lcsc.com/lcsc/2201101600_Raspberry-Pi-RP2040_C2040.pdf
See also pages:
>259 - some detail on mapping peripherals to alternative pins
>522 - full SPI hardware description
>269 - the GPIO control registers

As for implementing this while using the tarduino library, you should just be able to get away telling it to swap to different pins before calling tft.init(). A cursory glance suggests that writing to GPIO2_CTRL and GPIO3_CTRL, and also maybe 18/19, would work. If not, and the function overwrites that change, then modifying the library code would be required. A quick search for "GPIO18_" in the library would probably take you where you need to go, though that might be abstracted away by typical arduino potato logic.

>> No.2508216

>>2508192
Thanks, i will give it a try tomorrow

>> No.2508262

Is arduino meme? While pi pico exists? Pico is better in all ways by a large margin, and als8 cheaper. Except arduinos have more analog pins

>> No.2508286

>>2508262
8-bit AVRs have been inferior to 32-bit micros for forever. But they're more of a pain to use properly, especially if you're a beginner who drags and drops meme functions and hopes it work. I can wrap my head around basically any register I'll have to care about in an AVR (with exceptions to the asynchronous timer/counter D) but a 32-bit ARM is another thing entirely. Esepically if you go for something on an oddball architecture like an ESP8266. Pi Pico made a really good step in getting 32-bit MCUs relatively easy to program and actually available unlike STM32s, if you ignore the bullshit python platform.

As for soldering an MCU to a board and programming it to do some task, the lower pin-count and lack of a requirement for an external progmem chip make AVRs or PICs a much more attractive option, and they can be significantly cheaper in that format also. Anyone actually putting a dev-board into a permanent project is a moron. Both AVR and RP2040 are reasonably easy to learn using dev-boards and transition to designing boards with them on it, just with different performance and price specs. I can't see arduino dying any time soon.

t. works for a store where we sell arduino boards for 25USD each
always buy chink knockoffs

>> No.2508474

>>2508286
There is quite a bit of skill and tool difference between soldering a pico to a breadboard or to an experiment board and making PCBs with smd components with pins as small as rp2040. I am afraid I will stay as a moron that puts dev boards into a permanent projects for a while

>> No.2508491

>>2508474
Well there's a middle-ground of getting minimal dev-boards with a flat-bottom and castellated vias and putting those on your boards. Which is especially convenient when it comes to MCUs that always need certain supporting components, like the ESPs' and RP2040's and their external progmem flash chips. Which is what the ESP-12F and WROOM-32 are for ESPs. The pico itself can be laid flat onto a board and soldered using its castellated vias, and while it's still kinda large I wouldn't consider it too excessive like an arduino uno is.

I'm building a reflow plate for easier soldering of SMDs soon and I recommend you do the same if you work with MCUs. That way you can order a bunch of dev-boards from JLC and solder them flat onto simpler one-off home-etched boards. You could even order dev-boards with components that JLC can solder for you, though I can't say if the RP2040 is one of them.

>> No.2508495

>writing values to eeprom
>reading them using avrdude
haha next level debugging technique
who needs an atmel ice

>> No.2508505

>>2508495
>consistent bug disappears entirely when writing to eeprom
>remove eeprom write call
>consistent bug returns
aaaaaa

um
turns out it was a boolean i forgot to reset back to its default of true, but why did that even fix it

>> No.2508530

>>2508505
race condition.
Writing to EEPROM added a delay to the code execution while the transaction completed.
I'd guess the bool was shared between an ISR and main loop.

>> No.2508546

>>2508495
Dont you have two spare io pins to communicate using serial?

>> No.2508549

>>2508530
>I'd guess the bool was shared between an ISR and main loop.
That can happen? There aren't any interrupts in my code nor in the EEPROM.h so that couldn't be it anyhow. I hope the compiler would prevent any overlaps in memory, considering I define that boolean outside of any functions. Maybe I need to call it a global, idk.

I considered writing the EEPROM function myself, but then I looked at it:
>https://github.com/SpenceKonde/megaTinyCore/blob/256fa13fe9c11c2b33762d0297e04c43b848b4b9/megaavr/libraries/EEPROM/src/EEPROM.h
And saw it has a large blob of assembly, and since a ctrl+f yielded no results for "digital" I decided not to touch it. Chances are I could shrink it a fair bit since I don't need to worry about interrupt collisions, though maybe the compiler detects that and gets rid of it anyhow.

>>2508546
Maybe if I redesigned the board, there's 2 or 3 free pins I think. I'll do a redesign of it if I need more than the 5 JLC gave me due to the extensive design mistakes made.
But serial writing is a whole 'nother mess that interferes with timing and isn't exactly synchronous timing-wise anyhow. Actual debugging is apparently something the arduino IDE plans on implementing, wonder if avrdude/AVR-gcc will be able to do so. Or even VScode. Though I imagine that would require more custom software for it to work through my bootleg CH340-based serialUPDI programmer, thankfully there's at least one or two arduino-branded boards that use this programming method so there's some hope.

>> No.2508585

>>2508549
Not sure if it is relevant to your needs but I am using this https://github.com/Coding-Badly/TinyISP and an arduino uno to program and debug another mc (an attiny). On attiny side i am using SoftwareSerial and communicate using the same pins that i use for programming it

>> No.2508591

>>2508585
I’ve got a tiny1614, which programs via UPDI, not SPI. My programmer is literally just a USB-to-TTL UART converter with a diode and resistor to combine the TX and RX lines. I’d need to look into whether I could read out data via UPDI without interfering with the current state of the micro, or pause it, or whatever. I know avrdude doesn’t present an option to read RAM, but the chip datasheet may say otherwise. Since it’s just USB-serial, it would just be a matter of writing a python program to send the right commands. Might be slow to try and read RAM synchronously with execution, but if I can pause it and run step-by-step that alone would be invaluable.

The support for this micro is like 95% of the way there (thanks Spence Konde) but if I want to get out of the Arduino IDE I’ll need to try and port that code because AVR-AGC doesn’t work with it.

For programming older AVRs I use a USBasp knockoff, works well but if I can get something akin to debugging by changing its firmware or replacing it with something more powerful I’ll definitely consider it. V-USB is a hack.

>> No.2508803

>>2508591
>AVR-AGC
what's that or do you mean avr-gcc?
>Arduino IDE
The arduino IDE compiles to tiny1614 with avr-gcc.
I used the Kondes arduino sdk library with platformio but had to rewrite my code without it because you can't fit the library to tiny414 which has only 4k flash.

>> No.2508805

MCU with multiple DACs or MCU with external DAC(s)?
Need to have 4 signals with different frequencies but once I have the frequencies defined, they won't change.
I think all of them will be below 50khz.

>> No.2508812

>>2508549
>That can happen?
only if you explicitly define it. Otherwise the race condition could be something else. The ISR was just a guess since it's the most common race condition.

>> No.2508824

>>2508803
>do you mean avr-gcc
yes
>The arduino IDE compiles to tiny1614 with avr-gcc
Yes but it uses some guy's "core" that I'd need to extract to use by itself.

>> No.2509538

which controller should I use if I plan driving 12 servos? do I need additional servo driving boards?

>> No.2509629

>>2509538
I just read through some of this article:
https://forum.arduino.cc/t/how-does-a-servo-work-pwm-or-ppm/14211/7
And I'm just getting more confused about how servos are driven. From what I gather from the only picture of any waveform on the page by westfw, and through System's text posts, PPM is how individual servos are addressed (it's multiplexing and has nothing to do with pulse duration), while the width of those pulses is what encodes servo output. Some are saying that an arduino's PWM outputs can hurt servos, but I suspect that's just because they're being driven at more than their allotted pulse lifetime.

As for driving multiple servos, I'll quote westfw:
>The large gaps allow multiple servo signals to be multiplexed on a single communications link (eg the radio signal of a radio control set.)
>You only have to send one actual pulse at any one time, and you have enough room to send about 10 servo signals.
>I'm pretty sure that this is how the libraries that support very large numbers of servos on Arduino (or similar micro) work.
>For each timer the chip has, you can easily control up to 10 servos.
>Since the ATmega168 (and 328) have three (or even 6, depending on how you count), you can control more servos than there are pins.
So up to 10 servos fit in a single time span of pulses, for more than that you'll need seperate control channels, which works out to be seperate timers.
But the 328P and such only have 6 output compare pins (known as PWM-capable pins to arduinokiddies), so I suspect those functions use bit-banging based off timers. Using the more modern ATtiny3217, you'd be able to shuffle about hardware timers on alternative pins for 12 outputs using TCA alone.
Either way a ground-up software implementation would be a pain, while using some shitty arduino library would probably work but with no easy way to debug it.

>> No.2509650
File: 12 KB, 432x288, how-servo-motors-work-fig3.jpg [View same] [iqdb] [saucenao] [google]
2509650

>>2509629
Servos work with pwm signal. Pulse length is position. Servo datasheet gives info about suitable pulse. Pic is example one.

If the microcontroller have serial output, just set it to high rate and use some serial to parallel ic like SN74LV8153.

>> No.2509772

>>2509650
>>2509629
i just ordered an IIC servo driver for st nucleo

>> No.2509866

>>2491169
i want to learn FPGAs as an amateur. my interests are digitally controlled power supplies and motor control. these don't require FPGAs, i know, but it would be cool to use one in this type of context. what type of a development board should i be targeting, considering i have no idea how to spec this? would an arty a7-35 be enough?

>> No.2509887

>>2509866
>wants to use fpga
>doesnt need to
>wants a dev board
Are you a millionaire?

>> No.2509892

>>2509887
i can get an arty a7 on ebay for like $80, and there are things like the sipeed tang primer 20k for ~$40 on aliexpress. the problem is that i have absolutely no experience with FPGAs so i don't know if the number of LUTs would be adequate? it's certainly more $ than a STM32 nucleo, but $40 or $80 on an autism hobby project isn't too bad.

>> No.2510130
File: 27 KB, 707x395, file.png [View same] [iqdb] [saucenao] [google]
2510130

I am trying to use interrupts and volatile variables but I think somehow avr gcc is still optimizing stuff

Pic related is my interrupt code and it updates g_curDmaBuff which is a volatile. And later in a loop I am checking g_curDmaBuff like this


while(pxEnd > g_curDmaBuff);

Which should eventually become true but it doesn't. It works if I do this

while(pxEnd > g_curDmaBuff) delay(0);

So delay(0) probably un-optimize g_curDmaBuff

What am I missing?

>> No.2510144

>>2510130
>I am trying to use interrupts and volatile variables but I think somehow avr gcc is still optimizing stuff
Well for starters, it looks by the sdk funciton names you're using a pi pico sdk which is not AVR.
https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__dma.html

Secondly, most likely an optimization issue which you can test with

#pragma GCC push_options
#pragma GCC optimize ("O0")
while(pxEnd > g_curDmaBuff);
#pragma GCC pop_options

Alternativly you can try,

while(pxEnd > g_curDmaBuff) __asm("nop");

or

do{}while(pxEnd > g_curDmaBuff);

>> No.2510145

>>2510130
>auto
generally interrupt handlers should be compiled with C and not CXX compilers.
Put your isr in a second .c only file and target it with the C compiler to avoid C++ optimization issues.

>> No.2510252

>>2510130
You're trying to do an empty while? First, I think you should always put a comment making it clear like "while (something) /* wait */;" because it took me a while to see that. But yeah, something is optimizing that.
A quick google search for "volatile pointer" and my gut feeling was right...
>Why is a point-to-volatile pointer, like "volatile int * p", useful?
>https://stackoverflow.com › questions › why-is-a-point-...
>Mar 29, 2012 — volatile int* p;. is a pointer to an int that the compiler will treat as volatile . This means that the compiler will assume that it ...
Yep, that doesn't make the pointer volatile, it makes what it points to volatile. Too early in the morning for me to care to find out to make the pointer itself volatile.
>>2510145
The two main problems are name mangling (the ISR needs to be extern "C") and wanting to use a class method as an ISR (no way to get the "this" pointer without making a helper function), but those will prevent it from compiling, so not the problem here.

>> No.2510301

okay now I'm awake
https://stackoverflow.com/questions/33280881/can-a-pointer-be-volatile

This is volatile pointer: int * volatile p,
this is a pointer point to a volatile int: volatile int *p

>> No.2510519

>>2510301
More correct way to write the second one would be int volatile *p.

>> No.2510656
File: 1.32 MB, 1171x803, file.png [View same] [iqdb] [saucenao] [google]
2510656

>>2510144
>pragma GCC optimize
it complained about this not being allowed in functions, but adding __asm("nop") worked. Thanks!

it is weird that it is being optimized though, why is that

>>2510252
I am just trying to block until pxEnd > g_curDmaBuff holds false.

The interrupt increments`g_curDmaBuff` as dma goes through the buffer. And later I use that variable to check if it is safe to write buffer. anything in the buffer under that pointer should be safe to write since that data is already transmitted

It is for updating a screen. I am transmitting the screen data and drawing the next screen at the same time

It looks like this is slower though. Previously I was sending first the top half of the screen and then second half. And ensure the half I am editing is already transmitted. Now I tried this interrupt solution but it is slower

>> No.2510663

>>2510301
ooooh, that makes sense. it didn't work with empty loop though. Still need __asm("nop")

Anyway, I will give up on this solution since it is slower

>> No.2510683

>>2510656
>it is weird that it is being optimized though, why is that
because you have the optimizer enabled duh.
Check what optimization level you're using and what optimizations are enabled.
Chances are you can just disable the offending optimization and continue as normal. Figure out what level you're running at, then run -O0 and enable the flags for the -On level manually until it breaks

>> No.2510686

>>2510663
Inlining asm in any C block disables optimizations for that block. Since optimizations are done on C code only. GCC has no awareness of what is inside those blocks, the asm is inserted afterwards before assembly with as.
nop as you probably can guess does nothing so it's a pure test of optimizer fuckery

>> No.2510692

>>2510663
And while we're on the topic, the asm version of optimization checking are in the form of barrier instructions. Most newer ARM processors have some level of internal instruction pipelines that re-order instruction executions to speed up instruction fetching, processing, memory access, etc but sometimes can cause issues.
In which case you use barriers to guarantee one instruction occurs before another.
https://developer.arm.com/documentation/dui0489/c/arm-and-thumb-instructions/miscellaneous-instructions/dmb--dsb--and-isb

>> No.2510709
File: 39 KB, 640x640, rpipicos.jpg [View same] [iqdb] [saucenao] [google]
2510709

I got a heckin raspberry pico kit from an amazon bin store
Now what?

>> No.2510713

>>2510683
but isn't that the point of volatile? the compiler shouldn't make any assumptions on how it is not being changed in the function and cache it. Because it can be changed by outside of that function

>> No.2510717

>>2510709
write tetris

>> No.2510845

I just got st nucleo board, how do I program it st-flash, what address should I use since every example I see online uses the syntax of
st-flash <binaryfile> <address>
and most of the time address is upper half of the memory range so it starts with 0x8
what do those addresses mean?

>> No.2510866

>>2510845
you get the data sheet for the particular STM32 chip and read is, that's what they're for

>> No.2510870

>>2510709
use it to make "lost pendrive" USB trojan bombs. Here's a code that emulates keyboard and opens arbitrary www address upon connection.
https://github.com/EddieTheHead/RPIPicoRickRoll

>> No.2510973

>>2509892
>i don't know if the number of LUTs would be adequate?
you can do your design with verilog / vhdl and do the synthesis, it tells you statistics about the LUTs and ram.

>> No.2510989

>>2510845
>what do those addresses mean
it means it is a memory address to store data, in this case a binday file that was the result of a compilation of code

>> No.2511513

>arduino sdk named pwm function analogWrite
wtf is wrong with them?

>> No.2511520

>>2511513
Its for hobbyists, nothing can be more complicated than "do X"

>> No.2511542

>>2511513
>embedded software devs
>competent
Pick one and only one.

>> No.2512079

I HATE STM32 HAL
I HATE STM32 HAL
I HATE STM32 HAL

>> No.2512082

>>2512079
>HAL
Some library? Just drop it.

>> No.2512103

>>2512079
Oh you think STM32 HAL is bad? Wait until you use NRF HAL
STM32 HAL + FreeRTOS is peak comfy

>> No.2512104

>not just using bare metal with your own tiny libc parts

>> No.2512109

>>2512104
that's what a HAL is supposed to be but STM HAL IS ANUS

>> No.2512302

>>2512103
>Wait until you use NRF HAL
>not using NRF Connect
Might as well program in asm at that point

>> No.2512625

I'm looking to get a microscope for soldering small parts. I don't do it very often, so I'd just like to get something "good enough". I'm fine with either PC output or standalone screen. I'd like to spend under $50 USD. Any suggestions? Thank you.

>> No.2512663

>>2512625
Check out the microsoldering gurus on youtube. Chances are they decry digital methods and recommend stereoscopic optical microscopes, but you might get lucky.

>> No.2512819

How much motor control can I get from a pico ?

>> No.2512969

>>2512819
They’re fast enough for FOC with basically any brushless motor, assuming you’re using hardware timers and programming in C or ASM. If you’re bit-banging each I/O with python then it might be fast enough for slow brushless motor driving.

But you need the right hardware, namely MOSFETs and their drivers. Or maybe an integrated motor driver IC if you’re powering a motor below 50W or so.

>> No.2513157
File: 343 KB, 1169x737, bc.png [View same] [iqdb] [saucenao] [google]
2513157

while you are sitting here making your pathetic little blinky led arduino projects, Elon is making actual fucking chips that go into your actual fucking brain
he within the next year he will be putting one of these into a human
so step up for fucks sake, you are so behind it's like caveman versus a nuke
i want everyone here to start studying and making BCIs from now on so we can have an open source alternative to neuralink

>> No.2513203

>>2513157
>putting botnet in your brain
no thanks

>> No.2513241

you have 10 seconds to explain why you aren't using esp32 for every project

>> No.2513256

>>2513157
You wake up in a cold sweat with only one thought in your head. "I'M LOVING IT(TM)"

>> No.2513258

>>2513241
Weird CPU architecture.

>>2513256
Normalfags will eat it up like the current gen of personal tracking devices (mobile phones).

>> No.2513261

>>2513258
>Weird CPU architecture.
esp32-c3 is risc-v

>> No.2513264

>>2513261
I'm interested in that, but so far all available boards I've seen were Xtensa.

>> No.2513280

>>2513241
not reliable, i get random crashes sometimes, unlike with chadmega 328 which can run for years without a single problem

>> No.2513578

>>2513241
Still haven’t worked out the best way to program them or design a board for them that doesn’t require holding down a boot button.

Also they’re significantly more expensive and larger than the MCUs I usually use. The only reason I’d use one would be if I wanted the huge amount of RAM and the DMA to properly use it. Like for audio DSP and live FFTs, or for mid/high-baud RF.

Also chinese spyware.

>> No.2513821

I have some light up Christmas pictures that run off of aa batteries and they go through them quickly since they don't have a timer. How difficult would it be to a timer to them so they turn on for 8 hours or so everyday? I'm familiar with electronics, but I'm clueless with programming and microcontrollers.

>> No.2513837
File: 34 KB, 797x363, Long-Duration-Timer-Circuit-1.png [View same] [iqdb] [saucenao] [google]
2513837

>>2513821
>I'm clueless with programming and microcontrollers.

you dont need no stinkin' micro-controller to do something so simple.
just a timer chip (555) and a divider (4017) to increase the delay.
you could replace the 4017 by 4020 or 4040 to increase the division, in which case, you could run the timer
faster, making it easier to calibrate.
(e.g. generate a 0.5Hz square wave, use the 4020 to divide it by 16384 to get a 9 hour delay.)
https://www.circuits-diy.com/multi-stage-adjustable-long-duration-timer/

>> No.2513846

>>2513821
>buy the cheapest attiny
>write 10 lines of code

>> No.2513850

>>2513846

missing step 2:
>spend 200 frustrating hours learning all the intricacies of a new platform

>> No.2513852

>>2513850
>buy the cheapest avr dev-board
>copy someone else's code

>> No.2514004

>>2501516
There are tutorials in Nordic's DevZone if you want to check how the zephyr sdk works.

>> No.2514009

>>2514004
Sure and I have quickly tested some.
Currently I'm not entirely convinced though.
I'm going to start new project in January using nrf5832 and currently I'm thinking that it will be made with the older 1.7 sdk.

>> No.2514241

>>2513837
Thanks, I'll give that a look.

>> No.2514422

who XILINX here?

>> No.2514941

is there a micro-controller comparison somewhere? Specifically looking for one with as much free (as in freedom) and open source support as possible, and also as low power usage as possible

>> No.2514956

>>2514941
Most of the common MCUs have an ISa supported by gcc, and a datasheet describing all peripherals. You don't need any closed source libraries or libraries with shitty licenses. The RISC-V ones even have a "free" ISA. If you want the entire hardware to be free, using a softcore on FPGAs with open toolchains like Lattice are a possible choice. (Lattice's official toolchain isn't free, but yosys works.)

>> No.2514989

>>2514941
There's this one for AVRs:
https://ww1.microchip.com/downloads/en/DeviceDoc/30010135E.pdf
AVRs are probably going to be the most accessible MCUs for a while, since you can buy an ICSP programmer for them for less than $2, and they're mostly supported by AVR-gcc. Less so for the newer series that use UPDI. Debugging still requires closed-source hardware and software IIRC, though SAMD can be debugged via arduino so it's probably doable.
Also RP2040s are looking pretty good.

There might be a similar chart for PICs, which are generally cheaper and more available than AVRs, but I've not yet seen a FOSS PIC programmer design. And the hardware specs seem a bit dated. Might just be ignorant though.

Chink MCUs like the GD32V, CH32V, and ESP32-C3 are Risc-V, which is probably the most free-as-in-freedom architecture. Not that it really impacts the end-user much. I imagine there's an open-source ICSP programmer (and hopefully debugger).

Remember, programming bootloaders are for shitlords.

>> No.2514995

>>2514989
>debugging requires closed-source
The fuck. I've debugged on ARMs with openocd and gdb. Why do people push this AVR fucking trash.

>> No.2515018

>>2514995
I might actually be full of shit. Older AVRs support debugWire, and newer ones have UPDI, both of which seem to have some at least vestigial FOSS support. AVR-dgb seems to exist after all.

>> No.2515082

bros I'm literally retarded at designing PCBs and end up just fucking up the whole layout trying to connect the various components based on the netlist if that makes sense, should I just quit at designing electronics?

>> No.2515090

>>2515082
How many layers? THT or SMT? Sometimes it just doesn't come together nicely, but I only really have that issue with single-sided boards.
Post diagram and/or schematic.

>> No.2515124

>>2515090
>How many layers? THT or SMT? Sometimes it just doesn't come together nicely, but I only really have that issue with single-sided boards.

If It's two layers then it's no problem, the pcb took me awhile, the original draft was terrible but here it is


https://files.catbox.moe/vhaqco.asc

https://files.catbox.moe/hu9gnn.pcb

>> No.2515446

Does anybody know if those groove modules can be used without the groove shield?

>> No.2515609

>>2515446
Do you mean "grove"?
Either way yeah sure, so long as you have the pinout data.

>> No.2515681

>>2515124
Post a screenshot or a pdf if you want people to look at your shit.
There are a million EDA tools out there and no one is going to try and figure it out.

>> No.2515720

>>2515124
those file types don't look very free and open source, anon

>> No.2515744

>>2515720
lt spice and pcb express

>> No.2515873

>>2515124
>>2515744
post screenshots and use KiCAD like everyone else for a start. as for laying shit out neatly, you get betyer by doing it more

>> No.2516032

>stm32 internal voltage reference yields 1488 when polled with 12 bit ADC
what did they mean by this?

>> No.2516052

>>2515720
came here to post this

>>2515873
I like gEDA/gschem a lot

>> No.2516388

>>2515720
>those file types don't look very free and open source, anon

but they are free https://www.expresspcb.com/

>> No.2516393

>>2516388
But not free as in freedom.
>https://www.expresspcb.com/
>PCB's
>using an apostrophe to denote a plural
>business since 1998
lmao

>> No.2516403

>>2516393
>look ma I'm trolling in /diy/ again

You need to work on your shitposting skills anon.

>> No.2516426

i am having a hard time understanding difference between shift register and mux
shift register is cheaper and seems better in every way

>> No.2516468
File: 8 KB, 262x192, read more says cat.jpg [View same] [iqdb] [saucenao] [google]
2516468

>>2516426
>shift register ... better in every way

they have completely different functions, so you're comparing apples and oranges.
read more datasheets.

>> No.2516475
File: 24 KB, 322x499, The TTL Cookbook.jpg [View same] [iqdb] [saucenao] [google]
2516475

>>2516426
Here's a free clue.

>> No.2516507

>>2516426
ill explain in a short hand way. shift regs is analogous to memory, where as a d/mux is more like directing signals to different paths.
or
shidt regs are serial in parallel out. mux is 1 in 1 out based on the select pins.

>> No.2516752
File: 46 KB, 1012x339, 2022-12-06-150258_1012x339_scrot.png [View same] [iqdb] [saucenao] [google]
2516752

>>2516388
>>2516403
>EULA

>> No.2516756
File: 41 KB, 398x623, 2022-12-06-150420_398x623_scrot.png [View same] [iqdb] [saucenao] [google]
2516756

>>2516388
>>2516403
do you not know what free software is?

>> No.2516796

>>2516795
>>2516795
>>2516795
NEW THREAD

>> No.2516947
File: 28 KB, 580x346, 1493476164988.jpg [View same] [iqdb] [saucenao] [google]
2516947

>>2516756
So there's versions compiled for Mac and Linux?
If there's a bug, I can go into a debugger and trace it down?

>> No.2517072

>>2516947
>compiled
wut

>> No.2517468 [DELETED] 

tarduino question here but I am trying to change variables on my ESP8266 via http requests but the values dont seem to change