I recently installed MBDT 1.5 for the S32K3xx series. I built a simple model to connect the board to FreeMaster over CAN.
I have CAN configured to work at 500Kb and used the FreeMaster Config block to set the mode to long interrupt ( I also tried with short interrupt and polling). I have an initialisation function where I am calling the Can_SetControllerMode function.
I have also tried calling the Can_EnableControllerInterrupts function in the initialisation function.
However, I am not able to connect over CAN through FreeMaster. I get the "error contacting the target" error message.
I am using FreeMaster desktop tool version 3.2.2. For the connection itself, I am using a PEAK CAN device. I have tried connecting a number of PEAK CANs but none connect. The devices themselves aren't faulty because I have tested them with other boards.
I am attaching my model and the mex file for reference (there are some NVM blocks too which are also problematic and I have commented them out).
Can someone help me with this, please?
Hello and thank you for using our product.
I had a look on the Simulink model you provided and I couldn't find any initialization for the CAN transceiver. Normally this is done in the "initialize" block and it usually implies setting a few DIO pins to certain values depending on the hardware connections on the electrical board. For reference, please check the FreeMASTER over CAN example in your toolbox:
It can be found at this location: "S32K3_Examples\fm\s32k3xx_fm_over_can_s32ct".
While at this path, right click on file "s32k3xx_fm_over_can_s32ct.pmpx" and then click on "Open Outside Matlab". This launches the FreeMASTER PC application with some settings already configured. Please make sure that both "Command Message ID" as well as "Response Message ID" are set to value 0x7aa and both have the "Extended ID" checkbox checked. You can get to this menu by navigating to "Project -> Options... -> Comm tab -> Configure... button":
Hi Adrian!
I tried with the example as well just now, but it still doesn't connect. I am working with S32K344-Q257. I had a look on my board and I can see that my CAN Transceiver is the 1043, so I selected that option in the example model, built it and flashed it on the board. I also checked that the Command and Response Message ID are set to 0x7aa and the extended ID checkbox is ticked.
What else could be causing this issue?
Is this the evaluation board you are using: S32K3x4-Q257 Full-Featured General Purpose Development Board ?
Activating the CAN transceiver is an operation that is hardware specific, that's why it is important to check these details:
1. What CAN instance is used by the FreeMASTER Config block? The example comes by default with FLEXCAN_0
2. Based on the schematic document of your board, what CAN transceiver is connected to that specific instance?
3. To which pins of the microcontroller are the transceiver's CANx_EN and CANx_STB (same x as for FLEXCAN_x) connected to?
4. Are these two pins of the microcontroller created and configured in the S32CT configuration and their state (High/Low) corresponds to transceivers requirements (EN requires High, STB requires also High to avoid standby)?
You can refer to this article for more details on how to configure the digital output pins for the CAN transceiver: Communicating over the CAN Bus (see chapter 2. CAN Configuration)