Node Red config file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Node Red config file

Jump to solution
3,249 Views
hns80
Contributor V

The Freemaster + Node Red tutorial is good, but leaves out a step.

After showing how to export the fmcfg file, the instructor does not show how to make Node Red aware of the file.

I tried closing node and relaunching with the fmcfg file as the only argument, but I could not connect to the node server.

How can the variable information be imported to the Node Red project?

 

0 Kudos
1 Solution
3,218 Views
iulian_stan
NXP Employee
NXP Employee

Please find attached the archive containing pmp (FreeMASTER project) and fmcfg (FreeMASTER Lite project) used in the demo. I also included the settings.js (Node-RED configuration) - this one would be automatically generated due to `"node_red": true`, if there is no settings file in any of the default locations.

View solution in original post

0 Kudos
9 Replies
3,222 Views
hns80
Contributor V

Can you provide the config file(s) you used in the Node Red tutorial?

0 Kudos
3,219 Views
iulian_stan
NXP Employee
NXP Employee

Please find attached the archive containing pmp (FreeMASTER project) and fmcfg (FreeMASTER Lite project) used in the demo. I also included the settings.js (Node-RED configuration) - this one would be automatically generated due to `"node_red": true`, if there is no settings file in any of the default locations.

0 Kudos
2,517 Views
EmbeddedExpert
Contributor II

Hi,

Still confusing. Could you explain where to add (+changes) the .fmcfg file that is created from the Freemaster project to use it for the Freemaster Lite access to get rid of the read variable failure.

Regards,

Bernd

0 Kudos
2,501 Views
iulian_stan
NXP Employee
NXP Employee

Hi @EmbeddedExpert,

In most cases the only part that may need updates is the `elf` property of your connection.
Note: this applies in case you need to extract symbolic information related to your variable from an elf file. In case you define a FreeMASTER TSA table, you can skip this step.

Here's what default export looks like:

"connections": [
  {
    "name": "preset",
    "description": "Default connection",
    "connection_string": "RS232;port=COM3;speed=115200",
    "elf": "<no-file>"
  }
],

With updated elf:

"connections": [
  {
    "name": "preset",
    "description": "Default connection",
    "connection_string": "RS232;port=COM3;speed=115200",
    "elf": "C:\\MyProject\\MyProject.elf"
  }
],

Why it is step is required ?

If you look at the exported variables list, you'll notice that the `addr` field has a string value. Ex:

"variables": [
  {
    "name": "var16",
    "addr": "var16",
    "size": 2,
    "type": "uint"
  }
]

This value represents a symbol name corresponding to your variable. It allows FreeMASTER to map the variable to a coresponding address location.

Next, on the Node-RED side you need to make sure that `ReadTSA` or `ReadELF` nodes precede the `ReadVariable` node.

You can also avoid `ReadTSA` and `ReadELF` by specifying explicit (numeric) address of your variable, but this step is no practical as your variable address may change if there are updates in your project.

In case this does not answer your question please start a separate thread. Describing your scenario (where it fails ?, what error do you get ?). Eventually, attach your configuration file and Node-RED flow.

Kind regards,
Iulian

0 Kudos
2,495 Views
EmbeddedExpert
Contributor II

Hello Iulian,

my problem is more basic I guess.

How can I combine the Node Red with the ReadTSA (containing the variables)?

Where does the Node Red get the link to the  .fmcfg file?

Is it an entry in a setting file, a command line parameter, a naming issue?

EmbeddedExpert_0-1645796796650.png

Regards,

Bernd

0 Kudos
2,485 Views
iulian_stan
NXP Employee
NXP Employee

You pass the .fmcfg as a single input argument to node.exe when you start FreeMASTER Lite, or just double click it to launch the tool (the extension file should be registered with the executable). On startup, FreeMASTER Lite parses the file and all variables should be available at run-time.
Node-RED is not aware of those variables because it works as an API consumer. It dispatches RPC commands to FreeMASTER Lite and the later one is in charge of the execution.

