[ 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: 924 KB, 500x495, tumblr_inline_pi43jqokR61qkwxsv_1280.gif [View same] [iqdb] [saucenao] [google]
1924652 No.1924652 [Reply] [Original]

Arduino, Teensy, Atmel, ESP32, FPGAs, bluepill, Raspberry... All microcontrollers welcome!

>> No.1924676

tl;dr: trying to make a proof of concept rudimentary digital oscilloscope with an stm32 and SPI oled display. It's still too slow and I think the only way to go faster is with assembly, a better algorithm or both. Any ideas?

So I finally got my SPI display working with my STM32. It's significantly faster than my IIC display, but still not fast enough.
I think it might might be my implementation though.

What I'm trying to do is build a rudimentary proof-of-concept mini digital oscilloscope out of the STM32. My current algorithm is essentially:
>read voltage in from ADC pin,
>normalize it between 0 and 63 (display is 64 pixels tall)
>store its normalized value in the y component of a 128 element two-dimensional array, the x component starting at 0
>draw pixels at [x, y]
>move y-value to the next element over, increment x value
>loop

I tried implementing this with a sine table rather than raw ADC data, just to see what would happen. While it did draw a sine wave, it was much too slow to qualify as a success.
Either my algorithm is indeed way too slow, or it might be fast enough only in assembly, bypassing the library (u8g2) I'm currently using to draw the pixel.
I'm thinking, maybe my entire approach is wrong in that drawing the pixels one by one as a traditional oscilloscope does might not translate over to the digital world.
I'm still fairly new to programming. Do you guys see a smarter way of going about this? Off the top of my head, other than assembly, I'm trying to think if there's a way to do some bitwise fuckery to just implicitly flip the pixel memory addresses instead of explicitly drawing a pixel based on an x/y coordinate

>> No.1924707

>>1924676
You need to run the numbers to understand whether such a configuration is even feasible to have a fast enough update rate.

I assume youre looking for 20 fps atleast. 64*128 pixels, I assume youve got 4 bits per pixel (as is typical with these things), so 64*128*4*20 = 655kbits per sec.

If you use CubeMX, it should tell you the approx bitrate youre getting in the SPI periph config panel, and that is a very feasible number.

You say youre using a library, and writing pixels one-by-one - that sounds like a major bottleneck. What you really want to do is configure the display once at power-up, and then use HAL_SPI_TransmitReceive_IT, with a pointer to your framebuffer as an argument, to asynchronously send the frame at full speed over the SPI bus.

Or you could setup a DMA transfer to just have a continuous "video" stream going to your SPI display in the background.

>> No.1925134

How do you run multiple h bridges using less pins on mcu

>> No.1925264

>>1925134
shift register

>> No.1925275

if I wanted to write a program that switches 2-20 lights on and off in programmed intervals, and then put that program on a microcontroller, which microcontroller and coding combo would I use? Like (LIGHT A ON 0200-0400), (LIGHT B ON 0400-0600), (LIGHT C ON 0600-0800) if this makes sense.

don’t know anything about microcontrollers but can’t imagine something like this would be that hard to program, even with some fleshed out features. thanks for your consideration

>> No.1925276

>>1925275
depending on the load, you'll have to drive the lights with a transistor and actuate the gate with the MCU.

a small nucleo can be found for cheap and can easily be programmed to do such a thing with tickers. It shouldn't take more than an hour to program this even with no experience in c.

>> No.1925277

Here’s a random question. What’s the most “bizarre” shit you’ve seen done with a raspberry pi?

>> No.1925279

>>1924707
That sounds like some embedded wizardry that I haven't heard about yet, and don't know how to do.
But, it doesn't sound like something I can't learn. Given time and resources, I think I can implement what you're suggesting.

What would be some good key words to search for, to learn about things like that? (other than the obvious)

>> No.1925294

>>1924676
>>draw pixels at [x, y]
>>move y-value to the next element over, increment x value


>>1924707
>and writing pixels one-by-one

if you are writing a whole column based on the y value then that might be improveable

if you are writing only one pixel in the column to turn it on to display the waveform then its hard to see how that can be improved

this anon is talking about keeping a copy of your whole display in memory on your controller and setting up a peripheral to constantly send that data out to the display in the background so your read value write value loop only has to wait on writing to local memory which is very fast rather than via spi which is very slow.
look at your device datasheet to see what kind of DMA and SPI options it has to send a block of data automagically.

>> No.1925298

>>1925275
get a few tutorials about programming algorithms ...it should give you a general idea how a program goes step by step to excute code ...then find out in what you will be programming the microcontroller and pick up a tutorial about basic functions and integers in that language
> which microcontroller and coding combo would I use?
the one that comes with your programer tool and programming interface , most are made to be written in C but can be done in any other language as long as the compiler can interpret it into the microcontroler formated machine code

unironically go to youtube and look at a few arduino blinky tutorials and it should give you enough of an idea how it should go...also considering the fact you dont know anything about MCU-s you will most likely need to get some out ofthe box microcontroller board like an arduino or its clones or teens , adafruit or whatever since i doubt you have the programming tool, software or know how to make a MCU brakeout board by yourself (not hard but should know what you are doing )

if you need to just make them blink in a sequence without any need to reprogram it or make it customisable you can do all of that with a simple 555 timer circuit and maybe some digital logic IC to do it in a sequence of your choosing

>> No.1925299

>>1925279
basically what you do is you get local memory and fill it up with static values you know wont be changing...most of the screen is basically blank but your way of incrementing still tries writing every picel into its place...basically you want to make a local cache memory that will post out data to the screen and use the program to just change the pixels that are being moved (for instance just the waveform, or voltage values)

>> No.1925304

>>1925299
>>1925294
That sounds doable, I think I can figure that out.

One other noob question - I have the SSD1306 datasheet and I'm looking at its command table.
How do I send/write an instruction to the SSD1306 specifically, instead of having the microcontroller intercept it? I'm sorry if this is a nonsense question but there must be a way to specifically target the SSD1306 or else any assembly commands would just be "executed" by the microcontroller

>> No.1925307
File: 77 KB, 726x833, Screenshot_1.jpg [View same] [iqdb] [saucenao] [google]
1925307

>>1925304
according to this diagram you cant since the pinout is connected over the MCU without pins directly to the memory

>> No.1925317

>>1925307
Just to make sure I'm understanding right and also saying the right thing -
the datasheet has, for example:
>FOSC is the oscillator frequency. It can be changed by command D5h A[7:4]. The higher the register setting results in higher frequency.
So, with what you're saying, I can't actually execute command D5h?

>> No.1925325

>>1925317
i dont understand your first question then ...what MCU are yo utrying to bypass ?
>How do I send/write an instruction to the SSD1306 specifically, instead of having the microcontroller intercept it?

>> No.1925328

>>1925304
uh...what?
if you wanted to use some assembly instruction on your microcontroller you would just enter the instruction
if you want to send this value to the display you would give your microcontroller the instruction to send data to the display and give it the data you want to send which is the instruction

same way as when you write a pixel value the mcu knows to tell the display to change a pixel instead of saying wtf is a pixel i don't have any, because the routine/function that you call isn't just executing the pixel change value, it is sending it as an argument to the display.

all assembly ever is is reading and writing values from registers, you just have to pick the right register to write to that sends the value via spi rather than the register that interprets it as an instruction.

>> No.1925330

>>1925328
> that sends the value via spi
and I believe this right here answers my question below, it's just shuttled through via SPI

>>1925325
That's what I was afraid of. I don't know the correct terminology to say what I want to say.

I'm running the code for my oscilloscope on my STM32. It has its own address space, its own opcode commands - it is its own functional unit.

The way I see it, if I just write in my code the bare command "D5h (whatever argument)", the STM32 is just going to try and execute whatever command that opcode corresponds to on its own architecture, if anything at all.
I want to explicitly tell the program on my STM32 to execute that command, on the SSD1306.
I also want to be able to write certain values to certain memory addresses on the SSD1306 if that's possible. But then I think I would run into the issue above again.

What, then, is the method to tell another microcontroller (SSD1306), to execute a command, from a program running on a different microcontroller (STM32).

>> No.1925332

>>1925304
>>1925317
sorry i didnt understand you at first what you want ...SSD1306 is the whole module including the MCU, memory and everything else and cant be reprogrammed since it has firmware in it that allows yo uto interface with it using your own data inputs

if you want to change your OSC frequency as it said by the datasheeet you need to connect a signal to the pins D/C=0
and pins D7 through D0 with the hex values A7 through A0 ...which is 1010 0111 through 1010 0000 for binary ....where you go from left to right for A7 is
D7=1 D6=0 D5=1 D4=0 D3=0 D2=1 D1=1 D0=1
etc

you can send that using whatever digital IC buffer or whatever that you syncronise with the time when you MCU is waiting ....or just send it with you MCU (you define all that in the program)

>> No.1925334

>>1925304
Nigga just use driver, do you really have reinvent everything down the assembly language?

>> No.1925336

>>1925334
see >>1924676
I've already used a library and it was way too slow
besides, it's a proof of concept, educational project for me to learn about this kind of stuff

>> No.1925340

>>1925330
> if I just write in my code the bare command "D5h (whatever argument)", the STM32 is just going to try and execute whatever command that opcode corresponds to on its own architecture
no not really...at least not like you are saying here ...op codes are digital values set in appropriate registers in the MCU memory...you do that by writing code and then the compiler turns that into machine code that your programming tool (onboard like in arduino , or outboard like AVR ICE) burns into the registers and then your program starts executing

>I want to explicitly tell the program on my STM32 to execute that command, on the SSD1306.

SSD1306 is the name of the whole module not the MCU unit on it...and you dont have acces to the burnt in (programmed) firmware set into it ...that MCU is currently on the module monolythically and the whole module works only because of the program burnt into that MCU ...you interface with it and send it commands over the pins and protocol set before you and defined in the datasheet and can only set its values as code set i n the datasheet since all you send it is not a program but just data it reads and sets into working memory as integers which dont get burned into ROM

>> No.1925341

>>1925340
cont.

so if you want to set its OSC speed yaou go into the datasheet and find its command which i gave you >>1925332

if you want to send data outside what the datasheet gives you it wont do anything and will be discarded ...you dont have acces to the SSD1306 MCU registers

>> No.1925343

>>1925341
Alright, I see now. I think I'll spend a bit of time dissecting the library I've been using, to see how they implemented it.

>> No.1925344

>>1925336
>>1925341
also cont.
if you need it to work faster you can go and look into the library code and see how they did it and try to either reprogram that to make it faster ...or just write your own code from scratch to suit your needs (libraries are usually made as general purpose and are very rarely well optimised so thats always a valid thing to try)

library is just a function that has all those datasheet command in it and you set them in a fancy readable way

>> No.1925710

Any ideas for a project? I just bought my first arm board.

>> No.1925718

>>1925710
Why do think this kind of question is acceptable?

>> No.1925733

>>1925718
I bought an arm board to learn rtos and I'm not sure where to start. I admit it's a shitty question, but your an asshole and your probably aware of that.

To elaborate on my original question, would it be appropriate to use an rtos to create a device that translates ASL into english to communicate with a device like an amazon alexa? Like storing an ai model on the mcu assuming I can get that model to be tiny.

>> No.1925737

>>1925710
why did you buy it if you didnt have a project?

>> No.1925738

>>1925733
there are a lot of uP and uC already designed for this task: see Google Coral or RPI or nVidia Jetson. You need way more processing power if you want to do real time image analysis and recognition

>> No.1925758 [DELETED] 

I'm brand new to this, but is it feasible to have 10 different ADCs connected to a single 64 pin MCU like a Cortex M4? I news ten different potentiometers for a project I want to do

>> No.1925770

>>1925733
you came in herewith a vague and stupid question , and now you are mad because people called you out on it but ok

anywys yes you can do that but not in real time or any real ammount of speed ...if you cna get snippets of just very short movements, or get photos of certain signs (idk if ASL is a movememt or sign) and then interpret/translate that it could be a nice proof of concept project

>> No.1925777

>>1925770
I know it was vague, this is why I elaborated on it. I was never mad. ASL is a sign language so I guess snippets can work. For now I'll try this and mayby host the model somewhere else if it is possible. Thank you btw.
>>1925738
Wow I forgot about the jetson and the rpi, guess I'll buy an rpi later. Thanks!

>> No.1925865

So, I found at home STM32f7 and a STM32f401 discovery kits at home.
Anyone suggest what toolchain is best to use? I looked at Mbed but it seems a bit limited and I don't like the online compiler at all, also has no gfx devving capabilities for the stm32f7

>> No.1925993

>>1925865
i just use ST-s proprietary ARM developement software you can get from their website

>> No.1925996

>>1925865
pick one and learn it. "Best" only makes sense if you understand them and can differentiate based on your needs.
It's more important to know one well.
This board has so many "paralysis by analysis". You have to get rid of that, it's just holding you back. Just choose SOMETHING and start getting the experience.

>> No.1925997

>>1925865
I use atollic truestudio
although i think theyve rebranded under the CubeMXStudio brand nowadays, but i still use the old version.

>> No.1926071

Is it possible for there to be a more optimal solution to a digital circuit that can't be found from the Karnaugh map of said circuit?

>> No.1926082

>>1925733
> your
You might be a smart one, but a nigger nonetheless

>> No.1926101

>>1926071
can't find a good source, I'm just getting "K-maps produce minimal sum of products" which is not necessarily the minimal boolean expression

>> No.1926154

>>1926071
not really no ...thats kinda the whole point of karnaugh

>> No.1926157

>>1926154
>>1926101
alright. I did a k-map and wound up with the terms PW+PD as the mSoP.
But then I was able to factor out that P, for P(W|D), which removes an entire gate from the equation despite being functionally equivalent

>> No.1926158

>>1926157
A single kmap doesn't give you the minimal gates unless you run through all the permutations of setting it up. Your choice to set up the kmap will impact the solution since it determines which symbols are near each other.
It gives you the minimal expression / minimum information if you only do one iteration.

>> No.1926178

>>1926071
>>1926157
a karnaugh map doesn't give you any solution to anything, doesn't give you any terms, doesn't give you any inputs or outputs.
its a way of laying out the inputs in a way that makes it obvious to a person looking it at how those terms can be grouped.
its like saying does a traditional map give an optimal path through a given terrain? no of course not, the map doesn't give you anything but you can look at the map and work out for yourself a solution.
karnaugh maps are good because the alternative is mind bendingly tedious amount of boolean arithmetic and also who doesnt like drawing like graphs and shit.

>> No.1926384

>tfw bought expensive mecanum wheels when i could just buy regular wheels and skid steer this shit

>> No.1926392

>>1926384
Think of the cool factor

>> No.1926405

>>1926392
What's the cool factor both can 360 on spot

>> No.1926410

>>1926405
Yes, but with mecanum wheels you can move in any direction without turning.

>> No.1926441

How do I get started with STM8? I have a good amount of experience with STM32 via STM32CubeIDE and STM32CubeMX, and I'm comfortable with C, but I have no idea where to start when it comes to writing and programming the STM8.

Is there like an idiots guide to setting up all the necessary headers and general program file structure? What about compilation and programming? I have an ST-Link v2 and I know theres a program to flash the STM8 with it.

>> No.1926444

>>1926441
This goes over a minimal setup using sdcc:

https://lujji.github.io/blog/bare-metal-programming-stm8

>> No.1926451

>>1926444
Oh yeah this is expanding my dong thanks bb

>> No.1926485

>>1925996
Hey, that seems like genuine advice, thanks. I'm gonna do CubeMX

>> No.1926509

>>1926441
Why do you want to use STM8? It's a snowflake architecture that's about equivalent to 65HC11. Might as well use AVR, at least that's better designed for C.
I've actually had to use it and wasn't impressed. I also had problems with IAR (a rather expensive pro-tier IDE) that included bad optimizations (a JSR once optimized to a "BR *" instruction!) and half the time it wouldn't download to the ST-Link properly.
Also my company only ever got the bottom basement level versions that didn't have a boot ROM, and that SWIM protocol was a pain in the ass when we had to make factory test equipment for our product. Meanwhile I had no problem making a serial loader for our STM32 stuff.
Also it probably won't work with a chink gum-stick ST-Link as they tend to use the ST-Link firmware from Nucleo boards, so you will need a genuine one from ST.

>> No.1926511

>>1926509
I've flashed STM8s with cheap ST-Link clones. Works fine.

There's a FOSS C compiler that works for them (SDCC). Not as good AVR-GCC but it's usable.

>> No.1926515

>>1926509
I wanted to try the STM8 mainly for the low pin count, low power, and low pin programming interface, as well as removing the unnecessary high-level aspects of STM32. I do have a genuine ST-Link so i'm not worried about that. At the moment i'm thinking of ordering some STM8s alongside STM32s for a project, and I'll play around with both. Thanks for your insight, really interesting stuff.

>> No.1926518

>>1926509
Also, as an unrelated follow up because you seem to know what you're talking about, is there any easy way to program a SOP microcontroller without dedicated pins? Like tiny alligator clips I can attach to the small legs of the SOP?

>> No.1926520
File: 88 KB, 1000x1000, socket.jpg [View same] [iqdb] [saucenao] [google]
1926520

>>1926518
Not him but you probably want something like this.
Just search on AliBay for something like "SOP-8 adapter"

>> No.1926531

>>1926515
Have you looked at MSP-430?

>> No.1926539

>>1926531
>MSP-430
>16-bit micro thats 28 years old
Not to mention the anon already has an ST-link, why would you suggest that?
I really wish you TI whores would be silent, you're almost as bad as PIC whores.

>> No.1926551

To add fuel to the inevitable MCU war:

really fast instant prototype or preexisting demos = 8-bit AVR
everything else = STM32

the CubeMX project generator makes it so easy to just put together an embedded app that its not even funny. Its like the Qt of the embedded world - everyone complains about it... and everyone uses it. I think a lot of people are upset that reading the register documentation has been made obsolete, so now they actually have to focus on writing intelligent code rather than register bookkeeping.

That's not to say i haven't had to peek into the register states - but atollic lets you do that through the GUI. Atollic has performance profiling and hardware exceptions thrown it for free too, which have saved me a few headaches. Eclipse is ofcourse still a bit janky but whatever, if things shit themselves, just regenerate the project - you get that for free too (free as in close to 0 effort).

> t. stm32 shill
Yes.

I still use AVR for prototyping - I really like the (emacs -> avr-gcc -> avrdude) flow, it works really well for fast prototypes where you need to be in control of every aspect of the chip, and cant be fucked to create a directory for the project, name it, generate it, etc... for really fast in-the-moment tests.

>> No.1926557
File: 173 KB, 1000x676, 6502-assembled1_1000.jpg [View same] [iqdb] [saucenao] [google]
1926557

>>1926539
>Not using glorious 6502
ok Jean-Paul

>> No.1926567

>>1926551
why would i use / pay for 32 bits when I only need 8.
people have to learn that shills don't actually know anything about specs and component selection.

>> No.1926583

>>1926567
STM32 Shill here,

Looking at farnell:
STM32F091RCT6: £4.26 per piece (ex VAT)
STM32F051K6T7: £2.40 per piece (ex VAT)
STM32F070F6P6: £1.19 per piece (ex VAT)
ATMEGA328-AU: £1.42 per piece (ex VAT)

idk dude. At this scale its pretty well understood that the limiting price is the package, not the die or whatever. The 8-bit AVR core is not winning any manufacturing prizes.

(It is, however, winning prizes in cycle-accurate and cycle-sensitive code, because you can make very strong guarantees regarding function execution time simply by counting the instructions - that won't be so easy to do with the STM32s, which have more complex cores - even the low end ones are multistage with write buffers.)

At this scale, development time will play a big role too - lets say it costs 80 pence more. Lets say the AVR takes 4 development weeks, and your salary is 40'000. yearly. SO you'll need to be paid (40'000/52 * (4 * 5)) = £15'384

Lets say using STM32 saves you a week. That's (40'000/52 * (3 * 5)) = £11'538, and lets say youre making 1000 of these gadgets. So the overhead for the STM32 is 1000 * 0.8 = £800

So by going STM32 youve saved 11538-800 = 10738.

Obviously ive picked the numbers so STM32 wins. Im not really an STM32 shill, ive just had good experiences with it. But I can very easily see why even projects that don't require its technical features will go for the 32bit - simply because the technical aspects no longer dictate the price.

>> No.1926586

>>1926583
holy fuck im a brainlet, i got tthose numbers wrong...

AVR: 3076
STM: 2307
win = 800-(3076-2307)=£31

>t. you average stm32 user

>> No.1926600

>>1926583
I can get AVRs for pennies.

Obviously you can use a 32 bit arch where an 8 bit would do, and that's all you've stated, and that's not what I was saying.
a $1 cost difference translates to $80,000 / quarter for my current product. Why on earth I'd waste that i have no idea.

>> No.1926656
File: 43 KB, 400x386, comment_1593583450jJpUY2xoOTm759YWB2cNfh w400.jpg [View same] [iqdb] [saucenao] [google]
1926656

>get asked to restart old project on nordic mcu
>install tools, git clone, fix some minor errors, caused by api change, everything looks fine
>doesn't work
>spend 5 hours debugging
>turns out they changed devicetree filenames, so my overlay files were ignored

>> No.1926800

>>1926600
Just increase the final product price by $1

>> No.1926806
File: 312 KB, 1488x706, Untitled.jpg [View same] [iqdb] [saucenao] [google]
1926806

I bought the wrong thing and mine doesn't have the 1v8 hole. What do I do now? Is there a work around to make it fit somewhere else.

>> No.1926833

>>1926806
Use either Vcc or BAT, depending on what the datasheet says.

>> No.1926846
File: 79 KB, 1166x1072, 61mNmuEWOBL._SL1166_.jpg [View same] [iqdb] [saucenao] [google]
1926846

>>1926833
I couldn't find a datasheet for CSR8645 thing and it's bigger board buddy. I'm just going to solder it into VCC and hope for the best. Do on/off switches have a postive/negative?

https://homebrewheadphones.com/3d-printed-bluetooth-headphones/

>> No.1926848

>>1926846
No, but test continuity across two of the three pins in on/off position with a multimeter before wiring.

>> No.1926850

why do you fags keep recommending gtech? It's horrible, completely obtuse for the sake of being more challenging but it completely ruins workflow.

>> No.1926851
File: 11 KB, 732x125, Screenshot from 2020-10-09 22-01-51.png [View same] [iqdb] [saucenao] [google]
1926851

I'm trying to use the cube ide, and when I try starting a project I get this, I'm on debian right now. See pic related.

>> No.1926879

>>1926851
Move on to a sane dev environment.
https://stm32-base.org/

>> No.1926894

>>1926879
so, I guess keil? What do you like, I'm willing to just avoid ides if this what you think is best.

>> No.1926897

>>1926894
Just meant to use the stm32-base templates.
Trying to just use the vendor stuff will only make you miserable.

>> No.1926907

>>1926851
I never had issues with the cube IDE on linux or Wangblows. Have you tried selecting a target mcu when creating the project?

>> No.1926945

I'm writing code for an interrupt on Arduino Zero, cortex M0 and I'm getting a really fucking dumb issues with variables.
I'm adding code to the "tick" and "moveConstantVelocity" parts of this:
https://github.com/Misfittech/nano_stepper/blob/master/firmware/stepper_nano_zero/planner.cpp
and it compiles just fine, but variations in the code, seemingly at random, cause it to hang. Execution of startup works to a point, when an interrupt throws the code into Dummy_Handler and then it hangs. Things that make it work or not work:
>changing variables to volatile/non-volatile (at random, sometimes the volatile version works, sometimes the non-volatile version works)
>replacing a variable call with a function call, eg. (x > y) to (x > fabs(y))
>offloading parts of the code, eg. (x > y + z) to (x > calculatedVal)
>changing numbers in the code, eg. (x > 1) to (x > 1.0f)
One given version of the code always either works or doesn't work, so it shouldn't be some kind of an intermittent hardware problem. Has anyone encountered a similar problem? I really can't make heads or tails of it because it's just so nonsensical with what solution works or doesn't work. Currently the variables involved are all floats and a few bools, but I've had the same problem with int32 and int64 in other places in the code.

>> No.1926954
File: 38 KB, 444x401, x-nucleo-ihm03a1.jpg [View same] [iqdb] [saucenao] [google]
1926954

newfag here
I've been trying to communicate with these pic related drivers via SPI. I have 3 of them stacked together but haven't been able yet to send a relative positioning command succesfully.
I'm using this library
https://github.com/Megunolink/powerSTEP01_Arduino_Library
So far the drivers I have only accept absolute positionings. Commands like goTo work but run or move don't. getPos returns nonsense values...
Did any of you have the same problem? Know how to troubleshoot it?

>> No.1926974

>>1926945
Do you have a debugger? Stepping through would be the easiest solution here.

>> No.1926985

>>1926974
I have a J-link, but stepping through doesn't help, the part that throws the hard fault to Dummy_Handler is completely unrelated to the code I'm working on.

>> No.1926987

>>1926985
>Dummy_Handler
Ummm... maybe you have an interrupt coming in that you didn't expect? So now you have to find out which one. Either start disabling interrupts, or make a bunch of handlers and put individual debug traps into them.

>> No.1926993

>>1926974
>>1926985
I should probably add that the Planner class is not even initialized at the point the fault occurs. But depending on changes I make in the Planner class, the fault goes away.
>>1926987
I read the IPSR and it's the HardFault_Handler.

>> No.1926998

>>1926954
are you using servo steppers ? if you dont have encoders on your motors then you cant get any kind of position out of the box..you would need to home your rotor to a known position and keep that in memory to have relative positioning otherwise (and do that on each power on)

>> No.1927007

>>1926998
I'm using 3 stepper motors with no encoders.
It seems that you can get the absolute position with the powerSTEP library, without attaching any encoders. I tried to read the ABS_POS register but it keeps returning nonsense values.
I think it may be a problem with the drivers I've got.

>> No.1927029

What do I need to read the throttle and speed signals from my electric bike's obd port and play sounds on a speaker?

>> No.1927055

>>1926897
>Trying to just use the vendor stuff will only make you miserable
This is only true for some vendors.
Atmel and Nordic semi have pretty decent SDK's.

>> No.1927056

>>1926945
>changing variables to volatile/non-volatile
you should always use volatile when a variable is shared between an interrupt and the main loop or shared between 2 interrupts. (can change without warning at any point from any context)
>replacing a variable call with a function call, eg. (x > y) to (x > fabs(y))
shouldn't matter unless fabs(y) is doing something hacky.
>offloading parts of the code, eg. (x > y + z) to (x > calculatedVal)
shouldn't matter
>changing numbers in the code, eg. (x > 1) to (x > 1.0f)
shouldn't matter

Dummy_Handler sounds like the default handler in the vector table. if you're adding an interrupt make sure you declare its handler properly otherwise when you enable it, it will go to Dummy_Handler which usually either calls NVIC_Reset() or loops forever in a while(true).

>> No.1927061

>>1927056
It shouldn't matter, but it does, hence calling it a really fucking dumb issue. Dummy handler is the default handler, and it's being called due to a hard fault, not any interrupt as such.
The last call before the fault is the "sine" function in
https://github.com/Misfittech/nano_stepper/blob/master/firmware/stepper_nano_zero/sine.cpp
which is for sine lookup in a predefined table. The same function runs 3 times before the fault. This code is once again completely unrelated to what I'm working on, but if I comment out one or two lines of code in my function (usually something like float f = a + b / 2;) then everything suddenly works. Maybe it's some issue in the memory, I have no idea.

>> No.1927064

>>1927061
Sounds like you could be attempting to access memory that has not been properly allocated, which would explain why it works sometimes. Have you tried disabling peripherals one by one and/or using a new mcu?

>> No.1927066

>>1927061
I've had similar issues like that but it was improper use of the FPU and variable alignment. M0 doesn't have an FPU so that's probably not your problem. M0 float is all int math under the hood.
>This code is once again completely unrelated to what I'm working on
how do you know the code is causing the issue.
check this and see what you find. Sounds like you have a JLink so fire up Ozone and run the elf waiting to catch the fault
https://community.arm.com/developer/ip-products/system/f/embedded-forum/3257/debugging-a-cortex-m0-hard-fault
https://www.segger.com/products/development-tools/ozone-j-link-debugger/

>> No.1927098

>>1927064
>>1927066
I've probably figured out the cause, the original code had a mistake in the step size calibration protocol, but the code only initiated measuring the step size if the EEPROM data for it was considered invalid, so sometimes it would run, but sometimes not. When it did get called, a uint was being assigned -128 resulting in it looping around to 64000 and being out of range of the sine lookup array. So in the end I just sucked at debugging it. But thanks for the help anyway.

>> No.1927108

>>1927098
It could be worse, a 68000-based system without bus error support (*cough*Sega*cough*) would just lock up if you accessed an invalid address range.

>> No.1927146

>>1926907
That's the thing, I never get the target selector screen, I just get this popup whenever I try making a project.

>> No.1927153

>>1927146
it sounds kinda contradictory, but ive found that embedded dev world basically don't care about unix (except fpga/asic tools). Try installing windows VM and see if it works in there.

>> No.1927164

>>1927153
> embedded dev world basically don't care about unix
Well that fuckin sucks... Luckily don't need a VM because I dual boot. And it works on windows

>> No.1927335

>>1927007
yes if you use "home sensors" ...you cant get any kind of position because a stepper without a position sensor can just count the number of steps , it can know where it is by where it was if you save a home point and just count out

there are steppers that have a centering detent spring when they do a full circle and usually it requires a bit more current to move from it and your drivers might be able to use that as an absolute point ...but most stepper motors are hybrids that basically dont have that function and yours is most likely a non detent one

get some encoders from ebay or aliexpress they are not that expensive and are very useful since overloading a stepper can cause it to lose position by skipping steps and gives you much higher ammount of usefulness overall

>> No.1927336

>>1927029
an obd reader in form of a ready to use solution or microcontroller that reads data and decodes it and some kind of analog or digital controller and amplifier with a speaker output

>> No.1927485

>>1927108
>if you accessed an invalid address range.
Generally, you'd have a custom chip between the 68k and the rest of the board, doing address decoding.
The 68010 can recover from bus fault, but most of the pre-68020 machines use 68k because cheaper.

>> No.1927585

>>1927485
>recover from bus fault
That's not the problem, the problem is if nothing asserts BERR, it waits forever for DTACK. I think it might be possible to fix with a counter chip and a gate or two, if it's been a few hundred clock cycles with no DTACK, then hit BERR. Eventually I want to get back to my /vr/ fun with Sega programming, and make a cheap mod to allow for on-console development without stray peeks requiring a full reset.

>> No.1927587

>>1927585
>That's not the problem, the problem is if nothing asserts BERR, it waits forever for DTACK.
You're right. And yes, that's also typically implemented in the decoder (assert DTACK for existing peripherals after enabling them, or BERR).
What 68010 can do is recover from BERR, thus supporting virtual memory (BERR handler sets up the memory, code continues running as if it always was there after RTE).

>> No.1927590

>>1927587
>virtual memory
>on a Sega
quit trying to show off before thinking about the actual subject, nobody gives a fuck about virtual memory, nobody is going to stick a 68010 in there, and it's running in supervisor mode all the time anyhow

>> No.1927600

>>1924676
What about drawBitmap instead of drawPixel? If this is not enough look at pages in the refdoc.

>> No.1928151

>>1927590
>quit trying to show off
What's your problem?
>nobody gives a fuck about virtual memory
Debatable.
>nobody is going to stick a 68010 in there,
It's actually common. And some games (mainly anything 3d) benefit greatly from the extra performance.
>it's running in supervisor mode all the time anyhow
It's still a shame most 80s and early 90s 68k stuff didn't use the 010 instead. It's unironically the bugfix version, or what 68000 should have been in the first place. Nobody should have used 68000 anymore after its release. Hell, I blame Motorola for not making the 68000 a deprecated "life support" product at a premium.

>> No.1928569

Is it OK to post your successful projects here or is this place only for posting/fixing problems?

>> No.1928572

>>1928569
yeah, go for it

>> No.1928580
File: 366 KB, 500x375, watch_spinner.png [View same] [iqdb] [saucenao] [google]
1928580

>>1928572
I have a Seiko Kinetic watch that I only wear for special occasions. The watch battery keeps running down which is annoying when I need it. I made a spinner which runs like a washing machine 15 minutes every hour. I just finished it and I'm adjusting the run times over the next few weeks.

>> No.1928582
File: 279 KB, 375x500, watch_spinner2.png [View same] [iqdb] [saucenao] [google]
1928582

>>1928580
Closed up. I put the parts in sandwich bags so they won't short out inside the nut box.

>> No.1928842

>>1926583
8bit is much cheaper than 32bit parts. Even going from 32kB flash to 16kB or 8kB flash makes a significant difference to your bottom line when you mass produce. I worked for LG for about a decade. We'd have fags from all the semiconductor companies banging on our door every week offering discounts for their stuff. The prices for Farnell/Mouser/Newark/whatever bears no resemblance on actual prices you can get when you order in mass quantities. Even the smaller manufacturers will use distributors that don't deal in 1-2 unit orders like the aforementioned. Prices are way different for companies than for retail.

>> No.1928856

>>1926800
sure, we'll just incur 500k in legal fees to break and renegotiate the contract. Brilliant. I'll bring it up next meeting.

>> No.1928862

>>1928582
>>1928580
That's a nice watch, don't torture it like that, you'll wear out its gears...

>> No.1928905
File: 308 KB, 650x600, max_power.png [View same] [iqdb] [saucenao] [google]
1928905

>>1928862
It's more gentle than wearing it. I don't know how to post video, but the motor impulse is only .25 seconds, 1.25 idle, .25 seconds in the opposite direction, and 1.25 seconds idle. It never gets too fast. I was running it at 5 min per 3 hours but the battery started to run down again.

>> No.1929181

It this the right thread for this? I have these two xbee units that are trying to talk to each other, every 5 seconds. I tested them out and they are on the same network and can chat, but around 25 seconds or after 20, they lose connection with each other. This doesn't make sense to me because they are physically right next to each other, and I don't understand why they are timeing out and I have looked through the settings in XCTU and don't see a setting that would be responsible for dropping the network. The only way they can find the network is by doing a hard reset, deleting all the micropython file and repowering them. Thoughts?

>> No.1929200

>>1926583
I'm just starting out and I've moved from le epic 328p for everything because arduino to atmel built in USB chips. Is there a very compelling reason to move to STM32? It seems like for simple projects you're just adding overhead for no benefit. If you need STM32 for some reason then obviously there isn't a reason not to use it, but if shitty 8-bit MCUs do the job then why bother?

>> No.1929423

>>1929200
>Is there a very compelling reason to move to STM32?
not really. every major vendor makes arm cores now. Atmel SAM, TI MSP432/TIVA, STM32 and a bunch of others. Take your pick depending on your needs.
>>1926567
>>1926600
AVR existed before ARM but just because you don't need a 32bit architecture doesn't mean you can't use one, comparable AVR and ARM will be pretty close in terms of price. If you are making millions of widgets and want to go absolute bottom of the barrel Chinese tier cheap then instead of using a 45 cent ATTINY13 why not use a padauk for 4 cents.

>> No.1929427

>>1929423
>AVR existed before ARM
>AVR 1996
>ARM 1985
okay
Anyhow AVR isn't a bad architecture if you can deal with PROGMEM.

>> No.1929575
File: 218 KB, 1456x747, Untitled.jpg [View same] [iqdb] [saucenao] [google]
1929575

I've got a board with a Xilinx CPLD on it and I'm trying to figure out what the CPLD does.
Before I go on, I should say that I'm completely new to CPLD/ FPGA but have experience with microcontrollers and programming in general.

So, I got a Xilinx platform cable and did a readback on the CPLD that gave me a jedec file (pic related)

Is there any actual way to decipher anything from this file?

>> No.1929580

>>1929200
>s there a very compelling reason to move to STM32
do you have one ? if yes then yes if no then no
>if shitty 8-bit MCUs do the job then why bother?
> for simple projects you're just adding overhead for no benefit.
yes

>do i need this?
the question most asked when newbies see shiny new stuff or when people want to buy gear because they have some spare change ...the anwwser to both is simple

if you need to ask then no you dont need it...if you were doing something that requires it you would go around looking how to buy it not questioning do you need it

>> No.1929669

>>1929575
i think jedec files are one of the common bitstream file formats for CPLDs.
I think these things are/were traditionally programmed using a language called CUPL, but these days im pretty sure you can use VHDL/Verilog.
For Xilinx, I don't think webpack supports their CPLD devices - you need the legacy ISE design suite for that. They have a virtualbox instance you can download from here:

https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive-ise.html

(its just Redhat linux with ISE preinstalled on it.)

>> No.1929725

Anyone know of a microcontroller board with a 5V BNC output and PWM modules?

>> No.1930072

>>1929725
the one you make

>> No.1930275

>>1924676
you need to start counting cycles

what is your uC clock speed?

what is your SPI clock speed, or how long will it take you to write one pixel by SPI?

what is your image resolution?

if your image resolutions is 640x480 and you can write a pixel in 10 cycles (example) and your SPI runs at 100Mhz you could get approx:

100Mhz/10 = 10Mhz
10Mhz/(640x480) = 32Hz

Think in clock cycles and you'll be better off.

>> No.1930278

>>1930072
+1 for this

>> No.1930297

>>1929427
AVR is not an architecture. Harvard is.

>> No.1930315

>>1927108
A lot of modern chips still do that - invalid address is invalid address. You'll just hang until watchdog timer resets processor.

When it becomes a problem is when you have multiple jobs running on a chip (SIOV), and one job can hang the whole chip maliciously by accessing a bad address. Denial of service attack at the chip level basically.

You'd be surpised how many of these can get through in SoC design

>> No.1930397

>>1930297
ok professor... dont you have some papers to publish or something?

>> No.1930619

>>1921729
Wouldn't this kind of level shifter be slow because of the pullup resistors?
I need 5v to 3.3v conversion for some SPI lines that will preferably run at 10MHz, so bi-directionality is not necessary.
Is there a go-to IC for this purpose, that can be soldered without specialized smd tools?

>> No.1930626

Where do I get mirco controller permit so I can buy one? Also do I need to EPA certified ensuring a make an enegry efficent device with the micro controller? Do I have tongive finger prints?


I have to submit my code before I can upload to make thete is nothing malicious in it before I can upload, I heard it takes like 3 to 4 days just to get your code at the inspection table and then additional unknown amount of time before you can get approved.

Also Inlive in a city that I think requires that I get my mircocontroller registered with some type of DMV organization.

What's a Good insurance company to get your mircocontroller insured?

>> No.1930634

>>1930626
what the fuck am I reading

>> No.1930652

>>1930626
>>1930634


Yea bro you gotta be safe, I had a friend illegally purchase an arduino from like a deepweb site and got a pretty big heafty fine from the police for running just the example blink code. Turns out that if you dont have any code reviewed before submitting you risking your freedom.

Also the reason why he got into trouble too was because that blinking led was highly distracting to aircraft, he almost caused a plane to miss the runway because of that blinking led and the fact that it admits a wavelength know to the state of California to cause Parkinson's he was being really careless with his health.

>> No.1930661

Man a friend of mine was running a mircocontroler and he caused it to burn out giving off smoke and the local environmental protection agency gave him a 5000 dollar fine for pollution he only had to pay that because he self reported if he hadnt it could of been close to 20000 and a year in jail and the longer you fail to report the high the sentence and fine.

>> No.1930663

>>1930619
Embrace smd anon.

Most smd components can be soldered by hand. You only need hot air and/or rework station for bga chips and chips with a heatsink to the ground plane.

>> No.1930684

>>1930626
>>1930652
>>1930661
go jerk each other off elsewhere

>> No.1930686
File: 8 KB, 236x238, 9720983544763ceceeb567f0d4c50752--reaction-pictures.jpg [View same] [iqdb] [saucenao] [google]
1930686

>>1930684
can't see the samefagging

>mfw

>> No.1930690

>>1930619
74LVC

>> No.1930710

>>1930619
>that can be soldered without specialized smd tools
you mean a soldering iron? just learn proper technique with lots of flux. Get some solder wick for a few bucks while you're at it to clean up bridges if you mess up.
https://youtu.be/6PB0u8irn-4?t=26

>> No.1930720
File: 3 KB, 588x64, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.png [View same] [iqdb] [saucenao] [google]
1930720

wtf...

>> No.1930730
File: 241 KB, 1181x726, WS_81_T0053250699.jpg [View same] [iqdb] [saucenao] [google]
1930730

>>1930663
>>1930710
cool, I already have this nice weller station. As far as I can tell it's a bevel cut tip in the video, does this tip look appropriately sized for common SMD pitches?
>https://www.weller-tools.com/professional/EUR/en/Professional/Soldering+technology/Soldering+tips+_+nozzles/Soldering+tips/LT/LT+22CP

>>1930690
thanks, 74LVC125 it is

>> No.1930760
File: 3 KB, 560x56, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.png [View same] [iqdb] [saucenao] [google]
1930760

>>1930720
FUCKING sellouts

>> No.1931060

>>1930720
>>1930760

>>1930730

It's safer dealing with commodities.

>> No.1931327

>>1924652
whats the best way to interface eg a Teensy with a computer running Linux? I've always just sent data through the microUSB. However, I want get a Jetson TX2 which has all sorts of pins.

>> No.1931329

>>1931327
well you can't really access the PC's i2c or SPI busses externally.
You're limited to USB or perhaps wifi/bluetooth if the chips are capable.
The operating system is irrelevant, it's about what peripherals you can connect to. Do you have a RS232 port? probably not.
You can USB-UART adapters if you want, but if the modules has USB, you're not going to get better than that. contemporary computers don't have many options to *directly* interface with MCUs. You need adapters from what the computer has available.

>> No.1931344

>>1931329
Jetson has all of this:

USB 3.0 Type A
USB 2.0 Micro AB (supports recovery and host mode)
HDMI
M.2 Key E
PCI-E x4
Gigabit Ethernet
Full-Size SD
SATA Data and Power
GPIOs, I2C, I2S, SPI, CAN*
TTL UART with flow control
Display Expansion Header*
Camera Expansion Header*

The i2c and spi are external pins.

>> No.1931347

>>1924676
Digital displays are drawn from memory-mapped frame buffers. If you're using hand-holding libraries to draw pixels one by one you're NGMI. The only really fast way to draw pixels is directly manipulating the frame buffer. Using an external SPI display already puts you at a disadvantage, because you don't have direct access to its frame buffer.

Your description should just be code sample because your greentext is pretty ambiguous.

>> No.1931515

>>1931347
>If you're using hand-holding libraries to draw pixels one by one you're NGMI
I'm an electrical engineer not a code artisan
I don't know any of the hacks they use to make shit run more gooder
that's why I'm trying to make this thing

>> No.1931522

>>1931344
>The i2c and spi are external pins.
I specifically said the PC. Those are not exposed directly.
sounds like ethernet will be the easiest for you.

>> No.1931545
File: 932 KB, 711x919, his_happiness_and_joy_REINFORCED.png [View same] [iqdb] [saucenao] [google]
1931545

>>1931344
The easiest to make interface will always be UART. Buy a RS232 chip. Connect Tx/Rx and ground to the RS232 then to a DB9 connector. Buy a RS-232 to USB adapter cable from FTDI or another company with good drivers. If you're using Windows, then you'll be able to see the USB/RS232 cable pop up as a serial COM port. You can use serial programs like Teraterm to pass strings of characters back and forth with your device. Things like USB will require you to have special drivers to communicate, I assume for all the other stuff you'll need to make your own PC-side drivers as well unless you have other ideas or products you can use. I have no idea what a Teensy is but if it has UART interface as well you can do what I just said with that product as well. Pretty much any development I ever did I first set up a UART/RS232/USB connection for debugging output.

>> No.1931553
File: 322 KB, 591x716, okay_retard2.png [View same] [iqdb] [saucenao] [google]
1931553

>>1931327
>>1931329
>>1931545
I didn't see you said "computer running Linux". In that case, it is even easier than windows. You'll see something like /dev/ttyX and that will be your serial device. Like this: http://blog.marcinchwedczuk.pl/connecting-to-raspberry-pi-via-uart
You don't even need the GUI to see the serial. If you have a normal distribution, you can pull out your usb adapter and ls /dev, then pop it back in and ls /dev again. The kernel should automatically load the device for you.

>> No.1931563

>>1931515
>I'm an electrical engineer not a code artisan
Are you actually an engineer who's done the certification or do you just tinker with electronics?
Anyway. Still need to see sample code to understand where you're going wrong, if it's something you can improve upon.

>> No.1931603

>>1931545
>>1931553
Actually, I need to do several things: send data from a Teensy 3.6 (ARM microcontroller) to the Jetson TX2 running ubuntu. The Teensy has a microUSB port that you use to upload code onto the Teensy from a computer. You can also send data through it, however, Ive had issues with buffered data (at least I think thats the issue) so its not super reliable. Rather than use the microUSB port or a uart to usb converter I figured I could connect the Jetson's uart to the Teensy's uart. I never did this before though.

I will also have to send data from the Jetson to a Windows PC (I know it seems complicated but theres no easy way around this.)

>> No.1931711

What we're on the topic of sending data to and from a PC, what is a good language/source to design a GUI that will interface with a serial port?
I can build the hardware to have a microcontroller communicate with the PC through a UART-USB interface to a serial port on the PC. However I want to code a really basic GUI that can read in the serial data and send some back. Like a window with a couple buttons that I can click to activate something on the micro.
I've tried Processing, and it works, but has some irritating flaws that really ruin its use for what I want.

>> No.1931719

>>1931711
Easiest option would probably be python+tkinter

>> No.1931738

>>1931711
I've had very positive past experience with the Qt framework. You can get a simple app running ridiculously quickly, and developing further functionality happens very organically.

Theres a really good tutorial series by a guy called "VoidRealms". It's based on Qt4, but all of the GUI stuff and principles are almost exactly the same as today.

https://www.youtube.com/watch?v=6KtOzh0StTc&list=PL2D1942A4688E9D63

Each vid is like 10 mins and covers each GUI element really well.

The only barrier is having to install essentially a full development environment, namely Visual C++, CMake, and then Qt itself, which can take a while. Plus getting acquantied with the Qt GUI model is, although well-designed, a non-zero time investment.

>> No.1931744

>>1931719
I've come across that before, I'll check it out, thanks!

>>1931738
I check that out for sure, I've heard of the Qt framework before, but never really found a good starting point, so I've been lost. Hopefully I can get some good info from his videos.

I should have thrown out there that I wanted to avoid C++. No matter though, I'll find a way through it.

>> No.1931838

>>1931344
FYI on the TX2 the SPI on J21 is SPI3 if you have to fuck with device tree stuff. took me a day to figure that out since literally every document calls it a different number.
This may have changed but for dev board versions B03 and C04 the SPI on J21 lists 2 HW chip select lines but only one is broken out. the other CS1 on J21 runs to a ball on the 400pin header that is a no connect. On TX1 it goes somewhere but nvidia was lazy and didn't update the devboard when they moved the pin on the module.
Also you should know that the SPI lines and most GPIO's on that devboard on J21 except for i2c use a TI TXB0108 level shifter to go from 1.8 to 3.3 which will oscillate if your wires are too long.
>>1931603
>>1931545 mentions UART but the UART0 line on J21 pins 8 and 10 is used for the serial console so you need to disable it in the device tree if you want to use it. There are other uarts on the J26 iirc but I think they are 1.8V so you will need a level shifter.
all and all i'd say if you want out of the box comms UART (not UART0) or I2C.
if you are comfortable modifying a device tree (there are guides for this) the fastest MCU comms protocol is going to be SPI.
all three of these protocols can be used from userspace but if you need async transfers you are probably stuck with UART unless you want to make a kernel driver and run an IRQ line from the micro to the TX2 to inform when data should be read. Or poll the device though that's slow.

>> No.1931840

>>1931711
QT has a GUI builder so i'd say that one.

>> No.1931860

>>1931744
Qt has python bindings.
Look into Kivy. You declare the UI, similar to how a webpage UI is declared in HTML. It udes a DSL but it's not hard to learn if you get the basic idea of HTML and CSS.
And don't discount a webpage for a quick UI.

>> No.1931964

>>1931711
Why not just use Teraterm and use the keyboard buttons to send commands? From the MCU just send characters back and they'll show up in the window. You won't need to do any programming on the PC-side.

>> No.1931968
File: 1.33 MB, 721x714, cosmic_feel.png [View same] [iqdb] [saucenao] [google]
1931968

>>1931603
For all the interfaces listed here >>1931344, usually MCU to MCU communication will be I2C and SPI. I2S is for audio and CAN is differential mode for when you don't have a common ground (you'll need a transceiver IC). All the other I/Fs, you probably won't be able to write drivers for easily. From what this guy is saying >>1931838, it sounds like the Jetson runs Linux (RPi knockoff) and you're trying to link it like this: Teensy <==> Jetson (Linux) <==> PC. And he also says the Jetson's UART is linked to PC. I know Linux only supports master mode on SPI and I assume the same applies to I2C. Do you really need the Jetson? I'd just link the Teensy to the PC via UART/RS-232/USB-adapter and then program on the PC. I don't care enough to read schematics and datasheets for you. Good luck man.

>> No.1932350

>>1931964
I want to have a GUI that will display the status of various things, and buttons or sliders/knobs that I can adjust to send data to the microcontroller. For a couple registers or variables, a text based terminal wouldn't be bad, but I'm looking to possibly scale up.
A dedicated GUI program can also be deployed to multiple computers and be plug-and-play instead of setting up a terminal, selecting the proper /ttyx device and hoping it stays stable.

>> No.1932372

>>1931968
>CAN is differential mode for when you don't have a common ground
hmmmmm..........................................................................................................................................................................................................................................................................................................................................................................................................

>> No.1933441

so i'm trying to run 4 h-bridges from this arduino nano and wrote directly to the output register (PORTD,PORTB) to avoid the arduino sketch statement autism but the motors run one after the other instead of simultaneously
i'm setting bits to 0 on one line and 1 on another and changing them back after a delay
heres part of the code

void loop() {
forwardBackwards();
delay(1000);
}

void fixedMediumSpeed() {
analogWrite(enA, 150);
analogWrite(enB, 150);
analogWrite(enC, 150);
analogWrite(enD, 150);
}

void forwardBackwards() {
fixedMediumSpeed();
// Turn on motors
PORTD |= B01000100;
PORTD &= B01101111;
PORTB |= B00010001;
PORTB &= B11011011;
delay(2000);

// Now change motor directions
PORTD |= B10010000;
PORTD &= B10110111;
PORTB |= B00100100;
PORTB &= B11101110;
delay(2000);
}

>> No.1933588

>>1933441
Gonna need some schematics of how you have stuff hooked up.

>> No.1933599

>>1931327
Ethernet

>> No.1933603

>>1933441
First of all, bad practice to set and clear bits directly to register like that.

If you want to do some bitmasking, do it in a separate variable, then once you've done all your setting and clearing, write the updated value to register.

In between your first |= and &= there's a time where you've set all the bits in register.

>> No.1933622

>>1933603
>>In between your first |= and &= there's a time where you've set all the bits in register
what does that mean

>> No.1933624

>>1933622
Put it this way - is there any explicit reason why you have the AND mask and the OR masking on separate lines?

>> No.1933628

I want to dynamically generate sine table arrays
until now I've been doing it explicitly, manually declaring every value in the array. This is a PITA and very inflexible.
What I want to do is initialize the array automatically when my microcontroller launches. I don't know how to do this while keeping the array available/in scope of my void loop() function (for example, I can initialize it in the setup() function but then it's out of scope. I can initialize it in the loop() function but then it re-initializes every time it loops)

