Skip to main content
Associate III
August 30, 2023
Solved

having meaning less CAN signal

  • August 30, 2023
  • 3 replies
  • 3978 views

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.
Best answer by ck182

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

  

 

3 replies

ck182Best answer
Associate
August 31, 2023

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
September 4, 2023

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
September 6, 2023

Hi,

set

-PROSEG=4

-PSEG2=1

-PSEG1=7

then try two value of PRESDIV: 3 or 7

 

 

 

DNewm.1Author
Associate III
September 7, 2023

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
September 8, 2023

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
September 8, 2023

Thanks ck182 and have a good time.