1 Reply Latest reply on Mar 18, 2018 11:17 PM by hjpn

    PSoC 4M CAN Errors

    21955879_3044561

      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;

              }

           }

      }