PSoC 4M CAN Errors

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.
Anonymous
Not applicable

Hi,

I am trying to get my CY8CKit-044 to talk over CAN. To do this I connected CAN-Tx and CAN-Rx together to a pull up resistor (with the CAN-Tx pin being set to open drain). This was then connected to my Saleae Logic Pro 8.

Using the code below, the output seems to be fine (message intact and a NAK at end) but the controller keeps on transmitting the frame with CAN_1_Data = 1 and no delay (Capture #2). If I turn single shot on, the message is only transmitted once and then a second later another frame is sent with the data byte being 255 (what I want (capture#1)). Am I not doing something in the code to properly set up the controller/frame?

Thanks,

Luke

uint8 CAN_1_Data = 1;

int main(void) {

    CyGlobalIntEnable;

    CAN_1_Start();

    UART_Start();

    for( ;; ) {

        CAN_1_TX_DATA_BYTE1(CAN_1_TX_MAILBOX_0, CAN_1_Data);

        CAN_1_SendMsg0();

        CyDelay(1000);

        if(CAN_1_Data == 1)  {

         CAN_1_Data = 255;

        }

         else{

            CAN_1_Data = 1;

        }

     }

}

0 Likes
1 Reply
harshadap_76
Employee
Employee
First like received

Hi Luke,

Can you monitor if CAN_1_SendMsg0 returns success and only then go ahead for next update?

For eg. refer below:

while(CYRET_SUCCESS != CAN_1_SendMsg0() );

Regards

Harshada

0 Likes