3 x CAN – Fixing a Crystal Error

I can’t fix the crap above – working with STM32CubeIDE you get used to SW bugs and slow perfomance as can be expected by most Java applications – that screen is something you see a lot…

I got the MCU running with no crystal, added a 25Mhz crystal and it worked. Added some other components and detected that my crystal was very unstable on/off.

HSI worked fine, but crystal was moody.

Double checked all MCU pins, replaced crystal, measured noise on DC/DC before I finally replaced the 18pF capacitors associated with the crystal and voila.

1/2 day wasted on a bad soldering point…

These bugs are a bit hard as you bring a new board to life and don’t have the confidence that this should work. I have used this crystam before, but I had a new DC/DC next to it + it is always the possibility of a dodgy MCU…

3 x CAN Board coming up

It is a hard, tedious job to solder a board with 140 components manually, but it is only two components on this that is hard to solder – one is the MCU  or more correctly – I have chenged my soldering settings and this was straight up, no fuzz. I used higher temperature and it was straight on. I am a bit curious about that spider in the left, bottom corner thought. So much easier with my old SWD connector. So far only one minor bug. Will be exiting to see if I get Ethernet up running in a day or two.

PnP Control System

I bought a Monster8 board some time ago because I needed a control system with 5-7 RAMP’s for my PnP machine. I got a bit surpriced that no-one else uses this for OpenPnP, so I might be up for a surprice. But, lets get cracking. This board is very powerfully and much cheaper than the alternatives. The only challenge is that it lack a few 6-12V PWM ports, so I added a very simple 4 x PWM board as well (not pictured).

I have a draft of the control system below:

My design is based on LumenPnP which is a variant of OpenPnP, but I have done so many adaptions that it is not much left of the original design anymore. I actually build the frame some 1,5 year ago and was a bit annoyed with some of the crappy mechanic solutions on the original. The new design they use is improved and actually implement some of the same modifications I already had done.

#1 Stronger Frame. I decided to add an extra 2020 frame to get the machine more stable.

#2 I added tank belts for wires and pneumatic.

#3 I moved all moving parts away from the working plate to achive less vibrations. Pumps and solenoids makes the machine vibrate.

#4 I designed a new head that easily can be expanded to a 4 or 8 head machine later. That said I will start with a modified version of the LumenPnP double-head (illusrated below) as a start because adding heads also need more RAMPS, Sensors and Pneumatics. I modified the head to match sensors and belts I was using.

The design abobe is different from the original design that had some crappy screws that needed adjusting below – something that is a problem since the working plate is straigh below.

#5 More End Sensors. I added end sensors everythere. And one extra on Y axis as well as a 2nd RAMP here. It is two steppers working together and over time they can get out of sync so it is an easy fix to have two RAMPS and two sensors to enable adjusting the frame.

#6 Linear bearings. The original design used rubber wheels, while the new design uses linear bearings as illustrated below. I will add the linear bearings, but I will not use my own head design yet – I will add the new heads as we move to a machine with more heads later.

 

#7 Standard End Sensors. I ignored the special LumenPnP sensors and designed for standard sensors available on AliExpress.

#8 Standard Control System. I ignored the special LumenPnP control system and decided on Monster8 as base. To be honest I also have two other 3D printer systems based on AVR, but I don’t want to work on AVR anymore and Monster8 uses STM32F407Rx.

To complete the machine I plan on using Raspberry PI with a screen and keyboard to run OpenPnP connected to Monster8 through USB-C.

I have lacked tim/motivation to start on this, but my latest CAN board is some 140 components and I really feel the main of not having a PnP machine.

I will have a dig into Marlin, Klipper and Smoothieware for a possible port – but, I have not decided on that yet.

PLC – 2 CAN Boards

I have recently made two very similar  CAN  Boards, so it is a bit interesting to look at the differences since they have the same basic design.

This first one is a M12 design (Above) – the name after the M12 connectors at right. It’s main purpose is to fit into a waterproof module with 8+2 expansion boards based on very fast TTL serial links. The first layout of these boards are working, but I put futher design a bit on ice due to other work. The SWD used was complicated to us, USB a complete disaster and the footprint on the CAN Tranceiver was wrong. But, this design will be continued and upgraded.

The next one was finished a few secs ago and contain several changes from the M12 version. Firstly it target a standard metal box (not waterproof) and add Ethernet, SD-Card, proper USB and an isolated 24V Power Supplly. DC/DC on CAN ports are also swapped out. I kept SPI Flash, but added PSRAM option. It is an option to modify footprints so a SPI FRAM will fit because they are a bit more narrow. You can alsp see that CAN Tranceivers are corrected and that SWD is replaced with the old one I have used for years. The number of modules are reduced to four because you only talk about some extra modules in the same box.

