STM32 CAN Bus Communication: CubeMX Setup and HAL Code
CAN (Controller Area Network) is a communication protocol that lets many devices exchange data over a single pair of wires. It is used in cars, industrial machines, motor controllers, and robots because it is reliable and keeps working in electrically noisy environments.
The HAL library handles most of the protocol on an STM32, so the work comes down to configuring the CAN peripheral and writing the code that sends and receives messages. This tutorial sets up CAN communication between two STM32 boards that are connected through MCP2551 transceivers. CAN1 is configured at 500 kbps in STM32CubeMX, and a data frame is built and transmitted with HAL functions. After that, a hardware filter is set up, and incoming messages are received through the RX FIFO0 interrupt, so the code does not need to check the bus in a loop. The complete project files are available for download at the end of the post.
STM32 devices come with one of two CAN peripherals. The classic bxCAN is found on older series such as the F and L families, and FDCAN is found on newer series such as the G, H, and U families. This post covers bxCAN, and the FDCAN versions are covered in separate tutorials:
- STM32 FDCAN in Loopback Mode
- STM32 FDCAN Normal Mode: Message RAM, Filters and HAL
- All STM32 CAN bus tutorials
If you want to go beyond raw CAN frames, STM32 CANopen series explains the protocol layer that gives every CAN message a defined meaning.
Table of contents
- STM32 CAN Bus Communication: CubeMX Setup and HAL Code
- How STM32 CAN Bus Works
- STM32 CAN Frame Structure: ID, DLC and Data
- STM32 CAN Bus Wiring with MCP2551
- STM32 CAN Bit Timing and CubeMX Configuration
- STM32 CAN Transmit Example with HAL
- STM32 CAN Filter Configuration in ID Mask Mode
- STM32 CAN Receive with FIFO0 Interrupt
- STM32 CAN Loopback Mode for Testing
- Conclusion
How STM32 CAN Bus Works
On an STM32, the CAN peripheral takes care of the low-level parts of the protocol, which include message framing, arbitration, filtering, and error handling. It supports standard identifiers with 11 bits and extended identifiers with 29 bits. It can run in Normal mode, Loopback mode, and Silent mode, so it is suitable for both development and the final product.
STM32 CAN Peripheral Features
- Standard and extended frames: The peripheral handles both 11-bit and 29-bit identifiers, so it works with a wide range of CAN-based systems.
- Hardware message filtering: Filter banks let the peripheral accept only the messages that the application needs, which reduces the load on the CPU.
- Error detection and retransmission: The hardware detects errors, retransmits a frame automatically when needed, and keeps error counters that allow a faulty node to be isolated from the bus.
- Interrupt and DMA support: Messages can be handled in interrupts or with DMA, which keeps the processing fast.
STM32 CAN Frame Structure: ID, DLC and Data
This tutorial does not cover every detail of the CAN specification. It only explains the fields that matter when you work with CAN on an STM32. The image below shows the layout of a standard CAN data frame, which is the most common format.
A CAN frame is made up of the following fields:
- Identifier (ID): The identifier names the message or the node that sends it, and it also sets the priority of the message on the bus. A standard identifier has 11 bits, and an extended identifier has 29 bits. A lower ID value has a higher priority during arbitration.
- RTR (Remote Transmission Request): This bit sets the frame type. A value of 0 marks a data frame, and a value of 1 marks a remote frame that asks another node to send data. Most STM32 applications only use data frames.
- IDE (Identifier Extension): This bit tells the receiver which identifier length is used. A value of 0 means a standard 11-bit ID, and a value of 1 means an extended 29-bit ID.
- Reserved bits: A standard frame has one reserved bit, called r0, after the IDE bit, and an extended frame has two, called r1 and r0. Classical CAN transmits them as dominant bits, and the controller handles them automatically.
- DLC (Data Length Code): The DLC gives the number of data bytes in the frame. In Classical CAN the valid range is 0 to 8.
- Data field: This field carries the application data. It holds 0 to 8 bytes, and the content is up to the application.
- CRC (Cyclic Redundancy Check): The receivers use the CRC to check that the frame arrived without corruption. The CAN hardware calculates and verifies it, so no code is needed.
- ACK (Acknowledgment): At least one receiver that gets the frame correctly sets the ACK bit. The CAN controller handles this as well.
The code in this tutorial only works with three of these fields, which are the identifier, the DLC, and the data. The CRC, the acknowledgment, the arbitration, and the error handling are done by the CAN hardware and the HAL driver.
STM32 CAN Bus Wiring with MCP2551
The STM32 cannot connect to the CAN bus directly, because the bus uses differential signaling. Each board is therefore connected to its own MCP2551 transceiver, which converts the logic levels of the microcontroller into the CANH and CANL signals. The CANH pins of the two transceivers are connected to each other, and so are the CANL pins.
The bus needs a 120 Ω termination resistor between CANH and CANL at each end, which prevents signal reflections. On a bench setup with two boards, the ends of the bus are the two boards, so each board gets one resistor. A single resistor often works as well over very short wires, but the two-resistor arrangement is the correct one.
STM32 to MCP2551 Connections
Connect each STM32 board to its MCP2551 as shown in the table below.
| STM32 Pin | MCP2551 Pin | Description |
|---|---|---|
| PA12 | TXD | CAN transmit data |
| PA11 | RXD | CAN receive data |
| 5V | VDD | Power supply |
| GND | VSS | Ground |
The MCP2551 needs a supply voltage between 4.7 V and 5.2 V on the VDD pin. Powering it from 3.3 V is the most common wiring mistake. With a 3.3 V supply, the setup can still work in Loopback mode, but it does not communicate in Normal mode.
MCP2551 to CAN Bus Connections
The two transceivers are joined with the following connections:
| MCP2551 Pin | Bus Connection | Description |
|---|---|---|
| CANH | CANH of the other MCP2551 | CAN high line |
| CANL | CANL of the other MCP2551 | CAN low line |
| CANH to CANL | 120 Ω resistor | Bus termination |
STM32 CAN Bit Timing and CubeMX Configuration
The CAN peripheral is configured in STM32CubeMX. The settings cover the operating mode, the bit timing, and the GPIO pins for the receive and transmit lines.
CAN Bit Timing and Time Quanta
The CAN baud rate is not taken directly from the peripheral clock. Each CAN bit is divided into smaller units called time quanta (TQ), and one bit is made up of three segments:
| Sync Segment | Time Segment 1 | Time Segment 2 |
|--------------|----------------|----------------|
| 1 TQ | BS1 | BS2 |The controller uses these segments to sample the bus at the right moment and to compensate for delays on the network. The number of time quanta in one bit and the prescaler together set the baud rate:
CAN Bit Time = 1 TQ + BS1 + BS2
Baud Rate = CAN Clock / (Prescaler × Total Time Quanta)As an example, take a CAN peripheral clock of 54 MHz:
Prescaler = 6
BS1 = 13 TQ
BS2 = 4 TQ
Total TQ = 1 + 13 + 4 = 18
Baud Rate = 54 MHz / (6 × 18) = 500000 bpsEach bit lasts 18 time quanta, and the controller sends 500,000 bits per second. The same BS1 and BS2 values also work with a 36 MHz CAN clock, such as the APB1 clock of an STM32F103 at full speed. In that case the prescaler is 4, because 36 MHz / (4 × 18) is also 500,000 bps.
To find the values for your own clock, divide the CAN clock by the target baud rate, and look for a prescaler that divides the result into a whole number of time quanta between 8 and 25. Then split those time quanta between BS1 and BS2 so that the sampling point lands in the right place.
BS1, BS2 and the Sampling Point
Time Segment 1 gives the signal time to travel along the bus and settle. Time Segment 2 gives the controller time after the sampling point to finish the bit. The receiver samples the bus at the end of BS1, which is the sampling point.
| Sync |----------- BS1 -----------|---- BS2 ----|
1 TQ Sample PointThe sampling point is usually kept between 75% and 87.5% of the bit time. In the example above, it is at (1 + 13) / 18, which is about 78%.
Resynchronization Jump Width (SJW)
Every node has its own oscillator, so the clocks of the nodes differ slightly. The resynchronization jump width (SJW) is the number of time quanta by which the controller may lengthen or shorten a bit to stay synchronized with the other nodes. A larger value allows more correction, but it must stay within the limits of the CAN timing rules. A value of 1 or 2 works for most applications. For a deeper look at the timing calculation, read the ST community article on bxCAN bit time configuration.
CAN1 Settings in CubeMX
This tutorial uses CAN1 with the following settings:
- The baud rate is 500,000 bps, which comes from the prescaler and time segments described above.
- The operating mode is Normal.
- PA11 is set as CAN_RX, and PA12 is set as CAN_TX.
The pull-up resistor of the RX pin must also be enabled. It keeps the pin at a defined logic level when no signal is present, which prevents noise from being read as data.
STM32 CAN Transmit Example with HAL
Sending a message takes two steps. The first step is to fill in the header and the data, and the second step is to pass them to the peripheral with a HAL function.
Prepare the CAN Data Frame
Declare the header, the data array, and the mailbox variable:
CAN_TxHeaderTypeDef TxHeader;
uint8_t TxData[8];
uint32_t TxMailbox;TxHeader holds the header information, such as the identifier, the frame type, and the DLC. TxData holds the bytes that will be sent, and TxMailbox receives the number of the transmit mailbox that carries the message.
Then fill in the header and the data:
TxHeader.IDE = CAN_ID_STD;
TxHeader.StdId = 0x446;
TxHeader.RTR = CAN_RTR_DATA;
TxHeader.DLC = 2;
TxData[0] = 50;
TxData[1] = 0xAA;The values have the following meaning:
CAN_ID_STDselects a standard identifier, which means that the extended format is not used.0x446is the identifier of this transmitter. For a standard ID it can be 11 bits wide at most.CAN_RTR_DATAmarks the frame as a data frame.DLCis the number of data bytes, which is 2 here.TxDataholds the two bytes that are transmitted.
Send the CAN Data Frame
The frame is handed to the peripheral with HAL_CAN_AddTxMessage():
if (HAL_CAN_AddTxMessage(&hcan1, &TxHeader, TxData, &TxMailbox) != HAL_OK)
{
Error_Handler ();
}The function takes four parameters: the CAN handle hcan1, the header TxHeader, the data array TxData, and the variable TxMailbox that receives the mailbox number. The CAN peripheral must also be started with HAL_CAN_Start(&hcan1) before it can send or receive, and this call is shown together with the filter code in the next section.
CAN Transmit Result
The capture above shows the waveform of one transmitted frame, with its fields marked. The capture was taken with the data bytes 0x64 and 0x0A. With the values from the code above, the data field would show 0x32 and 0xAA instead.
- Identifier (0x446): This is the message ID, which also sets the priority of the frame.
- Control field (0x2): This field carries the frame type bits and the data length, which is 2 bytes here.
- Data bytes: These are the two bytes of payload.
- CRC (0x1459): This value allows the receivers to check that the data is intact.
- ACK: The acknowledgment bit at the end of the frame shows whether a receiver accepted the frame.
Every node on the bus sees every frame, but each node only accepts the frames that pass its filter. The next section shows how to set that filter.
STM32 CAN Filter Configuration in ID Mask Mode
The CAN peripheral contains hardware filters that decide which frames are accepted and which are ignored. Filtering in hardware keeps unwanted messages away from the software and reduces the load on the CPU.
The two boards in this tutorial use the identifiers as shown in the table below, and each board filters for the identifier of the other one.
| Board | Transmits with ID | Filter accepts ID |
|---|---|---|
| Board A (STM32F446) | 0x446 | 0x103 |
| Board B (STM32F103) | 0x103 | 0x446 |
The code below is the filter and start sequence of board B, which accepts the ID 0x446. On board A, the ID in FilterIdHigh is 0x103 instead.
CAN_FilterTypeDef canfilterconfig;
canfilterconfig.FilterActivation = CAN_FILTER_ENABLE;
canfilterconfig.FilterBank = 18; // which filter bank to use from the assigned ones
canfilterconfig.FilterFIFOAssignment = CAN_FILTER_FIFO0;
canfilterconfig.FilterIdHigh = 0x446<<5;
canfilterconfig.FilterIdLow = 0;
canfilterconfig.FilterMaskIdHigh = 0x7FF<<5; // Mask All ID Bits, so only 1 ID is allowed
canfilterconfig.FilterMaskIdLow = 0x0000;
canfilterconfig.FilterMode = CAN_FILTERMODE_IDMASK;
canfilterconfig.FilterScale = CAN_FILTERSCALE_32BIT;
canfilterconfig.SlaveStartFilterBank = 20; // how many filters to assign to the CAN1 (master can)
HAL_CAN_ConfigFilter(&hcan1, &canfilterconfig);
HAL_CAN_Start(&hcan1); // the peripheral does not send or receive until it is startedThe filter parameters work as follows:
- FilterActivation: The filter must be enabled with this parameter. Without it, no filtering takes place.
- Filter banks: On devices with two CAN peripherals, the 28 filter banks are shared between CAN1 and CAN2, and
SlaveStartFilterBanksets the first bank that belongs to CAN2. With a value of 20, banks 0 to 19 belong to CAN1, andFilterBankthen picks one of them, such as bank 18. On devices with a single CAN peripheral, only banks 0 to 13 are available. - FilterFIFOAssignment: This parameter selects the FIFO, either FIFO0 or FIFO1, that stores the accepted messages.
- FilterMode: In Mask mode the filter compares selected bits of the identifier, and in List mode it compares the complete identifier. Mask mode is the more practical one in most projects.
- FilterScale: This parameter selects one 32-bit filter or two 16-bit filters per bank.
- FilterIdHigh: This value holds the identifier to match. A standard ID starts at bit 5 of this register, so the ID is shifted left by 5.
- FilterMaskIdHigh: The bits that are set in the mask are compared with the incoming identifier, and the bits that are clear are ignored.
Why the Mask Value Is 0x7FF Shifted by 5
The mask decides which bits of the identifier take part in the comparison. A standard identifier has 11 bits, and 0x7FF has all 11 of them set:
0x7FF = 111 1111 1111With 0x7FF << 5 as the mask, the filter compares all 11 bits of the incoming ID with 0x446, so only that single ID is accepted. A mask of 0x446 << 5 does not mean the same thing. In that case, only the bit positions that are 1 in 0x446 are compared, and all other bits are ignored, so many other IDs pass the filter as well. The video for this tutorial uses 0x446 << 5 as the mask, and the correct value is 0x7FF << 5, as shown in the code above.
STM32 CAN Receive with FIFO0 Interrupt
An interrupt lets the STM32 pick up a message as soon as it passes the filter, so the code does not have to check the bus in a loop. The first step is to enable the CAN1 RX0 interrupt in CubeMX.
Enable the CAN1 RX0 Interrupt in CubeMX
With this interrupt enabled, the interrupt service routine runs each time a message passes the filter and arrives in RX FIFO0.
Activate the Notification and Handle the Callback
In main(), activate the notification for pending messages in FIFO0:
if (HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)
{
Error_Handler();
}The CAN_IT_RX_FIFO0_MSG_PENDING interrupt fires whenever a message is waiting in FIFO0. Each time it fires, HAL calls HAL_CAN_RxFifo0MsgPendingCallback(). The callback reads the header and the data of the message and checks the identifier:
CAN_RxHeaderTypeDef RxHeader;
uint8_t RxData[8];
volatile uint8_t datacheck = 0;
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
{
if (HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader, RxData) != HAL_OK)
{
Error_Handler();
}
if ((RxHeader.StdId == 0x103))
{
datacheck = 1;
}
}The function HAL_CAN_GetRxMessage() reads the message from RX FIFO0 and stores the header in RxHeader and the data in RxData. The callback then compares the identifier with 0x103, which is the ID of board B, and sets the datacheck flag when it matches. The flag is declared as volatile because it is changed in the interrupt and read in the main loop. The same RxHeader.StdId value also tells you which node sent a message when several nodes share the bus.
In the main loop, the flag can trigger an action. The example below turns on an LED:
if (datacheck)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
}The LED lights up only after a valid message with the ID 0x103 has arrived.
STM32 CAN Loopback Mode for Testing
In Loopback mode, the CAN peripheral receives the frames that it sends itself, without needing a second node on the bus. Select Loopback as the operating mode in CubeMX to use it. The mode is useful for checking the bit timing, the filter, and the interrupt code before the hardware is wired. The filter must accept the ID of the transmitting node, because the node receives its own frames. If the code works in Loopback mode and fails in Normal mode, the cause is usually the wiring, such as a transceiver that runs from 3.3 V instead of 5 V, or a missing termination resistor.
The video below shows how to set up Loopback mode and the message filter.
Conclusion
This tutorial took CAN communication on an STM32 from the wiring to a working receiver. Each board connects to the bus through an MCP2551 transceiver that runs from 5 V, and the 120 Ω termination resistors keep the signal clean. In CubeMX, CAN1 is set to 500 kbps by choosing a prescaler and time segments that give a sampling point of about 78%, and the RX pin gets a pull-up.
In the code, a message is built from an identifier, a DLC, and up to 8 data bytes, and it is sent with HAL_CAN_AddTxMessage(). The receiving board uses a hardware filter in ID Mask mode with the mask 0x7FF << 5, so only the one identifier that it needs reaches the CPU. The peripheral must be started with HAL_CAN_Start(), and the RX FIFO0 interrupt then delivers each accepted message to HAL_CAN_RxFifo0MsgPendingCallback(), where the identifier shows which node sent it.
When a setup works in Loopback mode and fails in Normal mode, the cause is almost always in the hardware, such as a transceiver supplied with 3.3 V, a missing termination resistor, or CANH and CANL that are swapped. Checking these first saves a lot of debugging time.
From here, you can continue in several directions. The FDCAN Normal Mode tutorial and the FDCAN Loopback Mode tutorial cover the newer peripheral with higher data rates and larger payloads, and the STM32 CAN bus tutorials page lists the whole series. To give every message a defined meaning and build a complete network, continue with CANopen with STM32, Part 1. If you also work with other industrial protocols, the STM32 Modbus RTU series is a good comparison, and the STM32 UART tutorials cover the serial side of the same kind of projects.
Download Project Here
Download the CubeMX project files and HAL source code — all tested on real hardware.
If you find this useful, you can support us with a Donation as well.
Browse More STM32 CAN Tutorials
STM32 FDCAN Normal Mode: Message RAM, Filters & HAL
CANopen with STM32 – Part 1: Understanding the CANopen Protocol
CANopen with STM32 Part 2: CAN Configuration and Adding I-CUBE-CANOPEN
CANopen with STM32 Part 3: Understanding the Object Dictionary
CANopen with STM32 Part 4: Understanding the NMT Protocol

