easyIPC Dev Setup 1

My next task is to get SPI working on the backbone of my modular control system, so I have assembled 2 x XPortHub’s both connected to a separate ST-Link. One the Hub’s have a RS485 used as debug port, but I intend to bring up USB ports on these later.

The picture above show both XPortHub’s connected. The 5V from the USB feeds both Hat’s that both are connected to each their ST-Links. What was holding me up was the 2nd USB cable, but I bought 10 extra now.

XPortHub is excellent to use for infrastructure development due to it’s high density of communication ports. With separate SD cards and UART display port they basically are small PC’s.

Multiple ST-Links

SW4STM32 allows you to maintain multiple projects and have multiple ST-Links active at once. This is a welcome feature as I now need to program several at once to get backbone SPI working. I finally got the 10x USB cables, so everything is set up and working.

This also means that I start using SW4STM32 on regular basis as I start digging deeper into the SW components on my Hat Project.

Home made Z80 Computer

I have seen quite a few attempts on making vintage computers, but this “Homebrew Z80 Computer Kit” costing 199.- USD is very cool. This is actually a very cool design. If this had popped up at this price some 40 years ago I would have bought one.

I do however love the modular design concept that is used here. It brings back many good memories from my early days in this science. I am interested to know how many sales these do. It’s not going to be that huge, but still – it is plenty of Z80 enthusiasts out there. Well done! The link is below.

https://www.tindie.com/products/Semachthemonkey/rc2014-pro-homebrew-z80-computer-kit/?utm_source=hackaday&utm_medium=link&utm_campaign=fromstore

 

Google Web Designer

I have searched for Web Designers a few times and recently found Google Web Designer. This is a full HTML5 designer with  WYSIWYG designer as well as Code Editor. This looks like it could be the answer to my web design needs should I decide to use my own time to dig into this.

Google follow a known Developer scheme where you drag components into the screen and set properties. After that you can manipulate the content with HTML5 which is a mix of HTML, JavaScript and CSS. Google Web Designer is very convincing as it assist a lot in doing the more fancy 3D stuff. It is not straight forward to use, but I can see that this would be worth learning should I decide to pick this up.

What I really would have liked is database aware components. The content you see in this blog is stored in a SQL database, and to create a blog I need to execute a few SQL statements. Delphi/C#/VB all did this through components that made it very easy to get going. But, you can add user components to this, so lets see. I am not sure I actually want to use this or take over editing my sites, but it’s fun to experiment a bit regardless.

Reading this blog

I basically keep my notes here in this blog, so to follow a project you just click on the project in the left (obs right) bar as that will filter out entries. This is so far the only real change to this blog as I keep searching for alternative themes.

I actually found one WordPress theme that was better than this, but one of the challenges I face is that they leave to few options open for user control, so I fail to customize the themes into something I like reading. What you read here is a compromise – it Works and it only costed me a few hours of my own time. I would like to avoid spending weeks programming a WordPress theme or my own blog system, but I am starting to wonder if I need to.

As for WordPress – the system itself is free, developed in PHP from what I can tell. Most of the themes are however commercial. TBH you can easily pick up database skills and spend a few weeks to get your own customized web-site. The blog you see in front of you is a retarded compromize compared with some of the stuff you find out there. It is not difficult at all if you have the interest and time.

WordPress is great for someone without time or programming skills to get a blog running. It gives you a base site with a few clicks and the system itself is great. But, it fails greatly on customization options. One example is the post header in this theme – I can’t change the font parameters, so I changed theme and now I can’t Control the right bar etc. 

But, this is what you get then you use someone elses product – you accept their limitations,  quality – or lack of such – and schemes to earn Money. WordPress earn their Money in the customization of themes.

Protocol Analyzer – Part 1

The protocols I use on CAN, serial, Ethernet, Wifi are all part of a easyIPC package designed to co-exist in a complex network. This is at the core of the systems and I need a tool that can visualize the messages that pass on various levels. This tool is called a “Protocol Analyzer” and without this you will waste hours trying to figure out what happens.

I use the name “Protocol Analyzer” or just “Analyzer” for this project. It actually consist of several projects that add up to a package of hardware and software. The concept is simple – I will use my existing adapters or Hat’s to collect data from – basically sit in 3-state and copy messages up to the PC where I can present them and analyze their content and sequence/timing etc.

My QT based framework is excellent for this. I basically just need to add a fast, virtual grid component and create some kind of database on log files. It’s a bit of work, but I have experience from doing this in the past and have been using analyzers for years in telecom so I know what I want and why I want it. I have listed some basic objectives below:

