Skip to main content
Nicolas Cmb
Associate III
May 17, 2017
Question

CAN on STM32F103 RB - Nucleo 64

  • May 17, 2017
  • 4 replies
  • 1310 views
Posted on May 17, 2017 at 12:00

Hi Community,

I'm a CAN protocol beginner and I'm quite lost about it. Let’s start from the beginning; I’m working on a CAN bus protocol with two STM32F103 RB – Nucleo 64 microcontrollers and two transceivers MCP2551. The objective is to send a message from a microcontroller to the other one (and eventually show on is UART).

I’ve done a little scheme of my installation but I’ve got problems with my program.0690X000006071eQAA.png

I’m quite lost about what I have to do, especially to begin a simple CAN transmission.

When I'm pressing the button the led, which should be flashing, is freeze, so obviously he's waiting for something but what ?How can I just send a message to the other microcontroller ?

And finally, I heard about CAN’s mask and I don't know how they are uses, and for what. I have enclosed a part of my code.

Thank you for your help,

- Nicolas -
    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    May 17, 2017
    Posted on May 17, 2017 at 13:55

    Aren't there HAL examples for CAN under the CubeMX F1 Install?

    On the receive end you configure a filter which allows you to cherry-pick messages on the bus. The filter is configured with a bitwise AND, followed by a comparison.

    You understand binary representation, and the AND operation, right? When you AND something with a bit vector, that acts as a MASK letting though only the bits you have SET in the mask.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Nicolas Cmb
    Associate III
    May 17, 2017
    Posted on May 17, 2017 at 15:56

    Hi

    Turvey.Clive.002

    ‌,

    thank you for your help

    ST Technical Moderator
    May 17, 2017
    Posted on May 17, 2017 at 15:14

    Hi

    Cmb.Nicolas

    ,

    You can inspire from this CAN example shows how to configure the CAN:

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

    Hope this bring you some help.

    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
    Nicolas Cmb
    Associate III
    May 17, 2017
    Posted on May 17, 2017 at 15:57

    Thank you

    DAHMEN.IMEN