FreeMasterLite

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FreeMasterLite

4,165 次查看
Ahmed_Abd_El-Hafez
Contributor III

How Can I use FreeMasterLite to provide remote access for clients to the target microcontroller? 

0 项奖励
回复
18 回复数

4,031 次查看
iulian_stan
NXP Employee
NXP Employee

Hi @Ahmed_Abd_El-Hafez,

Assuming you have a FreeMASTER Lite application running on your local host (ex: http://127.0.0.1:8090), it can be accessed from an external network using the public IP address of the machine (instead of 127.0.0.1) + port number FreeMASTER Lite is running on (http://public_ip:port_number).

Please note that you need to make sure there are no firewall rules blocking inbound rules to FreeMASTER Lite. Additionally, if the machine is connected to a private network (ex: company network) there may be additional rules, blocking the access from outside, managed by the IT team.

Apologies for a delayed reply,
Iulian

0 项奖励
回复

4,011 次查看
Ahmed_Abd_El-Hafez
Contributor III

Dear iulian,

I have no experience with freemaster lite. can you please explain in more details what are the steps I should follow with freemasterlite to achieve this. or if there is a link for some explanation video to start using it ,it will be useful.

Thank you in advance.

0 项奖励
回复

4,002 次查看
iulian_stan
NXP Employee
NXP Employee

Hi @Ahmed_Abd_El-Hafez,

If you have no prior experience with FreeMASTER tool you can start with our Four Part Webinar Series (the 4th part is focused primarily on FreeMASTER Lite and JSON-RPC API).

Another good resource is the How-To page.

The following pictures shows (on a very high level) what has to be done:

Capture.PNG

 

FreeMASTER Lite has a built-in web server that can host the web application that you develop in step 2 (in the above image). When you start FM Lite executable, specify the path to your web app like this:

node.exe --web_root "C:\My_FreeMASTER_Lite_App"

Once it is running, you can open your local web browser and navigate to `localhost:8090` or `127.0.0.1:8090` and check your application. (8090 is the default port number, it can be changed using `--port` argument)

There are no additional steps required to access it from a remote PC. You just need to get the public IP address of the machine FreeMASTER Lite is running on, and open it on the remote PC.

For example:
On the local PC: access https://whatismyipaddress.com/. Let's assume it shows `130.120.110.100`
On the remote PC: open the web browser and navigate to `130.120.110.100:8090` 

Should you require more details on any step/aspect, we would be happy to assist you.

0 项奖励
回复

3,964 次查看
Ahmed_Abd_El-Hafez
Contributor III

thank you very much dear iulian. but I don't understand where I can write the path of my web app?  when the FM lite operates it shows this screen   

Ahmed_Abd_ElHafez_0-1697790201262.png

which even has no capability of writing in it . and then immediately open this default page 

Ahmed_Abd_ElHafez_1-1697790253826.png

I think I should make something to show my own web page in the web server and then the remote PC can navigate to my IP to see the same web page I see and then he can control the target board from his remote dashboard isn't that right?

 

0 项奖励
回复

3,962 次查看
Ahmed_Abd_El-Hafez
Contributor III

May I only navigate to the path of my web page on the browser which open on the default page ignoring this page ?

0 项奖励
回复

3,899 次查看
iulian_stan
NXP Employee
NXP Employee

Hi @Ahmed_Abd_El-Hafez,

By default, FreeMASTER Lite, serves the web content from the 'html' folder that is located inside the installation directory.

You can either:

  • put your file in that folder "C:\NXP\FreeMASTER Lite 1.2\FreeMASTER Lite\html", or
  • specify the path to the folder that contains your web page vie command line argument "--web_root" or "-w".

 

3,947 次查看
Ahmed_Abd_El-Hafez
Contributor III

Dear iulian,

Now, I reached the point where the remote device can see the dashboard (control web page) that I see. the problem now is that he can't control the parameters like me. when he changes the value of any parameter ,nothing occurs. what can I do? is there any setting or configuration that must be adjusted from the FreeMaster itself(where I watch the values of parameters) or what?

0 项奖励
回复

3,897 次查看
iulian_stan
NXP Employee
NXP Employee

I would need some more details:

  • By "parameters" do you mean embedded application variables ?
    • If so, how do you load symbolic information? Do you use TSA table or the ELF file ? 
  • How do you change those parameters ? Do you use WriteVariable API call or Write[Type]Variable where Type can be Int|Uint|Float|Double ?
0 项奖励
回复

3,828 次查看
Ahmed_Abd_El-Hafez
Contributor III

Yes, I mean embedded application variables. To load symbolic information, I used ELF File and to change these parameters,  I used WriteVariable API call.  

0 项奖励
回复

3,756 次查看
iulian_stan
NXP Employee
NXP Employee

Hi @Ahmed_Abd_El-Hafez

WriteVariable API call operate on variables defined FreeMASTER Lite configuration file. So you would need to have a structure like the one bellow in your .fmcfg file:

 {
  ...
  "variables": [
    {
      "name": "var16", <-- the variable to be used in ReadVariable/WriteVriable (can be any string)
      "addr": "var16", <-- symbol name (should match the variable name defined the embedded project)
      "size": 2,       <-- variable size in bytes [1,2,4,8] 
      "type": "uint"   <-- variable type [int,uint,float,double]
    },
    ...
  ]
  ...
}

 Another option, that does not require defining those variables is to use "typed" API calls: WriteIntVariable, WriteUIntVariable, WriteFloatVariable, WriteDoubleVariable. These functions use 3 arguments:

  • address - numeric value or a string representing your symbol
  • size - numeric value representing the size in bytes
  • data - the value you want to write

Same approach applies to read functions.

Hope it helps

3,745 次查看
Ahmed_Abd_El-Hafez
Contributor III

And then,  what  should I do with the .fmcfg file ? 

0 项奖励
回复

3,734 次查看
iulian_stan
NXP Employee
NXP Employee

You pass it as input parameter to the FreeMASTER Lite executable.

 

node.exe my_proj.fmcfg

 

Please refer to Start Guide for more details. It is accessible from the default webpage that opens when you start FreeMASTER Lite, or you can open the following file: "FreeMASTER Lite/html/guide/index.html" in the web browser.
Capture.PNG

 

0 项奖励
回复

3,726 次查看
Ahmed_Abd_El-Hafez
Contributor III

which device must do this step? the server device or the user (remote) device? The web page opened by FreeMasterLite after putting my file in the installation folder of it (on the server(main) device) succeeded in controlling the parameters. the remote device is who can't control them.  I referred to the guide but I couldn't find an answer.

标记 (1)
0 项奖励
回复

3,720 次查看
iulian_stan
NXP Employee
NXP Employee

The configuration file always stays on the main device, where the service is running. But I got wrong your issue - I thought you were unable to control the parameters on both, local and remote device.
In this case - check whether PCM is initialized with correct address and is able to reach remote server:

 

pcm = new PCM('main_ip:8090', on_connect, on_close, on_error);

function on_connect() {
  console.log('Client connected');
}
function on_close(event) {
  console.log('Connection closed');
  console.log(event);
}
function on_error(event) {
  console.log('Connection error');
  console.log(event);
}

 

Note that PCM should be initialized using main machine address. You can also use window.location.host like this:

 

pcm = new PCM(window.location.host, on_connect, on_close, on_error);

 

If you already use main machine address. Check whether there any connection errors.

0 项奖励
回复

3,674 次查看
Ahmed_Abd_El-Hafez
Contributor III

I am using two pcm objects pcm1 and pcm2 to control two boards. I initialized them with 'localhost 41000' and 'localhost41010'. Have I to change both of them or what? 

0 项奖励
回复

3,666 次查看
iulian_stan
NXP Employee
NXP Employee

I did not quite understand your issue, could you elaborate a bit.

0 项奖励
回复

3,664 次查看
Ahmed_Abd_El-Hafez
Contributor III

May I change this line in my code:

pcm1 = new PCM(rpcs_addr1, on_connected, on_error, on_error);
by
pcm1 = new PCM(main_ip:8090, on_connected, on_error, on_error); 
?
if so, the line:
pcm2 = new PCM(rpcs_addr2, on_connected2, on_error, on_error);
should be replaced by what?
 I used two pcm objects to be able to control two freemaster instances from single dashboard by using the methods of writing and reading with the two pcm objects.
 
0 项奖励
回复

3,646 次查看
iulian_stan
NXP Employee
NXP Employee

You would need to run 2 instances of FreeMASTRE Lite, but you will need to specify the a different port number for the second instance, because FreeMASTER Lite will not start if default port is being used.

It is done either from command line:

node.exe --port 8091

or via .fmcfg file.

{
  port: 8091
  ...
}

You can set any unused port, 8091 is used as reference.

Then you can replace:
pcm2 = new PCM(rpcs_addr2on_connected2on_erroron_error); 
with
pcm2 = new PCM(main_ip:8091on_connected2on_erroron_error);

 

0 项奖励
回复