FreeMaster Documentation - How to Use FreeMASTER over BDM/JTAG

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

FreeMaster Documentation - How to Use FreeMASTER over BDM/JTAG

Jump to solution
3,943 Views
sparkee
Contributor V

Can someone point me in the direction of FreeMaster documentation that discusses using the MultiLink debugger?  I can use it fine if I'm using the S32K144 dev board but on my PCB I can only get the oscope to work using the MultiLink.  Strangely it only works when I have the FreeMaster Config block commented out.  If I try to use the Config block, it has me specify a baud rate but there's nowhere in FreeMaster to specify baud rate when using the MultiLink tool.  The model won't compile if I try to add the recorder without the FM Config block but the scope runs fine without the FM Config block.

I feel like I must be missing something easy but there's just so little documentation that I don't know if I'm way off base or not.

Thanks,

Dylan

1 Solution
3,715 Views
iulian_stan
NXP Employee
NXP Employee

Hi,

First thing to note when working with FreeMASTER BDM Plugin is that there are 2 modes:

  1. Direct access to target microcontroller memory - the "traditional" or non-intrusive debug mode. In this mode you don't need FreeMASTER support to be enabled on the target as it relies on the hardware debug mechanism, however you won't have access to FreeMASTER specific features such as TSA, Recorder or Pipes.
  2. PD or Packed-Driven BDM that uses the debug register to exchange data frames just like UART or CAN protocols. This mode requires FreeMASTER Driver enablement, which, as far as I know is not supported by the MatLAB Toolbox. You'd need to go into freemaster_cfg.h file and enable it:
#define FMSTR_USE_LPUART    0 /* To select LPUART communication interface */
#define FMSTR_USE_FLEXCAN 0 /* To select FlexCAN communication interface */
#define FMSTR_USE_PDBDM     1 /* To select Packet Driven BDM communication interface (optional) */

No need to disable other options explicitly - if an option is not present it is considered disabled (0). I just included other options as an example of what you should pay attention to depending on the MatLAB generated code.

To make sure you don't confuse these 2 modes, I suggest using Connection Wizard: 

Capture.PNG

Capture.PNG

Capture.PNG

In the next step it is configured just like Marius did.

Hope this helps,

Iulian

View solution in original post

9 Replies
3,715 Views
mariuslucianand
NXP Employee
NXP Employee

Hello sparkee‌,

Well, constantinrazvan.chivu‌ is right, the issue regarding the Recorder error will be investigated.

But, I understand from your post that there are actually two issues:

1. the connection through the multilink probe when the FreeMaster block is in the model.

How do you perform the settings for the Multilink probe in FreeMaster?

I tried going in the Options to the Comm options and selected in the Plug-In module the first option "FreeMASTER BDM Communication Plug-In"

pastedImage_2.png

Now, by pressing the Configure button, the following Window appears. Here I selected the P&E CortexM and selected the connection to USB Multilink. The only speed required here is the JTAG Clock Speed.

pastedImage_3.png

Using this setup, I was able to connect to the board even if the FreeMaster Config block is in the model so no changes had to be made in the model.

Instead of USB Multilink, you can select also the OpenSDA which comes directly on the S32K144 EVB but, if you are using the PEMicro, I suggest to power up the board externally in order to disconnect the OpenSDA from the circuit ( cheange the J107 to other position and unplug the USB cable). If not, then there will be two debuggers (Multilink and OpenSDA on the same JTAG link to the controller).

pastedImage_4.png

2. The problem with the recorder. Well, you have a compile issue but I tried to use the recorder using this setup and I got the following message error: Recorder could not be initialised. Error 0x80000081 (Invalid command.)

pastedImage_5.png

Once again, I will ask our friend iulianstan to help us answer this question:‌ Is the FreeMaster Recoder available over the Jtag connection?

Hope this helps,

Marius

3,716 Views
iulian_stan
NXP Employee
NXP Employee

Hi,

