All posts by Jan

Micro PLC – New format

These are just drawings of my new Micro PLC formats. I am considering 20x50mm, 30x50mm and 50x50mm formats. This discussion started as I received my previous PLC bus design and realized the actual size of it. The reality is that I need things much, much smaller and having a big backbone bus is very expensive.

As I accidentally made some 20×50 boards and by pure accident stacked them together I also make the observation that it would be easy to actually use that format as I can fit a stack almost everywhere, But, ok – 20×50 is a bit tight, so maybe 30×50, 40×50 or 50×50? Or maybe all of them as per need?

The way I want to stack them is with a bus cable and connectors. This way I can create a stack or simply mount them Distributed.

SW4STM32 – Short Review

System Workshop for STM32 or ac6wb or SW4STM32 is an Eclipse based, free IDE supported by ST. I started using this a while ago and the great thing about this is that CubeMX generate start-up code, project and everything for this. It makes it ideal for doing initial testing and to get off ground fast.

One word about CubeMX is that you can download different versions of their library and some simply do not contain all files as Project are generated. So the projects don’t compile. You just have to find a version that works for you. Except for that it is great.

As for SW4STM32 the best I can say is that it works – it is ok. A decent editor, debugger is decent and it’s a all-in-one that allow you to write code, compile, debug, download it etc. It is all you need and it’s free and supported from CubeMX and ST.

Sometimes as I download SW4STM32 lock up and I basically have to stop it and start again. It is annoying, but I can live with that. Using SW4STM32 is an option and as CubeMX integrate middleware including FreeRTOS you really get off ground with your projects fast with a standard CMSIS based project.

Another annoying issue is that messages as you can’t connect to SWD can be confusing. I can often have a it of connection issues before I get started, while CoIDE always was straight up. But, this is mostly me being more used to CoIDE than SW4STM32.

As an embedded C/C++ developer I usually have 1 comment – where is the C++ support? SW4STM32 have a button that change your project to C++. And this is GCC toolchain, so it will support C++, but CubeMX generate C so you need to convert that manually. I have not bothered digging into that because my usage have been electronics testing so far.

The example above is for MC3X60 running the motor Trapzoidal. What I did was to grab a FreeRTOS task and just run in a loop with a delay between the steps. Took me around 5 minutes to have the motor running.

The main limitation in SW4STM32 is STM32 – it only support STM32 out of the Box.

The project organization is a bit dictated from CubeMX. I live with that for now, but I would recommend that you organize your own projects and even support multiple IDE’s or build tools. Don’t let an IDE rule your life.

MC3X60V Working

I am only using 12V, but DRV8313 worked on 2nd attempt. First failed so I ripped it off, revoved a lane and placed a new that worked straight up. Just using trapsoidal for the moment, but it’s a start.

I need to code up a Sinusoidal algorithm and better Acceleration and Speed Control. I also want to see if I can get Hall sensors working.

MC3X60V DC/DC working again

This was a bit of work. Soldered 2 x 10uF in a bridge – simply removed the protection TVS for now. If you look next to the led you also see space for a coil where I use a 1206 component, so I can probably squeeze the 1206 caps in there. I don’t want to try 60V yet, I want to solder on and actually test the motor driver. I scoped 3.4V and it looks real nice. I will dig deeper into that later to see ripple.

New Micro PLC design

I have done a few PLC system drafts – one based on Raspberry PI, a second larger one and a 3rd based on distributed components. The pure PLC system was “ok”, but it was a bit larger with the bus than I expected. Looking at some of my 50x20mm designs I wanted to try a 50 x 50 mm design where we plug in a CAN/RS485 bus. The objective is to make a component based system that is very small.

The idea for this came as I stacked my CANUsb adapter and small motor controller (50x20mm) together for fun – I might even use that small format, but I think 50×50 is better. Worth a try.



This is the PSU from the MC3X60V – my small motor controller. It snapped at 35V. To save space I omitted the components in the yellow circle.

Reviewing this with a friend I believe that C10 is the cause. This circuit need a small cap close to TSP54060. I already know that this circuit misbehaved without the larger motor caps mounted (not shown), so it is something to this, but we will see as I get around to patching a PCB.

The resistors R11 and R12 should be ok according to the datasheet. This set the under-voltage cut off and can be left floating – or more correct that is my interpretation of the datasheet for TPS54060.

