CAN configuration with RTD/EB tresos for Freemaster

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

CAN configuration with RTD/EB tresos for Freemaster

Jump to solution
201 Views
sobo
Contributor III

Hello,

we are using a S32K358 with RTD 4.0.0 and EB tresos for configuration.
we are using Freemaster over UART without problem.

Now we want to use Freemaster over CAN.
The step I try with the option FMSTR_POLL_DRIVEN and FMSTR_DEBUG_TX.

The FLEXCAN1 clock is enable using EB tresos config , DIO are configure using EB Tresos.

I also configure the CAN controller with EB TResos.(250 Kb)

but I can't see the Debug frame on CAN
I'm not sure I have configure the CAN properly, we also use the FLEXCAN 0 for other purpose.
I disable CanRxFifo

Do someone have a example of CAN configuration ?

Sophie

FREEMASTER S32K3 

Tags (3)
0 Kudos
Reply
1 Solution
161 Views
iulian_stan
NXP Employee
NXP Employee

If my understanding is correct,  EB Hardware are used by the RTD API to send/receive CAN messages, if so - they won't be used by FreeMASTER calls, but to avoid confusion I would remove them.

On the FreeMASTER configuration side (freemaster_cfg.h) select the CAN transport and set message buffer IDs:

// Select communication interface
#define FMSTR_TRANSPORT         FMSTR_CAN                 // Use can transport layer
#define FMSTR_CAN_DRV           FMSTR_CAN_S32_FLEXCAN     // Use can driver for FLEXCAN

/* Select RX and TX FlexCAN Message buffers */
#define FMSTR_FLEXCAN_TXMB     0
#define FMSTR_FLEXCAN_RXMB     1

 Additionally, you need to set CAN base addres before calling FMSTR_Init
either via FMSTR_CanSetBaseAddress function call

/* Set FreeMASTER can base address */
FMSTR_CanSetBaseAddress((FMSTR_ADDR)0x40304000);

/* Initialize FreeMASTER */
FMSTR_Init();

or via macro definition in the same configuration header file:

#define FMSTR_CAN_BASE 0x40304000

 

View solution in original post

0 Kudos
Reply
5 Replies
189 Views
sobo
Contributor III

How do I need to configure 

/* Select RX and TX FlexCAN Message buffers */
#define FMSTR_FLEXCAN_TXMB 1
#define FMSTR_FLEXCAN_RXMB 0


with EB tresos Hardware object configure as :

sobo_0-1756462250901.png

Sophie

0 Kudos
Reply
172 Views
iulian_stan
NXP Employee
NXP Employee

Hi Sophie,

You do not need to configure the RX and TX buffers in EB. Only basic CAN driver configuration is required.

FreeMASTER will set messages IDs for RX (FMSTR_CAN_CMDIDand TX (FMSTR_CAN_RESPIDinto the message buffers corresponding to those macros - FMSTR_FLEXCAN_RXMB and FMSTR_FLEXCAN_TXMB respectively.

Btw, are you able to send & receive standard messages (non FreeMASTER) ? As far as I know some S32K358 boards come with a secure CAN transceiver that requires additional configuration.

Iulian

0 Kudos
Reply
167 Views
sobo
Contributor III
Hi Iulian,

For the board we use our own hardware with a "normal" transceiver.
I will check if the HW is ok, but I would like to check the software configuration first.

So I need to remove hardware object from tresos and set
#define FMSTR_FLEXCAN_TXMB 0
#define FMSTR_FLEXCAN_RXMB 1

Sophie

0 Kudos
Reply
162 Views
iulian_stan
NXP Employee
NXP Employee

If my understanding is correct,  EB Hardware are used by the RTD API to send/receive CAN messages, if so - they won't be used by FreeMASTER calls, but to avoid confusion I would remove them.

On the FreeMASTER configuration side (freemaster_cfg.h) select the CAN transport and set message buffer IDs:

// Select communication interface
#define FMSTR_TRANSPORT         FMSTR_CAN                 // Use can transport layer
#define FMSTR_CAN_DRV           FMSTR_CAN_S32_FLEXCAN     // Use can driver for FLEXCAN

/* Select RX and TX FlexCAN Message buffers */
#define FMSTR_FLEXCAN_TXMB     0
#define FMSTR_FLEXCAN_RXMB     1

 Additionally, you need to set CAN base addres before calling FMSTR_Init
either via FMSTR_CanSetBaseAddress function call

/* Set FreeMASTER can base address */
FMSTR_CanSetBaseAddress((FMSTR_ADDR)0x40304000);

/* Initialize FreeMASTER */
FMSTR_Init();

or via macro definition in the same configuration header file:

#define FMSTR_CAN_BASE 0x40304000

 

0 Kudos
Reply
80 Views
sobo
Contributor III
Thanks Iulian.

I try the software on another board, and it's works

Sophie
0 Kudos
Reply