First thing to note when working with FreeMASTER BDM Plugin is that there are 2 modes:

  1. Direct access to target microcontroller memory - the "traditional" or non-intrusive debug mode. In this mode you don't need FreeMASTER support to be enabled on the target as it relies on the hardware debug mechanism, however you won't have access to FreeMASTER specific features such as TSA, Recorder or Pipes.
  2. PD or Packed-Driven BDM that uses the debug register to exchange data frames just like UART or CAN protocols. This mode requires FreeMASTER Driver enablement, which, as far as I know is not supported by the MatLAB Toolbox. You'd need to go into freemaster_cfg.h file and enable it:
#define FMSTR_USE_LPUART    0 /* To select LPUART communication interface */
#define FMSTR_USE_FLEXCAN 0 /* To select FlexCAN communication interface */
#define FMSTR_USE_PDBDM     1 /* To select Packet Driven BDM communication interface (optional) */

No need to disable other options explicitly - if an option is not present it is considered disabled (0). I just included other options as an example of what you should pay attention to depending on the MatLAB generated code.

To make sure you don't confuse these 2 modes, I suggest using Connection Wizard: 

Capture.PNG

Capture.PNG

Capture.PNG

In the next step it is configured just like Marius did.

Hope this helps,

Iulian

1,395 Views
OCEAN_CEC
Contributor I

你好我这边用的S32K344 Q172 EVB ,然后尝试用direct Access 的方式连接了,根据描述EVB这边是不需要 FreeMaster 的驱动支持的。但是我这边testConnection 一直是灰色。这边有什么好的建议吗?

0 Kudos
3,715 Views
sparkee
Contributor V

Thank you all for your input.  

There was a little confusion as to what the problem was due to me citing multiple issues and not being as thorough and clear as I should have.  We've definitely taken a big step towards clearing up the issue though.

I have no issues using FreeMaster when connected over SDA to the Dev Board.  It works great.  Scope is a little slower than I'd like but not a problem because I can use the Recorder when I need higher fidelity.

Where I ran into the problem was trying to use the Recorder with the MultiLink Universal.  My problem stemmed from using the direct access mode instead of PD-BDM mode.  

When I go into the PD-BDM configure window, the S32K does not appear in the dropdown box:

pastedImage_1.png

If I go into Configure and Test Connection:

pastedImage_4.png

It looks like all is good? But when I go pack to the main configuration screen and Test Connection I get this:

pastedImage_2.png

3,715 Views
iulian_stan
NXP Employee
NXP Employee

You are almost there, the missing piece is the communication buffer address. You can either specify:

  1. its exact address or
  2. a range to scan

Capture.PNG

You could get the exact address from the map file. The line would look like this:

.bss.pcm_bdm_pCommBuffer 0x20004c64 0x44 ./FreeMASTER/src_common/freemaster_bdm.o

Or specify the range. Considering you cannot predict the exact location where that buffer will be stored you'd need to specify the entire RAM range.

3,714 Views
sparkee
Contributor V

Thank you for the reply but that does not exist in my freemaster_bdm.o file nor can I search and find it.

pastedImage_1.png

0 Kudos
3,714 Views
iulian_stan
NXP Employee
NXP Employee

To clarify - the thing I mentioned above, currently won't work with MatLAB toolbox. I just checked with mariuslucianandrei‌ and found out that the toolbox does not even include freemaster_bdm sources that would be compiled into that object file. So simply modifying that flag won't do the work, or to be precise - it won't compile due to missing source files. The process of enableing this functionality starting from the MatLAB/Simulink project at this point would be quite complicated:

1. Import the project into an external IDE

2. Add missing source files from FreeMASTER Driver

3. Adjust configuration options

Needless to say it will completely break the compatibility with the MatLAB/Simulink project.

At this point, a "workable" option is the one shown by Marius (standard BDM with limited FreeMASTER features).

I would let someone from the MBDT team comment in case there are any plans to add PD-BDM support to the MatLAB toolbox.

Regards,

Iulian

3,714 Views
sparkee
Contributor V

My apologies, I see that you said in your previous post that it is NOT supported in MATLAB. 

3,714 Views
constantinrazva
NXP Employee
NXP Employee

Hello sparkee,

Unfortunately for the moment we only support FreeMASTER over the serial and CAN. I will look into this and maybe come up with a way for you to do it - we'll have to see. I'll get back on Friday or Monday with an updated on this.

Kind regards,

Razvan.