how is this normally done

>> No.1933630

>>1933624
because i want one pin to be high and the other low
and you can't set both bits 0 and 1 in one statement
>>1933588
https://files.catbox.moe/jelh49.jpg

>> No.1933631
File: 81 KB, 468x498, 1373013280866.jpg [View same] [iqdb] [saucenao] [google]
1933631

>>1933628
>how is this normally done
By writing a small program to generate the sine table as source code for an array, duh. If you need a sine table you probably don't want to have floating point code linked in, that's the very fucking reason you're using a table.
>setup()
>loop()
coding with Arduino is like cooking with a microwave.
>>1933630
>you can't set both bits 0 and 1 in one statement
PORTD = (PORTD & B01101111) | B01000100;

>> No.1933633

>>1933631
I'm doing my best with what I know

>> No.1933635

>>1933631
aren't you fucking up rx and tx
besides isn't the time between two statements basically nothing how could it be the reason for the problem

>> No.1933637

>>1933630
Exactly. You want to set some bits and clear some bits -, but since you're modifying the register directly you end up setting bits and writing it all out, then clearing bits.

In between the set and clear you end up driving more bits high than intended.

You should store the value in a local variable, do all your setting/clearing bits to that variable, and then assign the register equal to your local variable.

>> No.1933638

>>1933635
>rx and tx
What the fuck are you even talking about? Where did anyone even say rx or tx? Isn't this supposed to be a motor control?
I was showing how you can set and clear bits in the same statement because that anon thought &= and |= were magical and not simply shorthand for X = X & something.
But really it's better to AND off all the bits you're playing with, it's called a "mask", then you OR with whatever pattern you need, so it's obvious which bits you're fucking with and which you aren't. Right now it's a fucking mess of zeros and ones that's like reading an un-mowed lawn, because almost none of them are consecutive. And you're fucked if they're in multiple places in your code and you have to change some of them.
...
#define BMASK (~B00110101) // PB5 PB4 PB2 PB0
#define B1 B00010001 // PB4 PB0
#define B2 B00100100 // PB5 PB2
#define DMASK (~B11011000) // PD7 PD6 PD4 PD3
#define D1 B01000100 // PD6 PD3
#define D2 B10010000 // PD7 PD4
...
PORTD = PORTD & DMASK | D1
PORTB = PORTB & BMASK | B1
...
PORTD = PORTD & DMASK | D2
PORTB = PORTB & BMASK | B2

