cancel
Showing results for 
Search instead for 
Did you mean: 

CAN on STM32F103 RB - Nucleo 64

Nicolas Cmb
Associate III
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 -
4 REPLIES 4
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
Up vote any posts that you find helpful, it shows what's working..
Imen.D
ST Employee
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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 17, 2017 at 15:56

Hi

Turvey.Clive.002

‌,

thank you for your help

Posted on May 17, 2017 at 15:57

Thank you

DAHMEN.IMEN