Upgrading your TwinCAT 3 Version
Beckhoff releases new versions of TwinCAT 3 fairly often, and especially since this is a new platform you probably want to stay on top of their new updates for improved stability and new features. Here are some hard-won lessons I wanted to share with you about how to upgrade your production system to the latest TwinCAT 3 release:
Have a Test System
You should definitely have an offline test system for many good reasons. This test system should have the same operating system version as your production system and should ideally be the same hardware, though I realize that’s not always feasible. It could just be an old desktop PC you have sitting around, but that’s better than nothing. TwinCAT 3 is free for non-production use so you have no excuse for not having an offline test system.
Test your upgrade on the Test System First!
Never try upgrading your production system without running through a dry-run on your test system first. Get a copy of the latest TwinCAT solution from your production machine and get it running on your test system. It doesn’t matter if you don’t have I/O attached because the runtime will work just fine anyway. After your perform the upgrade procedure on your offline test machine, make sure you do a thorough test, including a reboot.
Follow These Steps
- Stop the machine and make it safe
- Put the runtime into Config mode
- Uninstall the old version of TwinCAT 3
- Also uninstall the old version of the Beckhoff Real-time Ethernet PnP Drivers
- Install the new version of TwinCAT 3
- Open the TwinCAT 3 solution
- Re-install any custom libraries, if you have any (optional)
- Go to the tool for configuring Real-time Ethernet devices, and install the new driver on your EtherCAT cards
- Re-link your EtherCAT master to your EtherCAT adapter under I/O, just in case
- Build each PLC project (individually, don’t use Rebuild All because it sometimes ignores errors)
- Check that you didn’t lose any I/O mapping
- Activate boot project on each PLC project
- Check under System that it’s configured to start in Run mode (if that’s what you want)
- Activate configuration and restart in run mode
- Test by doing a reboot
Upgrading the Real-time Ethernet drivers is critical. We were experiencing cases where the EtherCAT bus would just cut out on us, but only on one machine. All of our machines were upgraded to the same version, so we initially thought it must be a hardware issue. It turned out that we weren’t upgrading the Real-time Ethernet driver when we upgraded TwinCAT 3 versions, so this machine had an old version of the driver loaded, and all the other machines had a newer version. After upgrading the driver, the problem went away, so upgrading the driver is a critical step.
If you find that you did lose your I/O mapping, make sure you’ve built all your PLC projects (which generates a TMC file) and then close TwinCAT 3 XAE down and revert your .tsproj (TwinCAT solution project) file back to the original state. Then start again at the step where you open the TwinCAT 3 solution. Now you should find that your I/O mapping is back. That’s because the inputs and outputs of each PLC project are compiled into the TMC file and TwinCAT 3’s system manager links I/O against that. If the file doesn’t exist (or they changed the format during the upgrade) then it’ll just delete the links. However, the links still exist in the original .tsproj file, so creating the TMC file and then reverting the .tsproj file will put everything back to a happy state. This is also a useful trick when you’re moving the project to a new PC and you didn’t bring the .tmc files along for the ride (because they’re quite large).
Edit: Since writing this article, I’ve added a TwinCAT 3 Tutorial to this site as well.