>> No.1933641

>>1933637
Like:

portdLocal = 0;
portdLocal |= B01000100;
portdLocal &= B01101111;
PORTD = portdLocal;

>> No.1933642

>>1933641
Why does it need to be a temp variable instead of using a single fucking expression? You don't get bonus points each time you use &= and |=
Or are you just a cargo culter who doesn't even understand what they mean

>> No.1933647

>>1933638
some of the bits in portd are rx and tx

>> No.1933650
File: 80 KB, 300x300, 8912b2e58acff9885600133516d75597.jpg [View same] [iqdb] [saucenao] [google]
1933650

>>1933647
That's nice, where does it even say that?
This is why you put fucking comments in your code and use descriptive variable names.
>YOU GAVE ME RAW NUMBERS

>> No.1933654

>>1933650
i mean it's pretty clear from the statements that there are some bits in portD and portB that i just want to leave as it is
>>1933641
for the same reason could i put whatever is in portD first in portdlocal

>> No.1933657
File: 117 KB, 937x960, 1399032898005.jpg [View same] [iqdb] [saucenao] [google]
1933657

>>1933654
>i mean it's pretty clear from the statements that there are some bits in portD and portB that i just want to leave as it is
Did you even read the explanation of what a "mask" is?

>> No.1933661

>>1933657
81

