AnsweredAssumed Answered

CAN transmission works well at SDK02 but does not work at SDK03

Question asked by Kim JungHyun on Mar 6, 2017
Latest reply on Mar 9, 2017 by Martin Kovar

Hi.

Recently I made CAN message transmission code and it worked well. I confirmed it on the CANoe

* I had some problems so I asked here and PetrS helped me so I could handle it.

  The problem was clock.

 

But after I updated S32DS, this code did not transmit CAN message.

* Of course I changed all components which I used from SDK02 to SDK03.

So I made another new project and I used same code. But CAN transmission did not work.

* Digital input and output worked well.

* CAN related functions executed during debuging (I checked it)

 

Why this code do not transmit CAN message?

 

MCU : S32K144_64pin

TX : PTC7(51pin)

 

<Code>

/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "pin_mux.h"
#include "clockMan1.h"
#include "dmaController1.h"
#include "osif1.h"
#include "canCom1.h"

  volatile int exit_code = 0;


/* User includes (#include below this line is not maintained by Processor Expert) */
#define MB (0UL)
#define MSG_ID (0UL)

/*!


  \brief The main function for the project.
  \details The startup initialization sequence is the following:
 * - startup asm routine
 * - main()
*/


int main(void)
{
  /* Write your local variable definition here */
 flexcan_data_info_t dataInfo =
 {
 .data_length = 1U,
 .msg_id_type = FLEXCAN_MSG_ID_STD,
 .enable_brs = false,
 .fd_enable = false,
 .fd_padding = 0U
 };
 uint8_t toggleLED = 0x55;

 

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  #ifdef PEX_RTOS_INIT
    PEX_RTOS_INIT();                   /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
  #endif
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
  /* For example: for(;;) { } */


CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, 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(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);
FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1,MB, &dataInfo, MSG_ID);

 

for(;;)
{
    if(GPIO_HAL_ReadPins(PTD)>>0==1)
    {
     GPIO_HAL_ClearPins(PTC,1<<0);
     FLEXCAN_DRV_Send(INST_CANCOM1,MB, &dataInfo, MSG_ID, &toggleLED);  
    }
    else
    {
     GPIO_HAL_SetPins(PTC,1<<0);
    }
}

Original Attachment has been moved to: CAN_FD_1.zip

Outcomes