FreeMASTER checksum error when connected to S32K3xx by CAN

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

FreeMASTER checksum error when connected to S32K3xx by CAN

Jump to solution
5,395 Views
liangyaoyu
Contributor I

Dear all,

I am working on the FreeMASTER driver 3.0 for S32K3 and trying to establish the connection between host PC and the evaluation board. The 'Test Connection' command is OK, but failed when run 'Start communication'. The error information and CAN messages can be found in the attachments. 

Thank you.

 

0 Kudos
Reply
1 Solution
5,288 Views
iulian_stan
NXP Employee
NXP Employee

Hi @liangyaoyu,

Apologies for a delayed reply. Unfortunately, we do not support CAN interface on S32K3 family.
I could recommend using the FreeMASTER Driver 2.0 that includes CAN support for S32K1 family (S32K3 have a similar FlexCAN module as S32K1 and that driver should work with both modules). 

FreeMASTER 3.0 (desktop tool) is also backward compatible with older deriver versions.

Kind regards,
Iulian  

 

View solution in original post

0 Kudos
Reply
16 Replies
5,276 Views
liangyaoyu
Contributor I

Thank you so much. It works now by using Driver 2.0.

0 Kudos
Reply
4,683 Views
SSH23
Contributor I

Hello,

We are also trying to use the FreeMaster tool for S32K344 over CAN. We are using the Model Based Design method and in the FreeMaster toolbox there is an option only to select UART. Can you please guide us on how to use the FreeMaster Tool to calibrate parameters over CAN for S32K344? An also can you suggest which version of the FreeMaster tool should we use?

 

Thanks,

Saiesh

0 Kudos
Reply
5,289 Views
iulian_stan
NXP Employee
NXP Employee

Hi @liangyaoyu,

Apologies for a delayed reply. Unfortunately, we do not support CAN interface on S32K3 family.
I could recommend using the FreeMASTER Driver 2.0 that includes CAN support for S32K1 family (S32K3 have a similar FlexCAN module as S32K1 and that driver should work with both modules). 

FreeMASTER 3.0 (desktop tool) is also backward compatible with older deriver versions.

Kind regards,
Iulian  

 

0 Kudos
Reply
4,210 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
I recently came across this post as I'm trying to do the same thing - interface my S32K344 with FreeMaster over CAN. I didn't understand how exactly I should go about this though. I downloaded the Driver 2.0 and I can see a few source and header files (.c and .h) but I'm not getting how exactly I should integrate them with my application. 

I use Simulink to build my models and S32 Design Studio for AUTOSAR configurations. In the K144 builds when I use the FreeMaster config block from the MBDT, I can see in the generated code that there are 2 lines which initialise the FreeMaster configuration. So I know that I need to somehow do the same with my K344 model but I'm not sure how. Can you help me with it, please?

Thanks

0 Kudos
Reply
4,196 Views
iulian_stan
NXP Employee
NXP Employee

Hi @rishikesh_c,

You would need to integrate FreeMASTER code in to your application:

  1.  Add FreeMASTER_Serial_Communication_Driver_V2.0\src_common and FreeMASTER_Serial_Communication_Driver_V2.0\src_platforms\S32xx folders to your S32K344 project source and link location.
  2. Configure CAN peripheral independently of FreeMASTER.
  3. Configure FreeMASTER driver. You can refer to freemaster_cfg.h file generated for the S32K144 project. Most likely it will be a 1-to-1, with a single change:
    #define FMSTR_CAN_BASE         0x40024000UL /* FlexCAN0 base on S32K14x */
    // should be replaced with CAN base address configured in step 2​
  4. Invoke FreeMASTER initialization routine FMSTR_Init() in your application initialization section
  5. Invoke FreeMASTER polling function FMSTR_Poll() periodically (ex: in a timer interrupt, or periodic task)

Note: The steps described above should work if you are working in an "classic" IDE. I am not aware whether MatLAB allows this type of configuration.

