cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any example code available for CAN interface for STM32F103C8 in STM32Cube_FW_F1_V1.6.1?

sumit grover
Associate II
Posted on May 25, 2018 at 08:54

The original post was too long to process during our migration. Please click on the attachment to read the original post.
8 REPLIES 8
Imen.D
ST Employee
Posted on May 25, 2018 at 09:42

Hello

sumitgrover97

,

There is no CAN example available for STM32F103C8 with the STM32CubeF1 firmware package, but you canget inspired or re-use the sections available in the application within the Eval board:

STM32Cube_FW_F1_V1.6.1\Projects\STM3210E_EVAL\Examples\CAN\CAN_Networking

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
T J
Lead
Posted on May 25, 2018 at 11:40

your circuit is odd but looks ok.

if you are not using a transceiver chip, then the Rx pins need a pull up, good work there.

ABOM should be enabled,

I think, Filter high should have some bits set, or you wont receive any frames

Filter number 14, I think is not correct.

It is always going to be faster to use an external USB CanDo or similar to check your receiver is working before you attempt to transmit.

Posted on May 25, 2018 at 12:00

Hi Imen

Thanks for your kind reply.

This is helpful

Thanks

Posted on May 25, 2018 at 12:04

Hi T J

Thanks for your kind reply.

I don't have CanDo.

These changes I have to make in both transmitter and receiver code. Right?

sFilterConfig.FilterMaskIdHigh=0 should have some value. Right? and what can be the correct value?

what can be the correct filter number?

Regards

Sumit

Posted on May 25, 2018 at 13:46

Hi T J

One thing more the Filter number I have chosen is 0 and the bank number I have chosen is 14.

sFilterConfig.FilterNumber=0;

sFilterConfig.BankNumber=14;

I am little confused that whether you talking about Filter number or Bank number.

Please clear me for that also.

Thanks

T J
Lead
Posted on May 25, 2018 at 22:18

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6mZ&d=%2Fa%2F0X0000000bvM%2Fh94V6Dc5slIeadqOOIqoeKPtiJ9qco_ZBsaEzxNVkX8&asPdf=false
Posted on May 28, 2018 at 09:44

Hi T J

Sorry to disturb you again

 canRxpointerIN = 0;

canRxMsgIN = 0;

canRxMsgOUT = 0;

canRxMsgTableEMPTY = true;

canRxMsgTableFULL = false; 

canTxMsgIN = 0;

canTxMsgOUT = 0;

canTxMsgTableEMPTY = true;

canTxMsgTableFULL = false;

canTxMsgTableOverflow = false;

canTxMsgOverrun = false;

blockCanTx = false;

All these variable are giving error.

Do I have to declare these variables or is there any header file which I have to include in my code to remove those errors?

Thanks

Posted on May 28, 2018 at 11:19

I am sure most of them are here :

//// CAN ///////////////

uint8_t canRxpointerIN;

char canRxMsgIN, canRxMsgOUT, canRxMsgTableEMPTY, canRxMsgTableFULL;

char canTxMsgIN, canTxMsgOUT;

char canTxMsgTableEMPTY, canTxMsgTableFULL, canTxMsgTableOverflow;

char canTxMsgOverrun, blockCanTx;

char schedule_SendCanTxString;

char canRxMsgTableOverflow;

int     canRxStringLength, canRxStringCounter, canRxStringSegmentNumber;

char expectingCanSegments;

char canRxhasStringComing, expectingCanString, haveCanSegments;

char canRxStringSegmentID, canRxStringCompleted, RxCanIO_update;

char haveCanString, showRxCanFrames, showRxCanSlaveADCs, showRxCanStrings, showLocalADCs;

char IOUnitNumber;

char ThisUnitIsUpdated;

char TerminalisConnected, CheckTerminalConnection;

sorry for the other stuff, I have a lot going on in parallel state machines.