>> No.1933666

>>1933630
You know this is an imageboard, don't you?

>> No.1933685

>>1933657
41

>> No.1933877
File: 82 KB, 611x643, Screenshot_1.jpg [View same] [iqdb] [saucenao] [google]
1933877

>>1933441
i did a stepper controller with an Hbridge as a final prject as a proof of concept and did this in the arduino IDE as the function definition that is called to do steps

the speed and rotation direction is done by reading a potentiometer with a middle detent so if its left i one way and if its right of the deten its the other way with turning the pot more is faster

the speed is basically set with a delay and with more pot angle you get less delay in the main function (its janky and not really efficient but as i said its a proof of cocept and it works well)

you most likely messed up some wiring shit although i didnt really have a good look at your program

>> No.1933975

>>1933441
>wrote directly to the output register (PORTD,PORTB) to avoid the arduino sketch statement autism
>delay(2000);
The only thing autistic here is you by trying to save a few microseconds by not using arudino API then delaying a whole 3 seconds between loop iterations. Incase you dont know, one second is 1 million microseconds. use the proper API if you don't know what you're doing.
>>1933622
>>1933603 is right and if you don't even know what that means then maybe you shouldn't be accessing the registers directly.

>> No.1933979

>>1933642
>Why does it need to be a temp variable instead of using a single fucking expression?
increases readability while offering no performance drawbacks. g++ will optimize it out anyways by default in arduino.

