I’m trying to design a new widget to upload firmware to the device in production via J-Link.
Searching the internet I cannot find any widgets offering this functionality, has anyone already done a similar integration?
Thanks & Regards,
Hi Emanuele - Welcome to the Tulip Community We are glad you are here!
I have a couple questions around what you are trying to do so that the Community can better assist you:
- What type of firmware are you trying to upload?
- When you say “device” what specifically do you mean?
We produce IoT devices, one step of production is the flash of the firmware inside the device that the operator is assembling. In this case, by device I mean the IoT device that the operator is assembling.
To flash the firmware in the IoT device, it is necessary to use a programmer (the J-Link device in our case) that is connected via USB to the production PC. The programmer (J-Link) has management software via CLI, in particular there is a cli command that given a file (firmware to load) and some parameters allows the firmware to be flashed.
Initially, the idea was to create a custom widget whose JS code uses CLI terminal commands to communicate with the J-Link programmer. In this case, the file (firmware) to be flashed to the IoT device would be passed to the widget via a file-type prop.
Is this feasible?
Thanks for your time.
Great question! Happy to help, it’s an interesting case.
First thing to note here is that Custom Widgets are pretty heavily sandboxed in Player; not to say that it’s impossible, but I have had trouble in the past with CWs attempting to contact the hardware it’s running on; for example here running console commands from within Player. Most likely, the only way that I have seen a custom widget communicating with other programs on a computer is via API calls over
That being said, if you are able to communicate over a localhost port to J-Link, that may be a way to accomplish your needs.
Aside of all of this, worth asking - are you using a flashing jig, or some middle-device like a Pi to accomplish the flashing itself? I have seen users have success before in a structure like this:
- IoT device (perhaps many) plug into flashing device (e.g. a Pi)
- Flashing device has all necessary image files
- Flashing device is plugged into user computer as simple serial device
- User computer can trigger new flash commands via Serial
- Flashing device accomplishes image burn, reports back with some data
this way, you’re avoiding the actual command-line configuration in Tulip and simply sending a “go” command.
Regardless, I’m curious if anyone else has experience with similar setups! Let me know if this helps!
Ah! I was also just reminded that you can likely accomplish this via Node-RED: in this case, using a Tulip Edge Device to essentially substitute for points 2 through 4 here, simplifying things a bit. It’s not a major improvement as you still would need to write your flashing script, manage configuration etc but Node-RED may make it a bit easier to configure.
Thank you for your reply.
We wanted to save the firmware file in a Tulip table, as the product code also defines which firmware is to be flashed.
Maybe with Node-RED we can pass the file (firmware) and then run the terminal command with the correct file directly from Node-RED.
So the flow would be: File in tulip table → Node-RED → Flash command from Node-RED
You could also (probably) save the file on your Edge Device for easier application, as there are file read/write nodes (but I haven’t used them myself). After this, simply send the product code to the Device rather than the full file itself.