Skip to main content
sumit grover
Associate
May 25, 2018
Question

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

  • May 25, 2018
  • 3 replies
  • 2099 views
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.
    This topic has been closed for replies.

    3 replies

    Technical Moderator
    May 25, 2018
    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

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    sumit grover
    Associate
    May 25, 2018
    Posted on May 25, 2018 at 12:00

    Hi Imen

    Thanks for your kind reply.

    This is helpful

    Thanks

    T J
    Senior III
    May 25, 2018
    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.

    sumit grover
    Associate
    May 25, 2018
    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

    T J
    Senior III
    May 25, 2018
    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
    sumit grover
    Associate
    May 28, 2018
    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

    T J
    Senior III
    May 28, 2018
    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.