>> No.1934094

How the fuck does someone with no programming knowledge get started at learning the full ins and outs of Arduino? I can solder and have made little piddly stuff (I used the blink-without-delay and arrays to make a knockoff gameboy pretend to play Pokemon Yellow like TwitchPlaysPokemon) but beyond reading code examples and bashing shit together into some working hodgepodge, I have no idea how to do anything. Have any of you been self-taught in Arduino and found a good syllabus to follow?

>> No.1934117

>>1933975
i'm trying to save not writing 12 lines every time i want the motors in a different direction
>you shouldn't
i'll access your mom's pussy directly too

>> No.1934154

im comfortable with c and electronics but want to move away from the arduino platform.
is starting with atmega and attiny chips + a programmer the next step? or do you have any other recs? also any recs on a good ide?

>> No.1934168

>>1934117
You should encapsulate those lines in a function so if you move the motors more than once you must call a function.

State of brainlets on this thread

>> No.1934184

>>1934154
>is starting with atmega and attiny chips + a programmer the next step?
yes but it most likely wont be cathartic or fullfilling like most people think because arduino +IDE is literally that

but now you have to pay for a programming tool ...its more powerful but its also more tedious so you will still use the arduino platform for some projects and general prototyping and troubleshooting

>> No.1934192

>>1934094
>How the fuck does someone with no programming knowledge get started at learning the full ins and outs of Arduino
every "i want to learn what should i learn" type of post is a loaded question because it all depends how deep you really want to go

also you cant "learn Arduino" since an arduino is not a concept its just a glorified PCB that has an off the shelf microcontroller and usb interface chip as a programmer soldered to it
you can learn basic electronics and programming and apply that so id recommend you pick up first
>introduction to electronics(physics side of things) textbook
>introduction to electronic (analog) circuits textbook
>introduction to semiconductors textbook
>introduction to digital logic textbook
>introduction to electronics measurement
>introduction to electrical machines textbook
>introduction to automation and regulation systems
>introduction to algorythms and programming
>introduction to microcontrollers and microprocessors (should be in the digital book but just in case)

congrats once you read all that and understand the concepts you know the basics ...anyone that says you dont need all that or doesnt know all that is just a hobbyist and knows and understands much less then they think they do...everything else is just upgrading on the basics and depend on what you will be doing

>t. masters degree in electrical engineering

>> No.1934202

>>1934184
doing anything myself without a hobbyist platform would be nice, second year student in robotics (basically a comp sci + electronics) so getting a head start on microcontrollers and learning the tedious stuff would be fulfilling. already got an usbasp and a pic programmer from projects a few years back.

the arduino is nice and all with serial monitor and ease of programming but id rather intigrate the microcontroller in a dedicated pcb myself. am getting a couple of attiny85 but still unsure about what ide to go for and expanding to other mcs would be nice

>> No.1934205

>>1934202
then yes absolutely that would be a nice step up..would not be very hard and should allow you to make your own boards and integrate MCU-s into other devices ...good luck

>> No.1934292

>>1934192
Sorry, I should have been more specific. I meant "What's the best way to learn the Arduino IDE and its programming language?" There's so much possible that it fills me with decision paralysis.

>> No.1934303

>>1934168
sill more economical to use registers since eventually i want to write it in C

>> No.1934311

>>1934292
>What's the best way to learn the Arduino IDE and its programming language
yo dont learn a programming language ...you learn programming by learning how algorythms work how to implement them , how digital systems work and how to implement them ...a programming language is just a language

once you learn how to program the language is irrelevant and is chosen by using the one thats cheapest/easiest for you to read

>> No.1934321

anybody know of any good guides/introductory resources for working with SPI on a microcontroller (stm32)?

>> No.1934332

>>1934303
Compiler will inline the function if its small enough. Also the issue with your current approach isnt a performance one, its that its functionally incorrect. You are treating an IO port like its a CPU register and writing your computations out on the bus before they are fully done.

>> No.1934353

>>1934154
8 bit platforms are dinosaurs. Go with stm32, the ide and compiler are free.

>> No.1934362

>>1934321
At what level do you want to work with it. You want to set all the registers? or you want to use a framework?
You best bet is always to open up a library that uses it and see what they do. Starting with arduino libraries and reading them is a fine way to do that.
You should always start with something that works and read how it does it. Learn which are the relevant parts (usually 2 write functions and 2 read functions) and read the datasheet to match up what it's doing and why.

>> No.1934364

>>1934353
never take advice for someone who thinks bit width isn't anything more than a tool, to be used where and when appropriate.

>> No.1934472

>>1934332
>writing your computations out on the bus before they are fully done
whats the time between two program statements anyway

>> No.1934516

>>1934364
Been using avrs and pics since 2002.
The 32 bit arms run faster, have more flash, have more ram, more timers, and more features, and can do more arithmetic per clock for less $ than a comparable 8-bit avr. Even 8-pin stm32s have DMA. With a cortex-m0+ you get a 2 stage pipeline just like the AVR so you get similar realtime guarantees, you can still count instruction cycles in assembly if you wish. Going to stm32 is not merely a different tool flavor, you get all the goodness of realtime 8 bit devices and then some. They are well-suited to replace 8 bit devices almost completely.

>> No.1934535

>>1934472
Probably in range of microseconds, depending on processor speed

>> No.1934540

>>1934472
Long enough for lazy-programming GPIO glitches to ruin your day

>> No.1934544
File: 793 KB, 1098x557, arduino.png [View same] [iqdb] [saucenao] [google]
1934544

If I removed the reverse button and potentiometer from this setup, would the motor run with the code I have uploaded to my arduino on its own as long as the arduino has a 5V power source plugged into it? My code calls for automatic direction switches and a constant speed.

>> No.1934780

>>1924652
I bought a beaglebone black to run an HP pico project so I could develop some ideas. But, when I Tight VNC ssh into the beagle bone the keyboard mapping is wrong. There is very little info on the net, I searched a lot, found only a few mentions of the same problem, but no luck. So I am stuck. Anyone got any ideas?

>> No.1934782

>>1925277
whats your definition of bizzare? complex, you never thought of it, illegal ?

>> No.1934804

>>1934780
Could be locale settings.
Google how to change your locale.

>> No.1934853

>>1934353
seems kinda overkill for my current projects, will keep in mind for the future tho. ty

right now im designing my first h-bridge with drivers and a control board with sensors for a mini sumo robot. also some ps/2 keyboard interface for a sinclair zx81

>> No.1934892

>>1934544
I guess so, it seems that that setup is only using PIO2 as an input and reading whether it's high or low.

>> No.1934893

