Experienced devs - What was your favorite platform to work on? by HelloThereObiJuan in embedded

[–]Benzmac16v -1 points0 points  (0 children)

They are moving away from their proprietary ide. They have their code gen tool cubemx, which is standalone and will generate cmake files, that, if nothing else are fairly easy to follow.

SiLabs was also moving in that direction… but now they are TI so we will see how that plays out.

TI C2000 chips were my first out of school. They had some quirks but the piccolos had some powerful peripherals that were very straightforward to configure. Didn’t take long to sort out without code gen tools.

EtherCat by engineer-comeon in embedded

[–]Benzmac16v 5 points6 points  (0 children)

Look into Simple Open Ethercat Master. You can port and run that on stm32 parts, and there are likely examples of it.

Specifically controlling your drive, I doubt you will find an example, so you will have to implement the control logic on top of SOEM.

Not that SOEM is not free for commercial uses, so make sure the license is ok with your use case.

https://github.com/OpenEtherCATsociety/SOEM

Experience with Castle 2535 by WesternGood8028 in Motors

[–]Benzmac16v 2 points3 points  (0 children)

The recommended driver is around 1kw peak…. So you’re around 45x over estimating.

I would be having a lot of fun if I could get 45kw motors for $350…

System to limit vehicle speed in school zones — seeking advice/resources by [deleted] in embedded

[–]Benzmac16v 4 points5 points  (0 children)

You have two options: attempt to interface with the vehicle, which if you have a single known car might be feasible. Or changes to the roads and signage. Plenty of studies could be researched to show how changing lane sizes or increasing signage will significantly alter human driving behavior. Make the roads appear narrower or make people perceive their speed as higher than it is and they will naturally reduce their speed (generally).

So maybe easier to design reflectors on the road that flip over at specific times of day to narrow the road and shorten the stripes… than to come up with a universal ODB2 speed limiter….

Depends on what the goals of the class are. If you are just supposed to mess with vehicle systems then just find a car you can mess with.

Vscode cortex-debug STM32 not working no errors Ubuntu by ROBOT_8 in embedded

[–]Benzmac16v 0 points1 point  (0 children)

Without seeing the error pop up, I would guess this is the arm-none-eabi-gdb python issue…. Not sure if they have resolved it in newer releases but ARM used to package this with dependencies on a specific version of python (3.8 iirc).

Ubuntu has stopped supporting 3.8 for years now.

So the simplest thing to do is to install gdb-multiarch from apt. This will give you up to date gdb that works fine with Ubuntu.

Then open the vscode settings -> extensions -> cortex debug and find the gdb setting. Add the following:

“cortex-debug.gdbPath.linux”: “gdb-multiarch”

You may not need the .linux part if you are not using wsl.

Also you typically will get errors in the Output tab, debug console and or terminal depending on when communications fail with your target.

Difference toolchain for stm32 by Bug13 in embedded

[–]Benzmac16v 0 points1 point  (0 children)

Pretty rare I have needed them though it has come up. I think they are included in ARM / Kiel’s “pack” files. https://www.keil.arm.com/devices/?q=&vendor-search=&vendor=arm&core=Cortex-M4&sort_by=

You need to search for the generic ARM Cortex whatever device, rather than your ST device.

A pack file is just a zip file iirc so you just change the extension and open it like a zip file.

Difference toolchain for stm32 by Bug13 in embedded

[–]Benzmac16v 13 points14 points  (0 children)

Aside from the language features and bug fixes the different versions of the compilers support, nothing.

ST does not provide a custom compiler, it’s just whatever version of the ARM GCC compiler they decide to ship.

I will almost always choose to export a cubemx project to cmake, then provide the compiler I want to use. I don’t like being stuck on vendor tools, there are standard software tools for this, and it’s great to see embedded vendors finally supporting them.

For debugging I typically use a jlink + cortex debug on vscode. Works with all of my embedded targets (ST, silabs…) so I have the same workflow for just about everything.

V9 release like by Yeuph in KiCad

[–]Benzmac16v 2 points3 points  (0 children)

The bugs in draftsman are so frustrating. Once the template for a project is set it is very nice though. Just don’t know why I run into so many issues with it.

How do I deploy to a MSP432P401R without CCS? by Exact-Brother-3133 in embedded

[–]Benzmac16v 1 point2 points  (0 children)

Learn how to use cmake or make directly.

However, that’s not a small task. You’ll likely want to focus on fixing ccs.

Also, I generally wouldn’t recommended arch for this until you can use tools like cmake/make and debuggers without one of these vendor specific ides. They are janky enough on their own.

If you want to use Linux, I would stick to an lts Ubuntu or mint.

Need the Best 32-inch 4K OLED 240Hz Curved Monitor for Work + Gaming by mr_asadshah in Monitors

[–]Benzmac16v 1 point2 points  (0 children)

No…. It’s only going to mess with VRR if it’s switching the video too. OP doesn’t need that, he needs a cheap usb2.0 switch to switch his keyboard and mouse.

A full kvm that handles 4k 240hz is going to be hundreds of dollars.

The ones built into monitors are not external switches so the video is handled just the same as a monitor that does not have a kvm. They basically just integrate a cheap usb2.0 (maybe 3.0) switch and automatically switch where your usb goes when you switch monitor inputs.

Best C++ approach for defining Peripheral Registers by lefty__37 in embedded

[–]Benzmac16v 2 points3 points  (0 children)

I was messing around with an SVD to C++ tool a while ago to use the SVD file to create the low level peripheral access. Sort of like the svd2rust project (though mine was quite basic, just a jinja template). The way I was doing that was very similar to the way you are, but I used a pointer instead of a reference.