Arun is an embedded systems engineer with 10+ years of experience in STM32, ESP32, and AVR microcontrollers. He created ControllersTech to share practical tutorials on embedded software, HAL drivers, RTOS, and hardware design — grounded in real industrial automation experience.
Recommended Tools
Essential dev tools
Categories
Browse by platform








This really is one of the worst tutorials, for the fact that you explained setting baud rate to 500 kbit/s as “You can try different different combinations for Prescaler and Time Quanta to achieve this.”
Not a single explanation about clocks, synchronisation, how or why the time quanta are selected. If you had even provided a link to an external article so that someone new could have understood what these things mean, it would have been better. You really just follow some herd, and do things without proper explanation. And then to pretend that you wrote an explanation on CAN communication for ST chips.
P.S. For anyone else who might eventually want to actually learn go to this website:
https://community.st.com/stm32-mcus-60/can-bxcan-bit-time-configuration-on-stm32-mcus-135466
I am working on the same project you explained here, but my boards are nucleo and discovery. I am a completely beginner in it can you please help me in my project
Why are there two reserved bits (r0, r1) after the ID and before the data length code, if according to the documentation of Bosch there is one reserved bit r0?
Hello,
Thanks for your useful tutorials.
I am going to use Extended CAN of stm32 but I could not find how I can do it. Is it possible you help and tell me which part of the code need to be changed.
Regards,
Mehrdad
What exactly is Extended CAN ?
Olá amigo, qualo modelo das placas, a menor é a BluePill e a outra é que núcleo?
Hi, I am using stm32f407 I tried your code but there is no data is received,i don’t know what I
Missed
Hey man! Big thanks, your code examples are a great help, especially this one. Video tutorials on youtube are great too. (if only not for the robotic voice-over, but I understand how hard it is to make a proper voice-over)
super ra kaasi
Thank you very much for this helpful tutorial.
I also watched the vid on youtube for the can one master multiple slaves.
Do I understand right: I can only tell a controller to which other controllers (IDs) to listen to, but I cannot tell the master to send a message to a certain slave?
So all slaves listen to the master, and the master message passes the filter of all slaves, and I have to pack a “address information” into the data part of the message, which every slave has to check then?
I would be very happy if you could clarify this for me 🙂
Almost..
Except that the master does not manage to pass through the filters of all slaves. The filters decides which master to accept the data from.
forgot to say thanks for the fast reply.
so: thank you!
Thank you very much Sir.
I have to establish CAN bus communication between two stm32f407VET6 boards and it doesn’t work for me, can I directly connect tx to tx and rx to rx? because I understand that the boards have two integrated can, I do not have the MCP2551, I have two MCP2515
You need can transceivers, you can’t directly connect them.
MCP2515 is SPI to CAN, and this tutorial does not cover that.
Hi, I am using STM32F103C8 and I have tried your code and setup. However, your code is working on “loopback mode” and not working in “Normal Mode”. I don’t know why, it won’t transmit and wont receive message. I believe there is other people commented this problem on your youtube (CAN Normal Mode) video but has yet get an answer, also there are many other facing this issue as well (stack forum or st community) both also do not have answer. If anyone reading this and have solution please share it here. Thank you.
Extra Info:
If I configure in loopback mode, I can transmit message from MCU to other CAN analyzer device and to internal Rx (I verified by oscilloscope and CAN analyzer device successfully received.)
Do you using STM32F103C8 2 board right ? I have problem same with you.
I am not using STM32F103C8 blue pill board. Mine is just the microcontroller(STM32F103C8T6) itself. I owned a STM32F303 Nucleo board as well and Have tried controllertech’s code and it is working.
Also list of configurations I have tried on STM32F103:
1) adjusting the sample point to ~80%
2) tried internal clk and external clk
3) FIFO0 & FIFO1
4) different baudrate
5) CAN port remapping
6) CAN Config Filter ID etc
7) check on hardware wiring, connection etc
8) new or spare STM32F103
9) ST’s example code in STM32Cube_FW_F1_V1.X.X
Unfortunately, non of them is working. At this point I think STM32F103C8 CAN peripheral is broken. I wish I have a blue pill, I believe STM32F103 on blue pill will not have this issue.
Also If anyone has solution please share it here Thank you.
Finally I get it to work. The problem is Vcc. I am supplying 3.3V to transceiver which is not enough. The transceiver I am using required Vcc in range of 4.7 – 5.2 V. Lesson learned, read datasheet thoroughly.
Thanks for sharing!
Your comment helped me to realize where the past 6 hours have gone.
I am using MCP2562 and it has 2 power supplies, Vio and Vdd. I thought both are 3.3V, but it turns out that Vdd should be 5V.
Lesson learned – read carefully the documentation before soldering 😉
can i see your program and setting on stm cube??
Hello,
ı want to know, which is id transmitted message to me? How can ı lean?
“HAL_CAN_AddTxMessage” methods accept uint8_t data, can ı transmit array?
In my scenario I have a master and 5 slaves. 5 slaves are sending messages to master. And I want to know, which slave sent the message to the master?
Thank you for this post.
in the received callback, you can check it by using ID = RxHeader.StdID;
the ID will be stored in the ID variable
Нужны stm32 can
Do you have any good sources on what modifications need to be made to use the FDCAN peripheral on the H7 processors? I can see some signals making it back and forth between the two boards but they analyze as Errors and after two exchanges back and forth the CAN State get stuck in BUSY.
All fixed. The CAN was BUSY because I was forgetting to call GetMessage and the buffer I’m guessing was full. Using this tutorial mixed with the example project from HAL on FDCAN worked great. Thanks!
Hello Thanks for the tutorial it was helpful but i have one problem, i can only receive the data in Blue Pill but the data sent by the Bull pill is not received at F4 controller and i am using CAN BUS 2 for the communication i need as all suggested by you. but still no way i could achieve it.
could you please guide me what wrong i am doing.
Thanks
With regards
Lakshminarayana KS
I solved the issue it was wit my filter Bank Selection.
Is their anyway to hold the bus and send more than 8 bytes of Data ???
thanks
nope. CAN will only support 8 bytes at once.
super bro
Hey, This worked well.
Now is it possible to use multiple addresses with a device to transmit data?
That is the slave has multiple addresses for a single device, each address has different data values. Now the master accesses the slave with multiple addresses according to the required data values.
For example:- The master requires the data”time” in the slave, the master uses the particular address(0x102) for the data “time”.If the master requires the data “Brightness” in the slave, the master uses the particular address(0x103) for the data “Brightness”.Likewise….
Can you give me a solution to work out this in STM32F103C8T6?
I use CAN1 for F407VG, it works normal but use CAN2 it does not receive data. I dont know why?
check out the filter configuration properly. There are different filters provided for both the CANs. I have mentioned that in the first video
I don’t use the filter configuration for CAN2, it sends data normally but still does not receive data.
Hello, i don’t know what the value 0x443 in STD ID is for, while on the receiver side we check the value 0x103.
I have made the necessary corrections. Actually I was trying to show multiple IDs, you should watch the video to understand it
Hi Admin,
Thank you so much for your tutorials…!
I am STM32F103 CAN (MCP2561 as CAN transceiver) with 500kbps and CAN BUS ANALYZER to check the CAN msgs.
Here am sending 3 CAN msgs for every 100ms but some times some msgs are missing so that am getting the CAN cycle time as 200ms and I have followed the same procedure as above but some times my CAN msgs are missing.
what I have to do eliminate this error ?
Thanks again