0 Kudos
Reply
4,151 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
I am getting stuck on step 3. Specifically, setting the CAN base address. While configuring the CAN module in Design Studio, I did not see any field for base address but I did come across CanHwFilter in which an address can be set. Is this the one to be used?

Further, I tried calling the FMSTR_Init() function from the main c code generated for my model, and I can see that the freemaster.h header exists in the model's main header file, but I get an error saying undefined reference to FMSTR_Init. 

Can you please help with this?

Thanks

0 Kudos
Reply
4,144 Views
iulian_stan
NXP Employee
NXP Employee

Hi @rishikesh_c,

1. Regarding CAN base address - it is defined in S32K344.h header file.
Capture.PNG

 

2. FMSTR_Init is not defined - could you check if freemaster.h is included in the source file where you call FMSTR_Init function.

0 Kudos
Reply
4,139 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
I found the CAN Base address as you mentioned and I checked the generated code to see if freemaster.h is included. It is included but I was still getting that error. I then moved to S32 Design Studio to build an existing example project and tried configuring FreeMaster for that. However, I am now getting a new error:

 

Building target: Can_example_S32K344.elf
Invoking: Standard S32DS C Linker
arm-none-eabi-gcc -o "Can_example_S32K344.elf" "@Can_example_S32K344.args"
c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: warning: c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-memset.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: ./generate/src/freemaster_tsa.o: in function `FMSTR_GetTsaInfo':
C:\Users\User\workspaceS32DS.3.4\Can_example_S32K344\Debug_FLASH/../generate/src/freemaster_tsa.c:212: undefined reference to `FMSTR_TsaGetTable'
c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: ./generate/src/freemaster_tsa.o: in function `FMSTR_CheckTsaSpace':
C:\Users\User\workspaceS32DS.3.4\Can_example_S32K344\Debug_FLASH/../generate/src/freemaster_tsa.c:316: undefined reference to `FMSTR_TsaGetTable'
c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: C:\Users\User\workspaceS32DS.3.4\Can_example_S32K344\Debug_FLASH/../generate/src/freemaster_tsa.c:375: undefined reference to `FMSTR_TsaGetTable'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:38: Can_example_S32K344.elf] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.

 

 

I have only included the files you mentioned in the project and haven't executed FMSTR_Init() 
Is there something wrong with the way the files are included? As in should they be placed in a particular folder? I have tried placing all the header files in the generate/include folder and the source files in the generate/src folder


I am running the Can_example_S32K344 example project on Design Studio 3.4

Can you please help with this? 

Thanks

0 Kudos
Reply
4,135 Views
iulian_stan
NXP Employee
NXP Employee

Hi @rishikesh_c,

The error you see is related to FreeMASTER configuration (freemaster_cfg.h). It seems that it is configured to use TSA table but none was defined.

TSA table functionality is mechanism allowing to declare symbolic information directly in your application, but it can also be extracted directly from the ELF file. I assume you are using the later option.

To fix this you need to disable TSA in freemater_cfg.h:

from

 

#define FMSTR_USE_TSA          1    /* Enable TSA functionality */

 

to

 

#define FMSTR_USE_TSA          0    /* Disable TSA functionality */

 

0 Kudos
Reply
4,120 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
Thanks for the quick response. Setting the TSA variable to 0 worked and I was also now able to build my simulink model successfully. The next problem I am facing is over FreeMaster itself. In the connection wizard I selected the "Connect over CAN bus" option and after that, in the plug-in configuration options, I set the Driver and baud rate based on my model and the CAN device I am using to connect to my PC.

rishikesh_c_0-1711010170418.pngrishikesh_c_1-1711010173853.png

 


However, clicking on Test Connection, I get an error saying "No board detected". I think the issue is with the Command Message ID (it is set to the default value in FreeMaster and I am not sure which is the correct one). How do I fix this error and how do I find the Command Message ID if it is in fact the cause of the problem?

Thanks

0 Kudos
Reply
4,108 Views
iulian_stan
NXP Employee
NXP Employee

0x7aa is the default Command ID used by both FreeMASTER library and desktop tool, so you don't have to change it.

Capture.PNG

I would suggest to check FreeMASTER debug transmission. It will allow you to confirm whether:

  • CAN is properly configured, and
  • FreeMASTER can send its messages via the corresponding interface.

In order to do it you need to:

1. Enable debug transmission

#define FMSTR_DEBUG_TX 1

2. Switch to polling mode (in case you use interrupt mode). This config is defined in freemaster_cfg.h

#define FMSTR_LONG_INTR        0    /* Complete message processing in interrupt */
#define FMSTR_SHORT_INTR       0    /* SCI FIFO-queuing done in interrupt */
#define FMSTR_POLL_DRIVEN      1    /* No interrupt needed, polling only */

3. Connect a can analyzer and inspect the messages sent from the board

In case of a correct configuration, the board should continuously send a debug frame that should be visible in the CAN analyzer: 0xA9U or "+©W".

One other thing that you could check is whether Transmission abort mechanism is enabled. Check this thread for more details.

0 Kudos
Reply
4,102 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
I enabled debug tx and switched to polling mode. I used BusMaster to see if I am getting the message you mentioned but there are no messages on the bus. 

I then tried to check if FreeMaster is indeed using the Driver 2.0 and under "About FreeMaster" I can see that it says comm protocol v3+, v4. Does this mean it is not using the Driver 2.0? If that is the case, how do I make it use 2.0

rishikesh_c_0-1711026983469.png


I tried it with FreeMaster version 3.0, 3.1 and 3.2

 

0 Kudos
Reply
4,097 Views
iulian_stan
NXP Employee
NXP Employee

FreeMASTER (desktop tool) shows the latest supported protocol version. It is backward compatible with older protocol versions including v2 (which should be your case):

Capture.PNG

It is recommended to always use the latest eversion of the Desktop tool.

Note: while debug transmission is enabled, the PC tool won't be able to connect to the board.

0 Kudos
Reply
4,010 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
I switched back to the desktop tool version 3.2, turned off debug mode and tried connecting to my board through the FM desktop tool again, but I got the same error. Is there a way to check that the Driver 2.0 installation was successful and that the desktop tool is indeed using this version? Before installing 2.0, FM would have been working on the latest installed driver so I was wondering if that is the issue here.

Thanks

0 Kudos
Reply
3,999 Views
iulian_stan
NXP Employee
NXP Employee

Hi @rishikesh_c,

FreeMASTER Driver is the library the you are include into your embedded application (version can be checked in the source code). There is nothing to be installed on the PC side beside FreeMASTER tool (no extra drivers etc). When FreeMASTER (desktop tool) connects to the board, it automatically detects driver version.

Before looking into the desktop side - in the previous message you said that you did not see any CAN messages while debug transmission was enabled, meaning FreeMASTER Driver messages were not sent via the CAN interface. There is an issue on the embedded side (most likely on CAN configuration level).

Unfortunately, we do not provide official support for FreeMASTER CAN communication on S32K3xx. You will need to debug your embedded application to figure out why FreeMASTER messages are not leaving via the CAN interface.

0 Kudos
Reply
4,008 Views
rishikesh_c
Contributor III

Hi @iulian_stan ,
A quick update. 

I integrated the FreeMASTER codes into the Can_example_S32K344 and tried to debug the code line by line. In the int main function I called the FMSTR_Init() function like so:

FMSTR_BOOL fmstrInit = FMSTR_Init();

 

When I debugged the code, I got a hard fault when this line executes. The error is below:

BusFault: A precise (synchronous) data access error has occurred.
Possible BusFault location: 0x4006B018.
HardFault: A fault has been escalated to a hard fault.

What could be the reason for this? Is there some particular configuration within CAN I need to do? In the example project, CAN0 has been set up and in my freemaster_cfg.h file I've set the base address of CAN0 as well

0 Kudos
Reply