MENU
Contact Us




Project

OPC UA Stack porting to PIC32

Porting of the Matrikon Flex OPC UA SDK to PIC32MZ with and without FreeRTOS



CPU

PIC32(MIPS)

Manufacturer

Microchip

OS

NoOS
FreeRTOS

Skills

OPC UA
Linker files
Microchip Harmony

Project size:

Difficulty:




Request/problem:

The customer wanted to run the Matrikon Flex OPC UA server on a PIC32MZ microcontroller with FreeRTOS. However, the Matrikon Flex OPC UA SDK does not support FreeRTOS natively and does not have any version available for the PIC32MZ microcontroller. The goal of this project was to get the Matrikon Flex OPC UA SDK based OPC UA server running on the PIC32MZ custom hardware. Another complication which required to be handled was to fit the Matrikon Flex OPC UA Server along with the customer application with the limited Flash and RAM resources on the device. This required to also optimize the Matrikon SDK further so that it can fit with the application.

Solution:

The Matrikon Flex OPC UA SDK is implemented using standard C++ and only requires C++ 11 support along with some platform specific networking, file system and timer APIs. As the stack is divided into platform specific and portable parts already, the changes to be done was easily identified. To port the Matrikon Flex we first prepared a bare metal prototype to run the Matrikon Flex OPC UA server on the PIC32MZ, without any security. This prototype was used to measure both footprint and performance of the OPC UA server. Initially the footprint of the OPC UA server was too large and required additional optimization to reduce it further. We identified additional configuration changes and other code optimization techniques which included using smaller nodeset and using the compiler optimization flags specific to the PIC32MZ. We also used the Linux kernel ksize utility (https://github.com/intel/luv-yocto/blob/master/scripts/tiny/ksize.py) in a modified form to analyze the generated objects and identify the areas which produced large code. Such code sections were then analyzed further to identify sections which we could optimize further.

Architecture:

Results:

The Matrikon Flex OPC UA Stack was ported to PIC32 platform for NoOS and we were able to achieve the working OPC UA server with the FLASH and RAM size which was acceptable for the application within the time and effort estimated.

Resources: