cancel
Showing results for 
Search instead for 
Did you mean: 

having meaning less CAN signal

DNewm.1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
ck182
Associate II

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

  

 

View solution in original post

6 REPLIES 6
ck182
Associate II

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

  

 

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

ck182
Associate II

Hi,

set

-PROSEG=4

-PSEG2=1

-PSEG1=7

then try two value of PRESDIV: 3 or 7

 

 

 

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 

ck182
Associate II

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.

Thanks ck182 and have a good time.