>>1934544
And the same with the A0, just reading a voltage level from it. You really should be able to tell this from the code (if there's any with that jpeg) and schematic, be careful and don't burn anything.

>> No.1934917

>>1934353
i sell roadside lamp blinkers with built in battery charging with solar cells ...why the fuck would i spend more for an stm32 instead of using a attiny20 that has 20 lines of code on it

use what you need and you will never need more than you have

>> No.1934918

>>1934544
are you the cnc noob from /ohm/ ?

>> No.1934920

>>1925277
watercooling on raspi is still the bost "bizzare" thing i saw done to it

>> No.1934963

>>1933631
>coding with Arduino is like cooking with a microwave
LOL, this is my new favorite saying

>> No.1935280

>>1934535
>>1934540
LOL, I have been writing programs like this >>1933441 for more than a decade, millions of units in production, and when I hook up a 1+ 5+ whatever GHz oscilloscope I have yet to ever see a "glitch" from using &= ~0x or |= 0x operators. And yes, I've made stuff using Atmel ATMEGA48/88 that went into production. Not just that, but any example projects that come with any semiconductor's products (SiLabs, Cypress Semi, Infineon, TI, just to name a few) all have those operators in use. You can get as autistic as you want using tmp buffers before writing to registers but to say that &= |= cause issues in the field or even that you can detect some kind of errant change on a pin is pure head cannon.

>> No.1935285

>>1934353
It seems kind of weird that, even though many semiconductor manufacturers now product ARM Cortex M0+/M3/M4/etc MCUs, you keep shilling just the STMicro stuff.
>>1934154
Why not just buy the Atmel chip that you were using on Arduino, make the same circuit that you were using in your application, and then rewrite the program using just a register map .h and directly manipulating registers? You'll see very closely how different it is from using the Arduino API libraries. The best resource is the datasheet/usermanual for the chip you are using. For an 8bit item it will be all you need to make the product inside-out.

>> No.1935332

>>1933441
A thought just occurred to me (I'm this guy >>1935280) I don't know your motor, control topology, or what kind of transistors you are using to control its motion, but to be safe look into "motor dead time". Basically, transistors have faster/slower turn off and on times so that if you turn the next switch on before the previous switch can actually turn off you will have a temporary short circuit. You can add a small delay for now and prevent any issues until you know what kind of transistor you are using and what the respective ON/OFF times are. Good luck on your project.

>> No.1935337

>>1935332
I mean goto an idle state for a short period before switching directions. I never controlled stepper motors before so I'm not completely sure if it's necessary but that's all. Good luck on your project.

>> No.1935362

Can I use my mega2560 or RPi Zero to build a machine that can press buttons in a certain pattern for say mobile game grinding?

>> No.1935376

>>1935362
yes

>> No.1935381

>>1935376
Cool. Would you by any chance how an idea about what else would be needed?

>> No.1935384
File: 67 KB, 520x715, 1cycle_write.png [View same] [iqdb] [saucenao] [google]
1935384

>>1935280
>>1934535
>>1934540
&= ~ and |= instructions are completed in one cycle on ARM Coretex-M0. How much you want to bet compilers do the same thing to AVR?

>> No.1935392

>>1935381
yes


start asking concrete and direct questions or you will get a lot of one word anwsers
BUT! first google it a bit there are literally thounsands of projects and a lot of them are based on exactly what you are asking ...i will not start writing you a parts list , drawing you full schematics and giving you step by step instructions as to how to make it

>> No.1935394
File: 161 KB, 751x502, avr_1cycle_oh_shit.png [View same] [iqdb] [saucenao] [google]
1935394

>>1935280
>>1934535
>>1934540
>>1935384
Hey, look at this! AVR also can do &= and |= in 1 cycle. Unless you two can show your disassembler doing something else, stop making stuff up.

>> No.1935398

Anyone know if you can use one of those USBasp AVR programmers as a standalone MCU with native USB? Like a cheaper version of a badUSB. The badUSBs use an ATMega32U4 and the USBasp uses an ATMega8L.

Now the USBasp only has like 4 GPIOs, maybe 5 if I can use JP3. But that's likely sufficient to use with an IO expander (or a 74HC165) so I'm not too concerned. What I'm more worried about is if the ATMega8L would have sufficient progmem and RAM for turning into an actual USB peripheral like a keyboard or mouse, and whether it will be programmable through USB even after it's been programmed into a class-compliant USB peripheral. I'm guessing I'd need to use a jumper to tell it whether to boot into program mode or not.

>> No.1935401
File: 320 KB, 674x408, unknown (2).png [View same] [iqdb] [saucenao] [google]
1935401

>>1934893
I'm actually running pic related now, I still get a fault on my motor driver but I can see through the voltage reading on DIR and PUL that my code is running from the arduino because the voltage cycles. Can't remember what the max voltage through the whole cycle is but I think it's 3 or 3.5V? Something about that. I can see it cycle through the motor driver but the motor voltage sits idle and at ~0.5V on both poles.
>>1934918
yes...I figured here was the better place for my topic since I'm asking about controllers now instead of actual wiring schemes. I know this works now because I can see it cycling but the dumb driver still faults for who knows what reason. I have a DC motor coming tomorrow for my CNC. Pretty excited about it.

>> No.1935417

>>1935401
most people here are the same as there lol ..but good on you for trying anyways

>but the dumb driver still faults
whats the fault exactly and how does the motor turn when driven ?

can you post your code in a pastebin and pasting the link here? ...i will throw a look into it in the morning

>> No.1935429

>>1935398
I don't think it's native USB, it's two analog comparator pins. everything USB related is probably in firmware.
IT's an MCU, if you can physically reprogram it, yes, you can use it. But you'd need the firmware related to the USB implementation. Probably a lib somewhere has that, but it's not like you can just read a register or peripheral with the incoming USB data

>> No.1935440

>>1935401
(I have no experience with stepping motors)
0) Motor spins OK by hand?
1) What is the rating for your stepping motor?
2) What are you using on Vcc/Gnd on the HV terminals? Is it supposed to be 9-40VDC like on the bottom of the pic?
3) If you disconnect your load (motor) from both A and B terminals, stick in an oscilloscope do you see it run between Vcc/Gnd? If you don't have an oscilloscope, can you just stick in a multimeter and use your arduino to very slowly step through each "step"?
Sorry I can't be any more help...

>> No.1935448

>>1935398
Hi,
I've made my own mouse 4-5 years ago using an LPC11U24 (48 pins so plenty of leftover I/O). Generally, an MCU capable of USB will have special peripheral USB interface hardware and then you will possibly/probably have a library to control it. I remember a library I had to compile with my project to make it work. On the PC-side, I made my mouse compatible with the generic Microsoft HID mouse driver so I did absolutely no development for that. Supposedly NXP had a library you could use for the PC-side development but I didn't even download/open the file. I think you should be specific whether you want a USB host or USB device (like a mouse). As I understand it, host is way more complicated than device (drivers, etc). You seem to be familiar with Atmel stuff (I didn't know they got bought by Microchip), https://www.microchip.com/design-centers/interface-and-connectivity/usb/usb-mcus-dspic-dsc

>> No.1935460
File: 19 KB, 583x97, fault.jpg [View same] [iqdb] [saucenao] [google]
1935460

>>1935417
I figured it was pretty close if not nearly identical but hey, wanted to be accurate and stop bugging /ohm/.
>what's the fault exactly
hell if I know, just a solid red light that comes on when plugged in. over-voltage or over-current and I've already tried it with the 220 ohm resistors. don't know if that means add stronger resistors or get a small power supply. really should be able to handle what I'm giving it in terms of voltage since 24 volts is less than 40 so I'm leaning to stronger resistors in series with the breadboard connections. it's my only guess, realy.
>how does the motor turn when driven
well it doesn't but I haven't hand-cranked it. It's connected to a big rail right now and I haven't been able to pull it apart yet. I'll take a look tomorrow and see if that's something I can do.

>paste code
https://pastebin.com/qqyPe4DC
much appreciated. don't know if you'll find anything there since I can tell it's running but me just looking over I can see my step pin is wrong (code calls for 5, I have 3 hooked up). I also don't have anything in 8 which is the enable (or DISable) pin but I am unsure if I should bother connecting this.

>>1935440
no problem, I appreciate the input/brainstorming
0) most likely yes. I took apart another (i believe identical) motor for a similar project and it functions well.
1) 3 amps, workable voltage
2) 24V DC power supply, yes
3) I used a multimeter to measure the DIR and PUL pins as the arduino was plugged in and auto-running and I could see the cycles going.

>> No.1935502

>>1935460
I'm the "I know nothing guy".
0) When the motor is not connected to the power controller, it should be able to spin freely by hand. You might feel little detents with the stepper motor but that's it. If there's resistance, that might cause a problem when you try to drive it.
1) Did you say the overcurrent/voltage light comes on when the motor is connected only? Before driving the motor in either direction?
I know that in stall conditions on a normal motor, the current draw will spike (if it doesn't spin freely, it might cause a stall condition when you drive it). However, for stepping motors, they have something like a "holding torque" where you can hold the motor on a single detent/position. Maybe the microstep driver has a current controller for holding.
2) Can you send a signal from the Arduino to hold the motor on one position and see if you can turn the motor to hold on that torque or if it holds on any position?
3) The 220 ohm resistor is a power resistor and can handle what the motor controller is pushing out? Also, what's the resistance on the stepper motor's winding? I imagine it would be less than 200ohms (see something like this http://www.melco-service.com/docs/XT_Tech_Manual/Troubleshooting/Testing_Methods/Stepper_Motor_Resistance_Test.htm).).
4) The only other thing I can suggest is to add some dead time (yeah, I'm that guy) between switching states on your control. I don't know if you are just send "forward"/"reverse" to the microstep driver or whether you have to dictate the PWM states directly. If you have to dictate the actual PWM states from the Arduino I'd add dead time between each step in case you are switching them so fast the controller is detecting a short because it can't switch as fast. This is the most work, so I'd do this last if I were you (and you haven't found the actual problem yet).

>> No.1935519

>>1934804
thanks for your response. Its been a while as I have temporarily given up. If you are interested for the sake of interests, here is link that describes the problem and various responses about attempted fixes.
https://bugs.launchpad.net/ubuntu/+source/vnc/+bug/112309

I searched for days and tried every thing I could understand. Being newer to this it may be I lack the brain power at this point. I will get back to it as the year slows down.

>> No.1935524

>>1935429
Actually I think you're right. A quick look at the datasheet doesn't bring up any results for USB, compared to the 32U4 which definitely does. I think some Arduino Unos have a 16U4 on them as an integrated USB programmer, which is very similar to the 32U4. A normal 32(L) doesn't have native USB, so I guess it's a rarer feature than I thought.

I'd rather use an MCU with dedicated USB pins, as opposed to bit-banging like a digispark. But a quick search shows me that native-USB MCUs are significantly more expensive than similarly specced MCUs without that capability. Bugger, I guess. I suppose I'll either go for a 3.3V MCU (my ATtinys can probably do that) or shell out for some 16/32U4s. Sticking to AVRs because that's what I've got the programming hardware for.

>>1935448
The ATMega32U4 has an internal USB controller, as per:
http://ww1.microchip.com/downloads/en/devicedoc/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf
So I wouldn't need the extra hardware to make a keyboard or whatever using one of those (as is somewhat common), but I would still need to ensure that all the firmware on the MCU itself is set up correctly to make it class-compliant.
I'm unsure what kind of USB IC could work to make a device a class-compliant keyboard or mouse (or joystick, which I'm more interested in).

>> No.1935538

>>1935524
compliance to the spec does not indicate how you comply, only that you comply. You don't need to use an IC to comply, but some ICs make compliance easier.
Some arduino's like the DUE (i think) can act as USB-HID devices. I'd suggest starting there to see how they do it.

>> No.1935572

>>1935538
The Due is somewhat large and uses a relatively expensive 32bit ARM MCU. Plenty of power if you need it, waste of money and space if you don't. I think a bluepill is cheaper and also does USB HID, and they're ubiquitous enough and well supported enough that they'd be my go-to if I wanted a higher-power USB device.

A while ago I looked for a dedicated USB-HID IC that you could hook up buttons and potentiometers and such up to, but the only thing I found was some brit charging 25 quid for a self-programmed bit-banging PIC.

>> No.1935575

>>1935572
Doesn't have to buy one, anon, just hast to look at what they do, it being completely open source.

>> No.1935609

>>1935575
Even buying that Atmel ARM M3 MCU or something similar to it would be more expensive than STM32s, so I'm not considering it for the time being. And if I'm interested in how a native-USB MCU can handle things, I'd probably be better off looking at what examples people have made with a BadUSB or Leonardo, since price optimisation is my main deal.

Now that I remember it, there were some bit-banging USB libraries out there that might make the non-native stuff less painful than I'm imagining. I'll have to get on it with one of my bog-standard ATmega324s, probably running them at 3.3V because that's easier.

>> No.1935635

>>1935392
No, that's fair. I appreciate it. Thank you.
What would I need to Google in order to find an answer myself?
I do have some knowledge and tools regarding electrical components from school, but I am honestly lost regarding the big picture of it all.

>> No.1935636

>>1935572
WCH, the company that makes these cheap FTDI knockoffs, makes cheap MCUs with hardware USB:
https://www.electrodragon.com/w/CH55X_HDK

You can buy 10 pieces for 3$ of the CH551 on LCSC.

>> No.1935646

>>1935636
>the company that makes these cheap FTDI knockoffs
Oh yeah, the CH340s. Those CH551s do look useful, though spec-wise they're below ATtiny85 tier so I'm not sure how confident I'd be at shoving a program into them. Considering the prices ($3 vs $15 for 10) they're worth a try, but only if I can get a handle on their programming hardware and software.
Maybe I'll look into using V-USB on a digispark and see how far that gets me, as I already have a couple of those. Not enough GPIOs for most cases, but still possibly worth a shot.

I can't use one of those CH340s or other UART bridge, because they can't do USB-HID at all.

>> No.1935653

>>1935524
I'm this guy >>1935448.
The library for running USB on the MCU comes with the MCU when you buy it. Buy an evaluation board or make your own circuit after buying the MCU of your choice. The software should be provided by the chip vendor. From memory, I know you need a vendor & device ID but you can just reuse the chip vendor's IDs from the software they provide. If you're not going into production (sounds like you aren't) then you don't need any of that compliance stuff.
What I'm trying to tell you is go on the vendor's website, look for the USB-capable MCU you like, then look for "Tools and Software" or whatever page they have to advertise the development tools for the chip you want. There should be a link for the USB-support library. Writing a USB library (host or device) is not an easy job like SPI/I2C/etc and most people just use the chip vendor's software. I already sent you a link to one page full of that crap. It looks like you already found the chip you want so just find the software link, evaluation board, and then you can get to work. Class-compliant means registering with some body and passing tests, I imagine. If this is for work, I wouldn't be asking advice here. If this is a hobby jobby then why worry about bureacracy?

>> No.1935655

>>1935609
You want to Bit Bang USB?
Have you downloaded and looked at how involved the USB protocol is? Holy fucking shit I've been wasting my time talking to you.

>> No.1935660

>>1935653
>most people just use the chip vendor's software
IIRC for Atmels people use V-USB, which I think is 3rd party.

>>1935655
Not without the support of existing libraries, that's for sure. Maybe to a purist that doesn't count as "bit banging usb", but it's distinct enough from using native USB specs. Even though it isn't that tough to use such libraries to imitate USB, it's a less elegant solution compared to actually using an MCU with built-in USB-HID functionality, hence the reason for my quest in the first place.

But don't worry, I'll make every effort to understand how any libraries I use work to ensure my code isn't bloatware.

>> No.1935666

>>1935460
>https://pastebin.com/qqyPe4DC
the code looks ok i dont see anything wrong with it
> solid red light that comes on when plugged in
is it on when just power is connected? could be just the power on light because i didnt see any warning indicators in the datasheet but i cant be sure about that

> It's connected to a big rail right now
take off the motor ...or any motor you trying to test , you might be overloading the motor so the stepper driver stops it , or the motor is pulling more current than the driver , also give the specs of the motor or the nameplate so i will look at it myself
>1) 3 amps, workable voltage
what do you mean by workable voltage, if its a 48V motor then its low on power if powered by 24V supply