This last board use ribbon connectors at right that will be 1:1 to DSUB9 ribbon connectors. The box will fit 6 DSub-9 at right so to get from 3 to 6 we just add another board in the box and use the later board as an extension board (dropping components we don’t need) – we can then chose to add 3 x CAN, 3 x Serial or GPIO. This board took ages to get right, but it only took me a few hours this morning to actually routing it.

The black frame around the picture is because this was exported directly from KiCAD. Usually I prepare pictures using 3D paint, but I wanted to see how it was to export one directly.

It has been a cock-up with packages out of China – the sellers send my packages out and get them returned from the Airport. Not sure why, but Norway have an automated VAT system where they are mental on collecting VAT on everything – the system works well, but my wife adviced me to put the VAT number from AliExpress in the address – that seems to work better. As a consequence I have not recevied the metal boxes yet.

Needless to say I can scale up systems using the Ethernet as backbone. I used ca 3 days to manually add lwIP TC/IP stack and I have C code for a Profinet stack so fun will happen.

 

PLC – CAN Hub

I designed a PLC with 3 x CAN ports earlier using M12 connectors and decided that I wanted a version that could be used on my desk or in a cabinet without the extra M12/Waterproof fuzz. It is the same design with a few tweaks:

  • 3 x CAN ports on the motherboard
  • Two motherboards or 3 extra modules with a total of 6 ports in a box.
  • Designed for a standard metal box
  • Use standard D-Sub 9
  • Ethernet
  • SD Card
  • USB
  • Full galvanic issolation on 24V and all ports.

With this I can mount a 6 port CAN w/USB/Ethernet or a 3 port CAN + 3 port Serial as needed. The final module fit in a metal box that either can be a stand-alone tool or be used as a module in a larger system, but this time with Ethernet as backbone. This will be a nice product, but the main reason I make it is because I need it myself.

The board mount into one of the box sides, but use flat-cables to connectors on the right side. The board is still a bit work in progress, but the box will have the exact same size as the Analogue board/box making them modules in the same system.

Data Logger

I recently made a Data Logger using a Nucleo-144 board and 16 bit ADC’s – the project works well and I am a bit surpriced over how easy it was to create both electronics, firmware and PC software, so I will attempt an even more advanced Data Logger illustrated below:

A functional block diagram over HW is illustrated above.

The ADC part is the more complex part. My original project used fast, internal 16 bit ADC’s, while this will use fast, external 24 bit ADC’s with full galvanic isolation. The sampling rate drops from close to 1Mhz to 68KHz, but this is sufficient. If you want higher sampling rates you would be using FPGA/ASIC anyway. The more complex part is the analogue setup at right- 0-10V analogue channels are straight forward, but I need to figure out how to support 4-20mA loops as well and try to avoid noise. Using a 24 bit ADC is a bit ambigous since it tend to be 8 bit extra noise compared to a 16 bit.

The MCU ss a STM32H723 rinning at 550Mhz with Ethernet. The key to this logging is to get data over to a PC (or Raspberry PI), but I have added a SD Card as well as a Quad PSRAM as well, PSRAM is 16Mb data buffer.

USB port is mainly for initial config and development.

I have done an early physical mock-up of the board and this will end up being the first ever project where I do SW/FW before doing HW.

The rational behind this project was that we needed a logger and struggled to find one that did what we wanted, so we decided just use a Nucleo-144 board and get going – the project was done with HW, FW and SW in 3 weeks. It does exist commercial solutions, but the ones I found cost a fortune and they are surprinsingly limited compared to how easy it was to make this one.

PLC – H503CB Base Module

This mornings catch… Made a new STM32H503CB base module. Swapped in STM32H503CB, a new 10 point 1.25 connector, my old SWD connector and a smaller SPI Flash. I also reversed 0402 trancient capacitors back to 0603 packages for now – I will reconsider moving to 0402 as I get the P&P working.

The Molex 10p connector at left have TTL IO only – CAN, USB, UART + 2 GPIO pins and 5V + GND. This will work well both as a module and as stand-alone with a small adapter board. I am out of space, but will add som TVS transient protection diodes on the back – more correctly 8 small diodes – either that or I need to use ca 5mm extra. I might consider full galvanic isolation as well if I find a solution for the 5V. Decent galvanic isolation on TTL is very straight forward, but I feel this is an overkill since we still have a galvanic isolation layer at right here towards the IO.