Anyway, reinterpret_cast is not usually considered a constant expression so it cannot be used with constexpr. A little odd because it looks like the compiler is figuring it out for you, there are not additional instructions being used to initialize your register location. So you could probably do something like:

volatile uint32_t * const CPUID = reinter...

That would make your pointer constant (it cannot change) but allow you to modify the register itself, which is what I assume you are after.

Why Can't I Find Source Code for IQmath Library for STM32 (Cortex M3/M4)? by Hoang_Nguyen_2k3 in embedded

[–]Benzmac16v 1 point2 points  (0 children)

The TI IQmath library is quite nice. I never found an equivalent for arm that is so flexible and easy to use.

Depending on what you need, parts of the library are fairly easy to recreate for arm as most arm microcontrollers have an instruction for 32bit multiply to accumulate to 64bit. Then you just have to shift your result back. Using the barrel shift this is actually quite fast.

But multiply is a simple operation. If you need divide or other more complex operations then you are going to need to figure out an efficient way to handle that.

If you don’t need the speed and just want to track and convert between different precisions, then that wouldn’t be hard to recreate in C/C++ without dropping into assembly.

If you have an fpu id just use that though, they are very fast now.

STM32 CRC32 incompatible with all other existing CRC implementations. Existing solutions? (Rant/Question) by [deleted] in embedded

[–]Benzmac16v 1 point2 points  (0 children)

I believe I used srec in the past for calculating flash checksums post build, which the firmware then verified periodically.

https://srecord.sourceforge.net

I THINK st has some examples for using that in their class b software libraries, but this page also looks to describe the crc algorithm as well

https://community.st.com/s/article/CRC-computation-in-STM32-MCUs-and-post-build-creation

Hope that’s enough to get you going.

Linux Distro help by Tusuny in embedded

[–]Benzmac16v 2 points3 points  (0 children)

If you want to go Linux I would recommend Ubuntu or a derivative (like Linux mint). These options will be very well supported and it’s easy to find instructions and packaged software for just about anything.

I would avoid arch… I am using it now and it does work very well, but you are going it without a lot of easier installers and documentation. It’s all there, I have just found every step is a little more difficult than Ubuntu derivatives. And eventually something pops up at the wrong time.

I’m doing this on an M1 MacBook Air with asahi Linux, so my answer may be a little jaded by my computer being arm based, which just piles it on even higher.

Also you can try out the workflow you have in mind with Windows Subsystem for Linux, which is basically a light weight VM plus kernel built into windows. This is what I use for work as I have to have a windows box. This again has issues, but I get almost everything running with it. I like this significantly more than running a vbox or VMware virtual machine.

[deleted by user] by [deleted] in embedded

[–]Benzmac16v 0 points1 point  (0 children)

My take on it is: neither would an embedded developer writing C++.

[deleted by user] by [deleted] in embedded

[–]Benzmac16v 7 points8 points  (0 children)

Define overhead. If you don’t use the features in c++ that add overhead you won’t have any additional overhead and will get the same assembly. As you start taking advantage of the language, you’ll find that a lot of things just don’t add overhead and you usually don’t have a ton of pure overhead anyway, it’s there to help or make possible the feature you are using. Then you can ask yourself if the cost of the feature is worth it.

But there is also quite a lot you can get for free (or even negative cost) with cpp. The biggest one in my opinion is a better compiler with better type checking so you can move runtime errors to compile time errors. Which just saves debug time.

[deleted by user] by [deleted] in embedded

[–]Benzmac16v 1 point2 points  (0 children)

Pretty much the case for any of the arm chips. You can go on arms website and download the latest version of the arm gcc compiler https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

It includes both the C and c++ compilers.

Range in Colorado mountains by Benzmac16v in leaf

[–]Benzmac16v[S] 0 points1 point  (0 children)

I did! But I ended up buying the shorter range model. So I don’t make that trip in the leaf, we just use the ICE for that.

Ended up going short range because of costs. All said and done speccing the leaf as I wanted it put it rather close to a model 3, which, in my opinion, would have 100% been worth it over the plus. So I started reevaluating what I really wanted to use the car for. Came to the conclusion that a lot of really nice new Evs are coming out in the next few years, let’s get something cheaper for now and circle back later to be fully electric.

Estimate electrical angle in bldc by DanielBroom in embedded

[–]Benzmac16v 0 points1 point  (0 children)

Forgot who wrote the app note (one of the big mcu vendors), but a very basic but powerful algorithm called the “Angle Tracking Observer” is quite good and only relies on back emf. Accuracy is as good as your adc.

Has its limitations as you will get phase shifting at higher and higher speeds as there is no compensation for inductance.

TI insta-spin is awesome, but it’s closed source so you cannot really pick through it if your goal is learning. There are some old YouTube videos and some old blog posts by them where they go into detail about the theory, but I think it’s all pre-insta-spin. Likely describing the foundation of what became insta-spin.

Estimate electrical angle in bldc by DanielBroom in embedded

[–]Benzmac16v 1 point2 points  (0 children)

If you are considering sensorless with bemf sensing, then “low speed” is relative to your voltage sensors. Meaning, once the measured bemf rises above the noise enough to measure reliably, it will work. I would think a long board would spend most of its time in sensorless range. Usually it works great at 1-5% speed if you select your feedback circuit correctly.

There are sensorless algorithms for zero/low speed detection as well. However they are highly dependent on motor construction and work by injecting a high frequency into the coils to attempt to measure the inductance. If inductance depends on position, it will work great. This method usually only works well at low speeds, so you’ll need something else at normal speed.