>>1935502
>0) When the motor is not connected to the power controller, it should be able to spin freely by hand.
if you have no experience with something then please dont give conflicting infromation...a stepper motor does not spin freely and should have a relatively strong detent when turning the shaft , and even stronger detent if you short the windings
>2) Can you send a signal from the Arduino to hold the motor on one position and see if you can turn the motor to hold on that torque or if it holds on any position?
most likely not..thats not really exactly how a stepper motor brakes


also 220 ohms on 24V supply is 100mA of current and that is most likely too little current to give any power if you want to give enough power and limit the current put in 20ohm (2x 10ohm must be high power resistors in ceramic or metal case )resistors which will give you 1.2 amps

>> No.1935809

>This demoboard is designed for both sensorless applications and the application with Hall sensor. But
for the application with sensor, please remove R36/R37/R38 and solder
R18/R19/R20/R21/R22/R23/R25/R26/R27.

am i completely retarded or do R18/R19/R20/R21/R22/R23 not exist?

https://www.infineon.com/dgdl/Infineon-Motor_Control_Shield_with_IFX007T_for_Arduino-UserManual-v02_00-EN.pdf?fileId=5546d462694c98b401696d2026783556

>> No.1935822

>>1935809
they are on the schematic so they are most likely on the underside of the board

>> No.1935829

>>1935822
shit you're right, just found them on the schematic. can't believe i missed it.

>> No.1935881

Need guidance on stepper motor controller for Arduino application. Driving a single nema 17 12v 0.4A 4-pole stepper.
Need to be able to command it to take XXX steps, brake in place, wait for trigger event, and repeat.
There are dozens of different boards and modules; any guidance on what stepper controller I should look at for this? Many don't seem to have the right inputs, drive DC motors or some other complication. In my mind input should be just step input, direction, and ground.

>> No.1935889

>>1935881
https://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/
i swear to god i dont know how people can google the most basic shit

>> No.1935902

>>1935889
Have a (you) for spoonfeeding me

>> No.1935979

>>1935394
You absolute numbskull, the post that started this whole conversation >>1933441 has TWO operations modifying the port.
>PORTD |= B10010000;
>PORTD &= B10110111;
These two operations don't happen in one cycle.

>> No.1935987

>>1935666
Get this, I changed the PUL pin from 3 to 5 on the arduino today, no other changes, plugged it in with my eyes on the red light indicator, saw the red light come on and thought "damn of course", and heard an odd noise and "thought shit what's that".

It was the motor running. It functions as intended now. Of course the delay isn't enough but who cares I can fix that. PSYCHED. Didn't think it'd be that easy today. The red light is on which SHOULD be a fault indicator but he'll maybe it's not. The green light is on/off with duty cycle.

>> No.1935992

>>1935666
>>1935987
Thanks again for helping, once I get that DC motor today in the mail both my contraptions should be solved. Big thanks to /ohm/ too they're great

>> No.1935994

>>1935992
Meant
>>1935502
too

>> No.1936014
File: 303 KB, 2584x1908, P1050286..jpg [View same] [iqdb] [saucenao] [google]
1936014

Well I finally got something working yesterday. A few weeks ago I found a junked chinesium music keyboard, one of the less crappy ones with a whole bunch of buttons on top to press, but the guts were still made of crap and multiple circuit boards were broken.
The one part that wasn't broken was the keyboard, and it had diodes on all 61 keys, and even had both sides of the matrix on separate 8-pin headers. So I've been trying to get it working with a Blue Pill. After many troubles including not having powered the board properly (I forgot I had to plug in the USB port to power it) I got it mostly working. After a while I realized why one column wasn't working was because I had tried to use a USB pin as GPIO, and the USB detect resistor was enough to make the whole column read as key-down. Shift over one of the connectors and re-route the last pin to the other side and now it can scan in full NKRO mode.
Next step is to make a basic serial MIDI-out and plug it into a synth. It looks like the hardest part is getting the hardware wired up, the software is just pushing some bytes out. Another thing I want to do is get a little OLED screen working with it. Then eventually I'll add MIDI-USB support. I'll still have about 8 pins and three unused keyboard matrix positions for switches and stuff.
>>1926518
Quick FYI, I've seen on ebay where some guy was selling SOIC-8 clips connected to an 8-pin header for under ten bucks. But mostly the way is to bring out programming pins on the PC board so it can be re-programmed at the factory.

>> No.1936173

importing this library causes the serial println to fail on my nano. How can I troubleshoot what the issue is? Is it likely just running out of memory?

Library: https://github.com/chrisramsay/i2cmaster

The code:
#include "i2cmaster.h"

void setup() {
Serial.begin(9600);
Serial.println("Setup...");
}

void loop() {
}

>> No.1936179

>>1936173
nope.
#include <Arduino.h>

>> No.1936189

>>1935609
>Even buying that Atmel ARM M3 MCU or something similar to it would be more expensive than STM32s, so I'm not considering it for the time being.
holy fuck anon, they are like a few dollars. how poor are you.

>> No.1936193
File: 122 KB, 1216x819, 1577815726574.png [View same] [iqdb] [saucenao] [google]
1936193

>>1935660
>IIRC for Atmels people use V-USB, which I think is 3rd party.
no. most people aren't retards and trying to bitbang USB. they buy a micro with it built in hardware so they don't have to spend all their CPU cycles doing one fucking thing.
Good luck with your futile quest for a poorfag SW USB solution.

>> No.1936198

>>1936179
adding that to the top still results in no serial println. deleting the i2cmaster include line results in successful println.

I downloaded the zip from github and do "sketch" > "include library" > "add zip library"

>> No.1936206

>>1936198
Can you post the error you are getting?
why are you bothering with this library, just use the native twi.

>> No.1936216

>>1936206
no error, it compiles and uploads the simple program, but it is not emitting the println which indicates something wrong to me.

I'm trying to change the addresses on some i2c components following this https://chrisramsay.co.uk/posts/2017/09/arduino-and-multiple-mlx90614-sensors-take-two/

I'm gonna hack at this a little longer then switch if fruitless

>> No.1936220

>>1936216
that library is shadowing some important symbols, or taking control of hardware the serial port needs (some timer, or the uart, no idea). you'd have to dig through it to figure out what

>> No.1936231

>>1936014
So wow, I found out that the "default" serial port was USART2. In order to get MIDI working on USART1, I had to stop using some pins for the keyboard, so I added a 74LS138. It wasn't working, so I took a board I made with 8 LEDs that can plug into a breadboard, and rigged it up with a bunch of DuPont connector wires. So much easier to debug some things when you can air-drop a few LEDs. Yep, I had connected one of the enables high when it should have been low. Gonna bring down a synth tomorrow and see if my super-basic MIDI note commands work.

>> No.1936330

>>1936014
>it had diodes on all 61 keys
Does that still work with "analog" buttons (i.e. the ones that detect keypress velocity), or does that mean it's a shittier on/off keyboard?

>>1936193
Oh you were referring to firmware for hardware USB devices? Sorry I misunderstood. V-USB is the alternative to having hardware USB, both of which are options I'm deliberating. Enough people are doing cheap USB projects with digisparks via V-USB that it's not a shot in the dark, not to mention the USBasp that I asked the question about in the first place, but I would definitely prefer the comfort of working with the dedicated hardware.

There doesn't happen to be a list of Atmel USB-compatible MCUs, does there? I hope a digikey search is sufficient for that.

Thanks for the help, anons

>> No.1936383
File: 230 KB, 1097x575, bluepill cheap.png [View same] [iqdb] [saucenao] [google]
1936383

>>1936330
Velocity is the second row of rubber buttons, you time the delay between each set, so yeah it's shitty in that way. But I have a Roland synth which has the second row and they never made the keyboard support velocity, so real products have gone without it. (it's also got a dead key, gonna fix that with a bit of foil later, I guess it's not a "real" synth without some kind of hardware problem) I've actually plugged an old Miracle Piano into it and the synth part supports velocity.
I'm only doing all this because the keyboard was the only part of the freebie chinkshit that wasn't broken, and I can try stupid things with it that I wouldn't do to a "real" keyboard.

Meanwhile V-USB is a shittier USB than no-velocity is a shitty MIDI keyboard. I don't know why people here are so obsessed with bit-bang USB, other than "muh Arduino board that I already have". Screw your one and only ten-Euro Arduino board, my bag of Blue Pills cost me under two bucks each shipped and they all have USB support, and clone ST-links are like six bucks more each, but a spare Blue Pill can be turned into one. I'm just thankful that MCUs are cheaper than Lego since Arduino came out.
It's a nice trick for people who want to use a Tiny to do something simple with USB, but it's not a general solution.

>> No.1936466
File: 1.32 MB, 1920x1080, 1585087679252.png [View same] [iqdb] [saucenao] [google]
1936466

>>1936383
Most use fake STM32 chips.
That's why so cheap.
If you want the real thing, get some other family than F1.
See: https://hackaday.com/2020/10/22/stm32-clones-the-good-the-bad-and-the-ugly/
I personally favor the L0 family because simple and efficient, but F4 are also pretty cool.

>> No.1936520
File: 191 KB, 1024x996, STM32F103VGT6-1024px-HD.jpg [View same] [iqdb] [saucenao] [google]
1936520

>>1936466
You can always hot air a genuine 48-pin STM32 onto it, doesn't even have to be F103 because based ST has been keeping roughly the same pinout. I've got a bunch of pick-n-place rejects from a place I used to work at, just straighten the bent legs with a razor blade lol.
Also I got mine back in 2016 or so before counterfeits got so bad, probably just late night "extra shift" chips. 20 boards and I've only set up four so far.

>> No.1936523

>>1936189
>why are you not buying a more expensive thing ehen a cheaper thing can do the same
holy fuck how retarded are you

>> No.1936564

>>1936523
>im so poor that a 50 cent micro is fine but if I buy a $1 micro I won't be able to eat this month

>> No.1936566

>>1936523
>Then a cheaper thing can do the same
no it cant. that's the whole point you dumb nigger. he's trying to save money by bitbanging USB instead of getting something that can do it in hardware

>> No.1936597

>>1936383
I agree with your view on V-USB.

>>1936466
>>1936520
Is there actually anything wrong with fake STM32 chips? How do they differ from real ones, aside from QC and failure rates and such?

>>1936566
But a bluepill can do it in hardware, right?

>> No.1936601

>>1936597
>Is there actually anything wrong with fake STM32 chips?
well, they aren't "fake". They are cast-offs or duplicates. You can't really "fake" an architecture. You can duplicate the architecture and release it unlicensed and not pay a licensing fee. You can also buy the cast-offs in bulk for cheap and sell them. They could be cast off for dumb reasons that are irrelevant to the silicon.

>> No.1936602

>>1936597
>How do they differ from real ones, aside from QC and failure rates and such?
That question is exactly the problem.
Because they are fakes, there's no datacheck you can reference.
If you want to, you can purposedly buy cheap clones that at least are honest about it, and thus have datasheets.
The GD32 line is like that. And the newer GD32V uses RISC-V instead of ARM, which makes it cooler. The peripherals are still copies of STM32's, but it is differentiated by the CPU.

>> No.1936610

>>1936601
>>1936602
So, buying a batch of "fakes" large enough with the ability to test them would probably be sufficient for a hobbyist? No clue how I'd test QFPs without one of those $20 sockets though, probably just easier to buy a bunch of assembled bluepills, test them, and chuck out any that don't work properly.

>GD32
For some reason I've never heard of that before. The higher level of abstraction from micropython or whatever be independant from the instruction set and the compiler will do all the work, making the GD32V identical to program, right? Unless I have to care about how many clock cycles something takes that is.
They're STM32 pin compabile, I assume?

>> No.1936614

>>1936610
>sufficient for a hobbyist
As a hobbyist, why even bother with fakes, at all?
Get boards based on other chips. AFAIK only the classic F104 "bluepill" chips have fakes. Get something else than F1. They're old crap anyway.
https://stm32-base.org/guides/getting-started
I like G0/L0 families. Cortex-M0+ based, they obsolete F1 completely.

>> No.1936615

>>1936610
>For some reason I've never heard of that before.
https://www.gigadevice.com/products/microcontrollers/gd32/
Today, I'd only look at the RISC-V family. ARM is, unironically, the past.
>The higher level of abstraction from micropython or whatever be independant from the instruction set and the compiler will do all the work, making the GD32V identical to program, right?
Correct.
>They're STM32 pin compabile, I assume?
The GD32 were, I don't know about the V, but highly likely.

>> No.1936621

>>1936597
>But a bluepill can do it in hardware, right?
yes, and stm32cubemx has examples for USB HID and a GUI configurator.
Just make sure you pick the clock frequency correct for the PLL. iirc bluepills have 8mhz crystals but the default example uses 16mhz.

>> No.1936626

anyone seen those slow moving wheeled robots that look like they have a lot of control on their wheels those are low rpm encoder feedback motors right? or are they high rpm encoder motors? a high rpm one would just have spergy motion like a no feedback one right?

>> No.1936636

>>1936626
the more data you have, the better you can make decisions. If you can process data quickly, act quickly, and respond quickly, you have more control.

>> No.1936661

>>1936614
Point taken.
At this point I'm probably going to design a PCB something akin to a bluepill, but with a few changes to suit my needs. Like an integrated ADC and DAC that's better than what comes on them. No integrated programmer though, ICSP via a header only.

