CAN Tx Not Transmitting

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
KeRi_4366371
Level 1
Level 1

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 = MESSAGE; /* 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);

        }

    }

}

0 Likes
1 Solution

I've solved this. Don't spend too much time debugging it.

I did not have a clear enough understanding of the CAN Protocol (how the nodes sync) 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.

Thank you though! I really do appreciate it.

View solution in original post

0 Likes
3 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

I think we need some time to debug this project.

0 Likes

I've solved this. Don't spend too much time debugging it.

I did not have a clear enough understanding of the CAN Protocol (how the nodes sync) 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.

Thank you though! I really do appreciate it.

0 Likes
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

Thank you for sharing the resolution

Roy Liu
0 Likes