cancel
Showing results for 
Search instead for 
Did you mean: 

SPC582Bxx CAN initialization and configuration

Rohit Rajapure
Associate II

Hello All, 

we are using the SPC582Bxx family device for our automotive system, 

We have gone through the guides related to SPC582Bxx, Auto devkit studio and ran some sample code by referring the tutorial available from ST team. 

since I am new to this family, I would like to know about can configuration in detail. We are working on device using CAN protocol for communication, we would like to transmit and receive the CAN data from one device to another (SPC5). Based on the received data we would control the audio. 

Can anyone help us to how to enable, Initialize and configure the CAN protocol for SPC582Bxx family. 

14 REPLIES 14
Rohit Rajapure
Associate II

Hi, 

Thanks for the quick response, 

I have followed the AVAS sample code (from tutorial), It worked as explained in tutorial. We want to work on similar project so chosen this sample for proceeding with implementation. 

Referred document - UM2719  AVAS architecture based on Auto Devkit. We have all setup as dev kit, audio kit and power kit. 

Dev kit - spc582b60e1 using. 

Sample code - SPC582Bxx_RLA_AEK_AUD_D903V1 - Engine Sound simulator with Connector board. 

Now, we are trying to test the CAN part of code, we have CAN transceiver and all setup but still not able to work. We are not getting whether the CAN section is enabled or not. 

We are new this, if you could guide us to test the same and as well as do the custom changes and linking of files (all library file to project) will help us to proceed further and work on this. 

 

Please share the file links steps as well as the enabling of CAN section and testing procedure for the same. 

 

Thanks and Regards

Rohit R

Hi,

i never use  Auto Devkit, bus if you want to use CAN-BUS try this example: 

SPC582Bxx_RLA_CAN Test Application

 

Rohit Rajapure
Associate II

Hi, 

Thank you for the response,

Will check with sample and get back to you.

 

Thanks and Regards

Rohit R

Hi, 

As you suggested we are gone through the example but also in mean time we looked sample SPC582Bxx_RLA_AEK_AUD_D903V1 Engine_Sound_Simulator with Connector code,

Here, in Engine Sound Simulator code we saw the CAN transmit and Receive code snippet. But when we tried to execute the same we are unable to execute the CAN code. We tried to Receive the data but still not getting the result. 

Can you help me whether the CAN part is enabled in this code or not? If Not, then let us know how to enable the CAN section and even we are not able to find how to set baudrate or where the buad rate is been set?

Please help us to understand in detail about baud rate and other set regarding CAN. 

Thanks and Regards

Rohit R

Have you checked the CAN config if it loops back or is set to external? Otherwise your transceiver will send nothing out. 

Have you checked the holy trinity of CAN:  Termination, baud rate and Acknowledgement turned on when using only two nodes? 

I just went through the same and got my CAN finally working nice

Rohit Rajapure
Associate II

Hi,

Thanks for the response, 

CAN setting option is No_loopback, as you can see below, 

RohitRajapure_0-1700797050963.png

can you guide more detail about how to set this things if we want build the custom project?

Regarding the testing, we are using can analyzer to send some data, we are just checking the Rx part not transmitting part, 

We are verifying the below code section, 

void mcanconf_rxreceive(uint32_t msgbuf, CANRxFrame crfp)
{
(void)msgbuf;

if (crfp.ID == 0x7f0U)
{
if (crfp.data32[0] == 0xAABBCCDDUL) //START
{
state = START;
}
else
{
state = STOP;
}
}

}

Where is the baud rate set? we are unable to figure out the baud rate for this project. 

Please do share if any document which explain about setting up baud rate and other configuration It will help us to fast implementation. 

Waiting for positive response with complete guide. 

Thanks and Regards

Rohit R

If you did not change anything from the example baud rate is 500. You selectvit with clock prescalar. I do not understand the clock setting myself bjt I found a way to switch between 250, 500 and 1000, a bit try and error I guess. 

Next thing: watch out for extended or standard frame. This is set up int the rx receive filter settings. Just double click the filter.

If you look here for my posts you can find a CAN thread which resolved some mysteries to me. Other than that I just went through the Application Note- you can find that also in the other thread. 

Here is the application note you want to follow through with (Max post)

https://community.st.com/t5/autodevkit-ecosystem/autodevkit-2-2-can-examples-missing-version-bug/td-p/609030