FreeMASTER Lite should be instructed to start Node-RED, if you use the instance embedded into FreeMASTER. Add `node_red` property to the .fmcfg file. It accepts a boolean `true` to use default configuration or path to your settings.js (which stores Node-RED specific configuration and is not related to you FreeMASTER project).

Could you also check how many symbols are extracted by `ReadTSA` (just add its output to a debug node). Also, what error is logged by the debug node succeeding `ReadVariable` ?

Iulian

0 Kudos
2,456 Views
EmbeddedExpert
Contributor II

Hi Iulian,

passing the parameter file seems to work at least it complains if something is wrong

There is one Error massage which I cannot say where it is coming from.

& 'C:\NXP\FreeMASTER 3.1\FreeMASTER Lite\node.exe' .\FreeMASTER_project.pmp.fmcfg

28 Feb 16:46:42 - [error] **********************************************
28 Feb 16:46:42 - [error] * Deprecated call to RED.start().otherwise() *
28 Feb 16:46:42 - [error] * This will be removed in Node-RED 2.x *
28 Feb 16:46:42 - [error] * Use RED.start().catch() instead *
28 Feb 16:46:42 - [error] **********************************************
28 Feb 16:46:42 - [info]

runtime.welcome
===================

28 Feb 16:46:42 - [info] runtime.version
28 Feb 16:46:42 - [info] runtime.version
28 Feb 16:46:42 - [info] Windows_NT 10.0.18363 ia32 LE
28 Feb 16:46:44 - [info] server.loading
28 Feb 16:46:44 - [info] runtime.paths.settings
28 Feb 16:46:44 - [warn] server.deprecatedOption
28 Feb 16:46:44 - [info] context.log-store-init
28 Feb 16:46:44 - [info] storage.localfilesystem.user-dir
28 Feb 16:46:44 - [warn] storage.localfilesystem.projects.disabled
28 Feb 16:46:44 - [info] storage.localfilesystem.flows-file
28 Feb 16:46:44 - [warn] nodes.credentials.system-key-warning

FreeMASTER Lite server is running
=================================

Listening on port 8090

28 Feb 16:46:44 - [info] nodes.flows.starting-flows
28 Feb 16:46:44 - [info] nodes.flows.started-flows

I get connection but there is no TSA read, the count is 0.

{
"port": 8090,
"web_root": "C:\\NXP\\FreeMASTER 3.1\\FreeMASTER Lite\\html",
"open_path": "/",
"node_red": true,

"connections": [
{
"name": "S32Kxxx UART",
"description": "Default connection",
"connection_string": "RS232;port=COM9;speed=115200;tmoRI=40;tmoRTM=40;tmoRTC=50;tmoWTM=40;tmoWTC=50;"
}
],
"variables": [

{
"name": "CurrentAverage",
"addr": "CurrentAverage",
"size": 4,
"type": "int"
},
...

I does not read the TSA and therefore not the variable.

msg : Object

object

payloadobject
count0
message""
msgid"c408ea786
 

If I connect with FreeMaster directly then I see the value.

Cannot find the failure...

 

0 Kudos
2,446 Views
iulian_stan
NXP Employee
NXP Employee

Hi Bernd,

Unfortunately I cannot say what may be the cause of the issue as the TSA call passes, additionally, the `message` property of the returned object is also empty which overwise would contain an internal error message.

Is it possible for you to share your project ?

As a workaround I could suggest using ReadELF node. For this you'd need to add `elf` property to your `connection`, as described in my previous message.

Regards,
Iulian

0 Kudos
3,234 Views
iulian_stan
NXP Employee
NXP Employee

Hi @hns80,

To enable the Node-RED feature you need to specify "node-red" property in the "fmcfg" configuration file (at the root level). It accepts 2 types of values:

  • boolean - if set to "true" it will search for a "settings.js" file in default locations usually "~/.node-red" (it uses similar discovery strategy as described in node-red repo). If no file is found in any of the default locations, FreeMASTER will create one and store it in "~/.node-red/settings.js"
  • string - path to your custom configuration file (relative path will be resolved with respect to the "fmcfg" file location)

 

Kind regards,
Iulian

0 Kudos