2 Replies Latest reply on Sep 25, 2020 12:46 PM by KeRi_4366371

    CAN Tx Not Transmitting

    KeRi_4366371

      Hello Everyone,

       

      EDIT:  I've solved it. I did not have a clear enough understanding of the CAN Protocol and the Transceiver I was using.  There were 2 things I did to solve my issue:

           1) I connected the Tx Signal to the Transceiver.  I previously did not have it connected to anything and was just probing the pin.

           2) I calculated the Sync parameters on the receiving end.

       

      All is well now, but I'll leave this up in case anyone comes across this issue.

       

       

      ORIGINAL MESSAGE:

       

      I am trying to send data using the CAN peripherals on the CY8CKit-044 and it does not send any data. Below is my code, and I've attached the full project for context.

       

      I'm monitoring the return value of CAN_SendMsg() and it returns a success 8 times then constantly fails.  When CAN_SendMsg() succeeds there is no signal on the physical pin (TX: P0[1], RX: P0[0]) when I probe it.  It doesn't look like it is actually transmitting anything before it fails.

       

      I'm absolutely lost. I followed the Component Datasheet (incl. trimming with WCO).  Even when I load the example project there is no signal on the pins.  Has anyone encountered this? Am I forgetting to enable or reset something?

       

      Any insight on this would be a huge help.

       

      /* ---- MAIN LOOP ---- */

       

      CAN_TX_MSG CAN_Msg;

      CAN_DATA_BYTES_MSG txData;

       

      #define CAN_MESSAGE_ID (0x1AAu)

      #define CAN_MESSAGE_IDE (0u)    /* Standard message */

      #define CAN_MESSAGE_IRQ (0u)    /* No transmit IRQ */

      #define CAN_MESSAGE_RTR (0u)    /* No RTR */

      #define TX_DATA_SIZE (25u)

       

      uint8 MESSAGE[] = {0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11}; //define 8 bytes of data

       

      int main(void)

      {     

          CAN_Msg.dlc = CAN_TX_DLC_MAX_VALUE;

          CAN_Msg.id  = CAN_MESSAGE_ID;

          CAN_Msg.ide = CAN_MESSAGE_IDE;

          CAN_Msg.irq = CAN_MESSAGE_IRQ;

          CAN_Msg.msg = &txData;

          CAN_Msg.rtr = CAN_MESSAGE_RTR;

        

          uint8 error = 0;

          uint8 i;

        

          RGB_Init();

       

          USB_Bridge_Start();

          CAN_Start();

          CAN_SetOpMode(CAN_ACTIVE_RUN_MODE);

        

          CyGlobalIntEnable; /* Enable global interrupts. */

        

          for(i=0; i < CAN_TX_DLC_MAX_VALUE; i++){

              txData.byte[i] = MESSAGE[i]; /* move data to the structure */

          }

       

          for(;;)

          {

              error = CAN_SendMsg(&CAN_Msg);

       

            

              if(error == CAN_FAIL)

              {

                  RGB_Blink(Red, 1);

              }

              else if(error == CYRET_SUCCESS)

              {

                  RGB_Blink(Green, 1);

              }

          }

      }