Skip to main content
Associate III
Aug 30, 2023 7:16 PM UTC
Solved

having meaning less CAN signal

Hello 

I'm working with SPC560P40 and I tried to send CAN data but with any condition which I tried out, it has just some regular pulses that has no meaning. I saw all examples in SPC5Studio but I got same pulses. would you please help me out with this problem.

Thanks for your attention

This topic has been closed for replies.
ck182Best answer
Associate
Aug 31, 2023 8:49 AM UTC

Hi,

1-> Set with Pin Map Editor: Digital Output CANTXD0 pin and Digital Input CAN0RXD pin

2->In Low Level Drivers Component RLA:

    2A->Enable Drivers: Flag CAN

    2B->In FlexCan Settings Enable CAN0, set filter and timing

    2C: Clik on Generate SPC5 Application

3->In main.c add #include "can_lld_cfg.h"

componentsInit();

irqIsrEnable();

can_lld_start(&CAND1, &can_config_name_of_your_config);

and in while loop to send somethings:

while(true){

txmsg1.data8[0]=21;

txmsg1.LENGTH = 1;

txmsg1.IDE= CAN_IDE_STD;
txmsg1.SID = 123;
txmsg1.RTR = CAN_RTR_DATA;
 
can_lld_transmit(&CAND1, 1, &txmsg1);
 
osalThreadDelayMilliseconds(100);
}
 
4->Build and test

  

 

6 replies

ck182Best answer
Associate
Aug 31, 2023 8:49 AM UTC

Hi,

1-> Set with Pin Map Editor: Digital Output CANTXD0 pin and Digital Input CAN0RXD pin

2->In Low Level Drivers Component RLA:

    2A->Enable Drivers: Flag CAN

    2B->In FlexCan Settings Enable CAN0, set filter and timing

    2C: Clik on Generate SPC5 Application

3->In main.c add #include "can_lld_cfg.h"

componentsInit();

irqIsrEnable();

can_lld_start(&CAND1, &can_config_name_of_your_config);

and in while loop to send somethings:

while(true){

txmsg1.data8[0]=21;

txmsg1.LENGTH = 1;

txmsg1.IDE= CAN_IDE_STD;
txmsg1.SID = 123;
txmsg1.RTR = CAN_RTR_DATA;
 
can_lld_transmit(&CAND1, 1, &txmsg1);
 
osalThreadDelayMilliseconds(100);
}
 
4->Build and test

  

 

DNewm.1Author
Associate III
Sep 4, 2023 3:46 AM UTC

Hello

Thanks for your quick response, I tried out these codes and configures but the issues is still remaining. About the timing, based on formula for Bit Rate in this section, I tried to set the Bit Rate to 500kbs as the SYS_CLK is 64 MHz and XOSC_CLK is 16 MHz, how should I set PROPSEG, PSEG1, PSEG2 AND PRESDIV?

Thank you

IMG_20230903_152902.jpg

Associate
Sep 6, 2023 5:09 PM UTC

Hi,

set

-PROSEG=4

-PSEG2=1

-PSEG1=7

then try two value of PRESDIV: 3 or 7

 

 

 

DNewm.1Author
Associate III
Sep 7, 2023 12:15 PM UTC

Hello

Actually I tried them but it still has meaning less signals. Then I checked out board initialization component parts and pin identifier, I saw it has warning and says pin name must be unique! So would you please help me out with this.

Thanks again 

Associate
Sep 8, 2023 8:44 AM UTC

Hello,

post the pin map pic.

Chek pin name, i seams two pins have same name.

Bus sorry now i go to vacations, so i can't answer for two weeks.

DNewm.1Author
Associate III
Sep 8, 2023 1:41 PM UTC

Thanks ck182 and have a good time.