AnsweredAssumed Answered

CAN_LDD mk22fn1m0vlk12 loopback issues

Question asked by daafies on Mar 14, 2016
Latest reply on Mar 18, 2016 by daafies


hi i've been unable to loopback any can frames. i've tried all examples here on the forum without any luck. i enabled int service. breakpoint on CAN1_OnFreeTxBuffer DOES hit, but CAN1_OnFullRxBuffer does NOT.

 

 

 

here's some code snippets:

 

events.c:

 

void CAN1_OnFullRxBuffer(LDD_TUserData *UserDataPtr, LDD_CAN_TMBIndex BufferIdx)

{

  canrx = TRUE;

  /* Write your code here ... */

}

 

 

main.c:

 

extern bool canrx;

LDD_TDeviceData *MyCANPtr=NULL;

 

LDD_TError Error;

LDD_CAN_TFrame Frame,RFrame;

 

void can_test(void)

{

  LDD_CAN_TAccMask AccMask;

  uint8_t OutData[8] = {0x00U, 0x01U, 0x02U, 0x03U};

   Frame.MessageID = 0x123U;                                       /* Set Tx ID value - standard */                                       /* Set Tx ID value - standard */

   Frame.FrameType = LDD_CAN_DATA_FRAME;                           /* Specyfying type of Tx frame - Data frame */

   Frame.Length = sizeof(OutData);                                 /* Set number of bytes in data frame - 4B */

   Frame.Data = OutData;                                           /* Set pointer to OutData buffer */

   //DataFrameTxFlg = FALSE;                                         /* Initialization of DataFrameTxFlg */

   Error = CAN1_SendFrame(MyCANPtr, 1U, &Frame);

   Error = CAN1_GetAcceptanceMask(MyCANPtr, 0U, &AccMask );

}

 

int main(void)

{

  /* Write your local variable definition here */

  MyCANPtr = CAN1_Init(NULL);

 

 

  for(;;){

 

          WAIT1_Waitms(5);
 

        if(canrx){

          canrx=FALSE;

 

 

          RFrame.Data = InpData;
          Error = CAN1_ReadFrame(MyCANPtr, 0U, &RFrame);
          }
                    cnt++;
          if ((cnt%1024)==0) { /* from time to time, write some text */

 

 

          can_test();

}}

 

thanks for any pointers

 

david

Outcomes