I will see if I can patch one of the PCB’s as proof of concept, but I also want to make and order a break out board for a few of the 60ich V designs. As you can see above – the PSU is in the top-left corner and I don’t have much space here either. Also – again I will need to allow 60V components on C10.

Next question – Is this actually a 60V design?

The answer is NO! The circuit say 60V, but if you actually operate a motor controller on marginal design terms you will break it. This is a design for 48V with a max limit of 60V allowing it some tolerance.

MC3P60V Cap Change

I was rather pleased with routing MC3P60V because it is a dense, functional design. But, as I reviewed the design I found this. The error here is that this is 60V and I used 0603 packages. 0603 usually hold 6ich V, so I will either need to upgrade to larger 60V or try something else.

 My first thought is to use 2 x 1206 components in series to achieve 60V, but I need to check around what I can get and actual size of components. I have 2 of these cap circuits related to DRV8301.

And looking at the current PCB you can see that I am a bit out of space. I have a heat-sink that cost 1ich USD and that is perfect size, so I seriously do not want to change size on this design.

What IDE should I use?

I am a big fan of things that just work, which is why I have stuck to Coocox and CoIDE for years. But, as it now looks like this tool is dead I basically need to move on.

Coocox had a very good concept and was one of the few Eclipse based IDE’s I liked, so it is sad to see them go. But, I understand they could not make money from their business model and in the end gave up. Their site is now down and I am stuck with version 1.7.8.

Looking at alternatives I find the following:

SW4STM32 is free and supported by CubeMX. I will discuss CubeMX a bit later.

Em::Bitz is free and have reached version 1.1. This originate from Code::Blocks and was previously Em::Blocks that now is forked into Em::Bitz. The drivers supported here are only the old drivers, but you can dowload and set up new ones as well.

TrueStudio is a commercial IDE, but it has a fully free version for STM32 as well. It is also supported from CubeMX and is Eclipse based.

I will be evaluating these options over the next days and share my findings with you. The one I am curious on is EmBitz. This is unlike the others based on Code::Blocks and written in C++. I mention this because performance do matter and I hate tools that forces me to care about Java versions installed on my computer. Why should I as a user need to care about what my tools are programmed in? But, using a Java based tool you often need to do that. The other issue is that C++ developers tend to have a better gasp of what is needed for Embedded C/C++ development. With one exception – CoIDE will be missed. Their concept was good.

3-4-phase – Motor Controllers

I have a load of motor controllers that I want to continue on, but to focus on the more advanced ones.


This is an early draft of rev 1.1 of the MC4X controller. Notice the heavy wiring at right to support 50A + all components top-side so I can add heat-sink on the PCB. All transistors have pad’s and being cooled at bottom. Two temp sensors added between MOSFET’s.. INA194 as Current Sensors, CAP’s on the PCB etc.

The results from the previous 1.0 version was actually so promissing that I am looking forward to this one. But, it is still work in progress.


This has been in the pipe a few weeks. It is a dedicated 3-phase controller. It is 15mm more narrow than MC4X60V50 and uses DRV8301. I want to do an upgrade before I ship for this – some of the small capacitors are 0603 and need to support 60V – that will not work + I need a better place to mount the main capacitor.

Comparing MC3P and MC4X I must admit that I get a lot of functionality for those 15mm extra. MC3P is a bit smaller, but MC4X can do the same and more. I still want to do MC3P because I want to play with DRV8301. ANother change is that I consider putting wires on top so I can use a 100x25mm heat-sink on PCB-bottom.

Another concern is that I on this planned thick PCB lanes on power – simply creating a thick solder path. I am considering upgrading that to wires like I did on MC4X.


This is the smaller of the 60V design. First test failed at 35V, but I have been advised to make a change on the DC/DC that I want to try out.


This is the smallest based in DRV10983. It works, but I am not impressed over DRV10983 speed regulation. I will find more time to play with the I2C interface on this, but I need to see a better controller if I am to continue with it.

CAN Interface

I finally got revision 1.1 of these boards yesterday, so I can get on with this adapter. The main error on 1.1 was lack of crystal and I realized I needed the crystal for USB as I tested.

I like CubeMX, but I fail to undestand “designers” that want to create a “HAL” and only do low level, MCU specific interface. In this example I would have liked a function to select bitrate, but are left with setting up loads of timing details.

Even more annoying was that the generated project for STM32F105RB do not want to compile due to lack of files. This is where auto-generation and I usually separate.