Req Description
1 Be able to display messages real-time with max 250ms delay from capture until visualization on screen.
2 Be able to synchronize time stamps and adjust time differences if needed.
3 Be able to use disk as endless storage so we can leave the log part of the analyzer on and revisit message sequences afterwards.
4 Intelligent filtering of what is displayed so we can focus on what we look for.
5 Capable of recognizing proprietary messages that we add through XML spec.
6 Capable of testing rules like message sequences and content checks and visualize errors automatically.
7 Log raw Message content only. The rest should be a presentation issue based on XML settings.

I will add more to this list later. You will start seeing screenshots of this project soon.

CAN Adapters

I have 2 CAN Adapters at present. One is the low cost USB Adapter and the other is the XPortHub.

The picture above show the smaller, single channel USB to CAN Adapter.

The picture above show the more powerfully XPortHub that provide USB, CAN, RS-485, RS-232, UART, SPI and I2C channels.

The USB to CAN adapter is designed as a low cost adapter while XPortHub is designed to be a component in a modular control system. But, they are both excellent USB/CAN Adapters.

The CAN ports offered are CAN-HS (High Speed). It actually also exist a CAN-LS/FT (Low Speed or Fault Tolerant). The HS bus uses 2 wires, while the FT version uses 4 as it includes + and – and schemes for communication if one of the twisted pair lines break. This is however rarely used as most systems prefer to just use 2 CAN ports for redundance

 

CAN Arbitration

One of the things you need to be aware off as you design (or use) a CAN based protocol is how arbitration works and how it can be used to your advantage or create a timing bug if it used wrong.

CANbus consist of a 11 or 19 bit ID field at the head of a message. These bits are part of what is called the “arbitration field” where 0 is a “dominant” bit. As a device want to send a message it waits for the bus to be idle and then start sensing on a clever timed scheme. At this point our device might be one of many that start sending, so we read back what was sent on the bus. If one device send 0 and another 1 the electronics will work the way that 0 becomes dominant. The device that send 1 and read 0 will stop sending and the device sending the lowest id field will at the end complete it’s sending. This means two things:

ID=0 is a very good candidate for a high priority alarm message.

Some messages will be delayed due to the bus being busy and their ID did not win the arbitration. This means that as you want to send a message every 100ms that message might pop up much later than you expect if you have a busy network and accidentally many devices that want to send.

This arbitration delay can lead to some very random and frustrating timing issues if your CAN protocol is designed wrong as in not handling this well. Messages simply get delayed.

Do however remember that the main reason for messages being delayed usually is noise on the twisted pair causing CRC errors.

How do you see these things? The answer is that you need an advanced CAN logger and CAN Protocol Analyzer that tend to cost a bit of money. This is easy to detect scanning a log as you will see this as dense message sequences in the log. A proper analyzer will show you a graph or alarm you about arbitration situations of some length, but these tools sadly cost money.

Remote PSU Switch

The 50A Motor Controller have 2 separate PSU feeds – one for the MCU and one for the Motor driver. This allows me to power the MCU and let this switch on/off power for the driver part.

Simply create a 48V/50A PSU Controller Hat as illustrated on the drawing above. I like this idea, but I don’t like the idea of letting 50A pass anything on it’s path. I would need a large relay for this – or do I?

I have a bunch of these 20A relays that actually are very small. I am toying with the idea of creating a Hat with 3 to 5 of these. Basically I just combine PSU sources to get higher currents.

I am a bit puzzled by the marking of these as they rate 125VAC, but only 24VDC. I actually need 48VDC, but these only cost a few cents so I can test. I have larger ones that can take 230VAC and these relay boards are very handy regardless.

But, But, But… having to wire 50A through another board is not nice – so I am thinking several PCB’s here – I obviously would like relay boards in Hat formats, but I would also like a Hat capable of switching external power paths – meaning I put the relay on a separate board for higher current solutions.

Actually it already exist low cost relay boards driven by ESP32 which is excellent for doing this job. I like to have my systems wired and only use Wifi if I must, but the good thing about the Wifi option here is that I can buy someone else’s board for a change.excellent for doing this job

This is only a brief idea at present, but having relay boards and options as part of a modular control system is a must.

 

Testing a 50A Motor Controller

One of the good things about MC4X60V50A (or steampunk controller if you like) is that MCU is powered separately from the MOSFET driver part. This enables me to use a USB, power the MCU and write test code without worrying about the 3KW driver part.

For actual testing I can settle with smaller motors to test logic. I have plenty of Nema17 rated to ca 2A, one 3-Phase rated 30A, another rated 15A and I have even ordered one rated 90A max. The challenge is more that I at present only can support max 30A from Lab PSU’s. But, that will have to do for now.