Hi.
I have been trying to transmit CAN message but there have been 2 errors. Stuff error and Form error.
- message transmission : MCU -> Transceiver : error (I think) ,
Transceiver -> CANoe : 2 errors(Stuff error, Form error)
What would be a problem?
■ MCU TX (PTC7, pin 51) : error (refer to yellow and red color)
■ Transceiver CAN high(pin 7) : error (refer to yellow and red color)
※ Other item of my company :
- CAN frame is transmitted correctly (refer to yellow color which is CAN high at Transceiver)
- You can see id, DLC, Data frame (refer to blue color)
■ Transceiver -> CANoe : 2 errors(Stuff error, Form error)
■ MCU : S32K144 (64pin)
- CAN TX : 51pin (PTC7, CAN1_TX)
- CAN RX : 52pin (PTC6, CAN1_RX)
■ Transceiver : TJA1057
■ Schematic (I attached it)
- TRK-KEA 2014 Freescale
- 8pin : connected to ground (set to low level)
- 5pin : originally connected as above but now I opened this pin to check whether to work
■ Code (I attached it)
CLOCK_SYS_Init(g_clockManConfigsArr, FSL_CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, FSL_CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
FLEXCAN_DRV_Init(FSL_CANCOM1,&canCom1_State, &canCom1_InitConfig0);
FLEXCAN_DRV_ConfigTxMb(FSL_CANCOM1, MB, &dataInfo, MSG_ID);
for(;;)
{
if(GPIO_HAL_ReadPins(PTD)>>0==1)
{
GPIO_HAL_ClearPins(PTC,1<<1);
FLEXCAN_DRV_Send(FSL_CANCOM1, MB, &dataInfo, MSG_ID, &toggleLED);
}
if(GPIO_HAL_ReadPins(PTD)>>0==0)
{
GPIO_HAL_SetPins(PTC,1<<1);
}
}
■ And some questions
1. Can a clock configuration be a problem?
2. I need a code that transmit a message only one time
3. I checked the example project - CAN MASTER example. But CAN frame was not transmitted.
- While this project was being executed, 'SendCANData()' was executed but CAN frame was not transmitted.
- measured point : PTE(5) - CAN0_TX
- package : I set both 100pin and 64pin but all that was not executed.
- debuging picture (digital input works correctly. CAN transmission does not work)
Original Attachment has been moved to: 2017_2_21.zip
Hi,
It looks the bit timing is not properly set.
With the same scope setting (time base) the bit time is at least 2 timer longer on first 2 pictures then or the 3rd.
How do you set the CAN bit timing in your project? I do not see any.
In the CAN MASTER example it is set in this way to get 500kbit/s using 8MHz as PE clock
BR, Petr
Hi.
CAN bit time is 500kbit/s.
Please refer to below.
- Module clock and PE clock are 0Hz.
As you pointed above, I made a new other project and switched package from 100pin to 64pin first
I checked clocks and it was ok.
And then I added digital input and output which worked well.
But when I added [fsl_flexcan], FlexCAN0 clock and FlexCAN1_clock were 0Hz.
* Module clock and PE clock were 0Hz too.
So I switched package from 64pin to 100pin and I confirmed CAN related clocks were ok.
And again I switched back package from 100pin to 64pin and CAN related clocks were ok.
But digital input and output did not work. Of course CAN did not work
What should I check?
Thank you.
Kim.
You should configure both the Module and PE clock properly in fsl_clock_manager component.
You can open it e.g. from CAN component’s “Shared components” tab
And enable SOSCDIV2 from SOSC setting
And also be sure CAN0 module clock is enabled in PCC setting
BR, Petr
I configured as above but CAN frame did not trasmitted.
This code worked well before I added CAN related code including CAN related configuration on Component Inspector.
But after I added CAN related code, this code did not work any more.
This code stoped at function [FLEXCAN_HAL_Enable()]. refer to following picture.
Thank you.
Kim.