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
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
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_CMDID) and TX (FMSTR_CAN_RESPID) into 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
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 :
Sophie
Hi, would you please elaborate: "Only basic CAN driver configuration is required"? as far as i can see, there at least needs to config the pins, enable (and configure?) the clocks, hook up the interrup (directly or indirectly to FMSTR_can_isr??), configure the flexCan_43. but is it needed to config the hardwareobject or CANIF ? please help clarify.
Hi @gzleng,
FreeMASTER Driver has an optimistic approach when it tries to use the CAN peripheral.
- It uses the CAN base address and operates directly with the registers to send/receive data.
- It does not verify whether it is enabled nor properly configured
It is expected that the developer performs the bare minimum configurations required to make the peripheral usable. It includes:
- Enabling the clocking for the used CAN instance
- Enabling and configuring CAN instance (Can_43_FLEXCAN should be sufficient, FreeMASTER does not use AUTOSAR's service layer → CanIf is not needed for FreeMASTER)
- Configuring the pins for the used CAN Instance
These configurations will allow you to use FreeMASTER Driver in polling mode. For interrupt mode, one more configuration is required:
- Configure the interrupt controller (enable CAN interrupt, and assign FMSTR_CanIsr as interrupt handler)
Hope it helps
thanks Stan
after configuring one Transmit, one Receive Hardware Object in the EB, now the MB works. but i'm running into another issue with the host PC side: the ping is successful but the communication wizard still greys out so it cannot be finished. Attempting to configure the connection string in the Options dialog leads to a "the plugin configuration dialog failed, Try to specify the connection string manually" error. similar to another post from Jan 9th. i don't use mbdt and the driver is the 1.5.0
Just to be sure - did you try Michal's suggestion ?