This SWD needs solering for dev purposes, but you can use a truck with a stick-in plug for just programming, so you do in effect have just a footprint SWD if you want to. I had no problem with this SWD over the years, but I will make some new adapter boards for it.

Mobile PLC – New Module Design

This is a PowerPoint mock-up. I just soldered om the PLCDCMotor board and im considering to keep the board as is with a less changes than I planned – the TTL connector at left can be used as is with a short 1:1 cable to a small board that convert the board to a stand-alone board. The M12 on right can be replaced with a custom connector to fit the IO on the board. I am not leaving the M12 design, but I think it is wise to include more options.

The nice thing about this is that I can just extend the TTL connector at left as the com adapter boards can be added later. I will add CAN and USB pins extending to a 8 pin TTL connector. I like these connectors because I can buy 1:1 cables in bundles ready made – if not they would be a lot of work.

This board was tight to hand-solder, but the real pain is the SWD at the left, bottom corner. That connector works fine, but it is very hard to keep it connected and is a major mistake. in fact I can achieve the same without soldering using my original SWD with 6 pins. Lesson learned!

STM32H503CB

STM32H503CB is fastly turning into my favorite MCU for three reasons – it is fast, it is low cost and it has en extremely good IO routing system.

It’s only drawback is 128Kb Flash and 32Kb SRAM, but it exist other MCU’s in the same series with more (that also cost more). That said it also contains a good bootloader in ROM, meaning the 128Kb Flash is all user application.

  • 32 bit M33 core running at 250Mhz
  • Cost lower than 2.- USD in decent volumes.
  • 128Kb Flash, 32Kb SRAM
  • And an IO system that contains a lot and is very flexible in routing to pins.

The example setup above contains:

  • USB
  • 1 x UART
  • 1 x FD-CAN
  • 3 x GPIO
  • Oscillolater
  • SWD
  • 4 x ADC channels
  • 4 x PWM channels
  • 3 x Ebcoder channels
  • 3 x SPI
  • 1 x I2C

All pins used on a LQFP48. Selecting IO with a H5 is in general very easy compared to other MCU’s, meaning you get a lot out of this one.

PLC – Modified 10A Motor Driver

Using my M12 DCMotor driver as base I want to upgrade this board as described below – running motors are fun and this board is capable 10A (actually 2 x 10A) at 24V, so it is quite powerfully.

This board is very capable as each driver privide two separate half H-Bridge circuits with current sensors at 5A each. I think I can drive a 10A 3-phase from this, but I can drive 4 solenoids, 2 DC motors or a larger Stepper motor. For now I will just build and code this in the M12 format, but I am starting to plan a simpler version to drive cost down.

  • The first change is that the connector on left is a fast TTL UART. I would like to replace that with something that enables the module to be used stand-alone and still be used as a module in a system. The answer is CAN, RS485 or RS232, but I need to research a bit on cost, speed and space usage. I also want to evaluate changing that micro connetor to terminals. One of the signals is an enable signal that switch on/off the PSU, so I need a jumper for that to be used in stand-alone mode.
  • MCU used here is STM32G491Cx and I will replace it with STM32H503Cx due to cost. H503 is M33 at 250Mhz and contains 128Kb Flash and 32Kb SRAM, but it has a very nice bootloader in ROM so the 128Kb Flash is for application only – and 128Kb is quite a lot as long as you don’t drag in Ethernet or similar.
  • The SPI Flash is great in SO8 format, but I have changed to a even smaller footprint to save space – and space is an issue on this design. One argument is also that I might be better off with a FRAM/EEPROM in this case since this is a motor controller.
  • The SWD connector at bottom left will be replaced with my old SWD connector.
  • Current sensor in middle bottom will be removed and replaced with 4 x current sensors on the DRV8873. This put the galvanic isolation layer in question as it is very difficult to have an analogue signal to cross galvanic isolation . it is possible, but I need to evaluate what I do here. DRV8873 is not isolated themselves, so it might be an overkill to have this isolation barrier + I could maybe add an isolation barrier on the connector at left.
  • The big 24 to 5V DC/DC is not needed – firstly I can replace it with a smaller SMD DC/DC from RECON, but secondly it serves no purpose if I remove the isolation layer.
  • 24V connector needs to be evaluated – swap it for a terminal and maybe feed 5V from this to reduce power to 1 connector.
  • The final change is to replace M12 with a terminal block due to cost.
  • One major issue as I designed this was size – this board is 25 x 70mm, but without the M12 design I can use whatever size I want.