>>1936615
I heard of some issues with RISC-V compared with ARM a while ago, maybe it was just the chinese connection. But that was with reference to higher power devices like smartphones and laptops, so either way it probably doesn't apply here.

>> No.1936662

>>1936661
current available RISC-V architectures are no where near the maturity level of older architectures. basically doesn't matter if you are not trying to squeeze out every joule/mm though.

>> No.1936664

>>1936662
>joule/mm
Is that supposed to mean anything?

>> No.1936671

>>1936664
if you don't understand it, you don't need to worry about it.

>> No.1936699
File: 109 KB, 769x641, 1597337474032.png [View same] [iqdb] [saucenao] [google]
1936699

>>1936661
FYI bluepills and ARM cortex M processors in general use JTAG for debugging so you will need one of those to program it if you don't buy one with a bootloader pre-installed.
If you don't already have one, Segger makes a JTAG debugger (edu version is cheapest) and their IDE is free for personal use which I personally prefer. There's also pic related.

>> No.1936705

>>1936699
jlink or stlinkv2 from the usual /csg/ shops.

>> No.1936943

>>1936671
I'm a physics guy, I want to know more. Is it a semiconductor term? Condensed matter and quantum were my weakest subjects.

>>1936699
Was gonna get >>1936705 either way. More expensive than something like a USBasp, but price for a programmer doesn't really matter so long as it's not like $20 or more. Fuck PicKits btw.

>> No.1936951

>>1936943
no, it's just a general concept of minimizing energy per unit area, and I wasn't being exact with the units.
Small low energy devices wouldn't use RISC-V because, for the same functionality, it's bigger and more power hungry. Most people wouldn't care too much about that, but it gives a strong indication on the maturity of the architecture.

>> No.1936969

>>1936943
>price for a programmer doesn't really matter so long as it's not like $20 or more. Fuck PicKits btw.

Pickits are also powerful debuggers. They are quite fast and powerful for the cost.
I've found that most people who complain about the cost of debugging hardware don't use all the features.
If you are only programming, then yes, under $20 all day. But real-time trace and debugging for all architectures? That's pricey.

>> No.1936972

>>1936969
I guess you're right. I'm more of a mind to just throw some signals to unused digital outputs and monitor them with a cheap logic analyser, but if you get a proper error traceback then that's obviously going to improve workflow.

>> No.1937071

>>1936943
>Fuck PicKits btw.
I do still like my pickit2, which I got from microchip. It's featureful as fuck. Still use it once in a while as e.g. spi interface.
Can't say about clones, and I know pickit3 is garbage. Also, I consider all the PIC family of µC obsolete. Microchip knew as well, thus they bought atmel and focused on that.

>> No.1937075

>>1937071
>I consider all the PIC family of µC obsolete
While they're fine for lower tech stuff, there are much cheaper µCs out there for that kind of stuff.

>> No.1937077

>>1937075
Yes. Pretty much anything is better than a pic at performance.
And, if your focus is specifically lowest possible power, msp430 destroys pic.
Furthermore, the only open way to work with pic12/16/18 is assembler.
And pic assembler is horrible, with a single register (W).

>> No.1937120

Are there any relatively powerful (50+ MHz) 32-bit MCUs in a DIP package? is that a thing? DIP is so convenient to work with and I don't know of anything besides the 8-bit AVR stuff

>> No.1937131

>>1937120
Get familiar with 8-SOIC to DIP breakout boards, then you can create your own "DIP" from SOIC µCs.
Else, use a DIP form factor devboard in place of a microcontroller.
Basically, pick your family here:
https://stm32-base.org/guides/getting-started
And then /csg/ your way into such devboards via aliexpress. Just avoid F1 family, that has F104 clones aplenty.
I'd suggest GD32V, that's STM32-like peripherals but RISC-V.

>> No.1937133

>>1937120
>DIP package
Only convenient for breadboarding and perfboard. In both instances, 50MHz will be a fucking nightmare.

>> No.1937158

>>1937120
You get a dev board that has header pins like blue piill or teensy and slap that into your breadboard. DIP is dead, NXP had a couple of DIP ARMs but they're gone. You can only get pre-MIPS PIC, AVR, and MSP430 in DIP now, and they're all going to be 5+ year old parts.

>> No.1937168
File: 31 KB, 466x385, 1574145459747.jpg [View same] [iqdb] [saucenao] [google]
1937168

Guys I'm getting pretty frustrated here, can anyone help me?
I don't want to double-post, but /mkg/ seems more interested in buying stuff than building stuff and the people here seem pretty knowledgable, so I'll crosslink


Long story short:
>I want to use pic related to make a ps2/usb adapter
>I flashed atmels DFU bootloader
>Dunno how to enter bootloader
>it seems I can upload the tmk firmware .hex with dfu-programmer from my linux box though
>>It doesn't work though

>>>/g/78372868
>>>/g/78372944

>> No.1937171

>>1937168
have you flashed boot reset fuse? Or hardware boot enable fuse?

>> No.1937173

>>1937171
I don't know to be honest, here is the project I am using:
https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb
I just can't get a grasp on how the hell to use this aaaa
Is there any way to check these fuses easily? Do I need to connect it with the usbasp programmer again to do so?

>> No.1937174

>>1937171
>>1937173
I tried it:
avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done. Thank you.

Used this commmand: avrdude -c usbasp -P usb -p atmega32u4 -U lfuse:r:low_fuse_val.hex:h -U hfuse:r:high_fuse_val.hex:h

I don't know how to read any meaning out of these fuse settings and if I could do that I wouldn't know how to interpret their significance for getting this tmk_keyboard firmware project running correctly

>> No.1937203

>>1937171
P-please can you help me?

>> No.1937240

>>1937203
Essentially you need to check if DFU is working (maybe read DFU bootloader manual, atmel has one)
Registers seem fine, programmers seems to work fine with MCU.
So find if after flashing with DFU bootloader device appears with standard code for VID/PID

And since fuses seem ok, simple reset should be enough to get into bootloader.
Afterwards after flashing with tmk firmware - check if device with tmk VID/PID appears, codes/descriptions in config file

>> No.1937258

>>1937120
go to your electronics supplier of choice ..choose MCU-s and then filter by dip package ..thats all you can do to find them ...if you find none you can get dip adapters for every chip package

>> No.1937259

>>1937071
>I consider all the PIC family of µC obsolete
>>1937077
>the only open way to work with pic12/16/18 is assembler

I really wish everyone that likes to shit on PICs would stop using 20+ year old hardware as examples. Their old hardware was pretty trashy, but modern controllers and processors are quite powerful.

>> No.1937262

>>1937120
Parallax Propeller:
https://www.parallax.com/product/p8x32a-d40
It has 8 "cogs" (separate processors) on a single 40-pin DIP.

>> No.1937263

I'm currently programming an atmega328-based timer with custom functions. One of them is to input a sequence of durations and cycle between them

>Example: duration A=10s, duration B = 5s, Duration c = 2s
>Timer: 10s>beep>5s>beep>2s>beep>10s>beep etc.

The I/O for the timer is 3x 2-digit 7-segment LEDs so I'm storing the durations as int[][6] arrays. Around [2][4] the saved integers turn to mush. That leaves me with 2 questions:

>1) Is an integer array constrained by the 16-bit limit of an integer? ([2][4] is 16 "bits" into the array)
I assumed that an integer array just declared all the values IN the array to be integers.

>2) Is it smarter to save the values to EEPROM rather than in a global variable?
I've never used EEPROM before but I'd imagine that a large array might affect RAM.

>> No.1937265

>>1937259
>Their old hardware was pretty trashy, but modern controllers and processors are quite powerful.
And there's absolutely no reason to use it.
pic12/16/18 are the same old crap. Yes, the open way to use them is still to write asm, as there's no open compilers for the architecture.
pic24 is not comparable to the msp430 it tries to complete with. Plus the latter is established. It'd be stupid to use pic24.
Whereas there's basically no reason to pick pic32 over the myriad of alternatives (stm32, esp32, gd32v, sam (atmel=microchip!!)).

>> No.1937365

>>1937265
When you say "open compilers" do you mean open source? I'll agree there are no open source, but Microchip offers the XC8 C compiler for free and it works well.
PIC24/dsPIC has been around 19 years, and while the msp430 has been around 27 years, in modern times that's not a big difference. I'm not saying the PIC24 is better than the msp430, but its not BAD. I prefer the dsPIC over the PIC24, but I do a lot of DSP. 16 bit controllers are the least popular.
I'm not big into the PIC32, so I'm certainly not going to argue that point. I've used them back when they were first released on the initial MIPS arch and they were terrible. The newer revisions are so much better, but I don't have a need for them. Microchip even seems to not like them as much as their SAM series now that they picked up Atmel.

>> No.1937447

>>1937365
>When you say "open compilers" do you mean open source? I'll agree there are no open source,
Yes, what else would I mean but open source? Seesh.
>but Microchip offers the XC8 C compiler for free and it works well.
Yet if you're sane you'll either use the open stack or nothing. I choose nothing, because I pass on PIC asm, considering there's fine alternatives to suffering PIC12/16/18 hardware.
>PIC24/dsPIC has been around 19 years, and while the msp430 has been around 27 years, in modern times that's not a big difference.
PIC24 is and has always been a (failed) attempt to compete against msp430, which by the way isn't just superior hardware, but also has superior open toolchain.
>Microchip even seems to not like them as much as their SAM series now that they picked up Atmel.
That extends to 8bit, where xmega/tinyavr pretty much succeeds both older AVR8 and PIC12/16/18.
Of course PICs have their own fanbase and Microchip won't abandon existing customers, so Microchip will likely keep making the existing chips for a decade still.

>> No.1937450

>>1937263
code? Because first question is hard to understand. If array is initialised as int type, all members of it will be int type.

For second question - if you need to store variables to retain values after reset - go for eeprom, otherwise no real benefit especially if you plan on changing durations constantly

>> No.1937459

>>1937263
int[][6] is an incomplete declaration.
for a static array you need to specify both parameters. you are probably going out of bounds on memory.
An array of a type is equal to the multiplication of all dimensions times the type size. so an array of type uint32_t [3][4][5] == sizeof(uint32_t) * 3 * 4 * 5 bytes. Also arrays of any dimension are stored linearly in memory so accessing a multidimension array with total size uint32_t[5][5] like declared_u32_array[1][2] is the same as ((uint32_t *)declared_u32_array)[1*5 + 2]

EEPROM is non-volatile and slower than ram. only use it if you need to have persistent data through power cycles.

>> No.1937470

>>1937459
Thanks. I was under the impression that, so long as the second variable was declared, the length of the array was dynamic (under memory constraints). I'll use static arrays instead.

>> No.1937478

>>1937470
there's no such thing as a dynamic array like that in C.
usually what that is for is to statically declare an array without having to specify the number of elements and let the compiler do it instead.
int[][6] = {{0, 0, 0, 0, 0, 0 }, {1, 1, 1, 1, 1, 1}} will yeild an array of final size int[2][6]. its still static though so you cannot go out of bounds.

If you want true dynamic allocation use malloc and realloc, though 99% of the time in embedded you should never need to use this.

>> No.1937720
File: 32 KB, 953x244, Screenshot 2020-10-25 202847.png [View same] [iqdb] [saucenao] [google]
1937720

I'm not sure if I post here or /ohm/ but my question is that are there any differences between the two full adders? The left is from the textbook I'm reading and the right is from the other textbook I'm cross-referencing, because I'm new to a lot of this stuff I'm not sure if it's merely just a different way of writing it (like how some people write Z or Z with a slash in the middle).

>> No.1937721

>>1934192
>introduction to electronics(physics side of things) textbook
>introduction to electronic (analog) circuits textbook
Not the person you replied to but could I get a recommendation on both of those?

>> No.1937729

>>1937720
Looks identical to me. My take is that indeed it's just different graphical representations.

>> No.1937798
File: 47 KB, 1280x815, Full-adder-1280px.svg.png [View same] [iqdb] [saucenao] [google]
1937798

>>1937720
left is the fancy way, what's inside is the same

>> No.1937800
File: 343 KB, 900x1270, 0fe200106ff37aa55b622c56dade34d6e.jpg [View same] [iqdb] [saucenao] [google]
1937800

>>1937798
>>1937729
Nice, thank you, bros.
I was wondering why it looked so different since the textbook I was reading introduced adders 2 chapters earlier than the other book so I thought they might've used a different version of it. Thank god.

>> No.1937945

>>1937365
>I do a lot of DSP
Not him, but what sort of stuff do you do? I'm pretty interested in DSP at the moment, despite never having gotten into it before outside of some theory about z-transforms and such.

>> No.1937982

>>1937240
I tried to install the atmel bootloader via ISP and it did show the "atmel DFU bootloader " in the lsusb entry in the shell.
However I can't short the reset and GND pin to get it to do anything useful.
If I flash the TMK compiled firmware .hex file directly via isp then it shows "t.m.k PS/2 keyboard converter" which is right, but obviously dfu-programmer finds no more device to program. I just don't know how to do this, I wanted to use these slick features of tmk where you don't have to connect the 6 wires ISP and instead can just do it over USB. There is also a way to apparently get into the bootloader with only the keyboard and no special reset button on the 32u4 but that also eludes me.
Thanks for trying to help me though. It works as intended, but I don't know how to get the bootloader part working.

>> No.1938161

>>1938160
>>1938160
>>1938160
>>1938160
>>1938160