2016-12-12 02:50 AM
I am new in CAN bus protocol and wanted to use two CAN channels in the STM32F as I have to receive/transmit data from/to the two different CAN bus. As per study I found that there is no master slave concept in CAN protocol but when I look at cubemx, it is configuring CAN1 as a Master and CAN2 as a Slave. In STM32F7, there are two Master CAN and one slave. What does it mean? Is it possible to transmit data using slave (CAN2)?
Please guide.
#can #stm322016-12-12 04:00 AM
I have used the bxCAN on a device which had both CAN1 and CAN2. The MCU was STM32F429. The master/slave concept is in the bxCAN peripheral, not CubeMX. I'm not familiar enough with the details of the hardware or the reference manual to really understand the master/slave concept. It was irrelevant to my application or, at least, didn't have any significant impact.
In my case, the buses were completely independent except that the 'slave' would not work unless the 'master' was also initialised and enabled.
2016-12-12 04:57 AM
In the F4 CAN1 is a full implementation of hardware and CAN2 is a half implementation, so CAN1 must be functional to use CAN2. Both would communicate on different buses.
2016-12-12 04:59 AM
If you have two different CAN buses, you can wire them into one and receive the whole communication on one channel if possible/allowed by your design etc. You don't need to have two channels for this (if there are no other constraints).
Regarding the Master/Slave architecture on ST, if you read the reference manual, the CAN1 is called Master, because CAN2 has no direct access to the SRAM memory. Why SRAM? The CAN is implemented that way, that all the filter registers etc. reside in SRAM instead of Flash... That's why they call it Master and Slave. So if using only one CAN, from logical point of view you should start with CAN1.
Hope this helps! Have a nice day,
Renegade
2016-12-15 01:28 AM
Thanks for sharing your views and experience.
That means I can use both CAN independently and will be able to transmit and receive data from any CAN channel, right?
Only thing is, I have to configure CAN1 to use CAN2.
Also I would like to know if someone noticed any difference in CAN module in STM32F105 and STm32F4/7 series MCU.
Secondly, noticed that device contains extended CAN, Is it possible to configure as a standard CAN? I think it should be possible but unable to find any clear indication in reference manual.
Thanks Again.
2016-12-15 11:15 PM
I don't think there are differences in bxCAN. I've used it in F0, F1 and F4, did not notice major differences. Apart that some chips can't run USB and CAN together due to the same sram block being used as buffer.
I've never used 2.0B, but it seems like bxCAN supports both, simultaneously. Simply by always being in standard mode.
This would explain why you have to left shift the filters if you have a standard ID.
Maybe someone can verify?
2016-12-16 01:59 AM
Hi
Khetani.Krunal.002
,1. CAN1 and CAN2 dependency:
You have to enable also CAN1 clock to work with CAN2.
As mentioned in reference manual RM0090, “Dual CAN�? part ( page 1069) :
'- CAN1: Master bxCAN for managing the communication between a Slave
bxCAN and the 512-byte SRAM memory. -CAN2: Slave bxCAN, with no direct access to the SRAM memory.'->Hence when using CAN2 it's obligatory to enable the Clock of CAN1 accordingly.
2. STM32 product/peripheral compatibility:
To check the compatibility between STM32 devices and their peripheral, an in particular case the compatibility about CAN peripheral between STM32F1 and STM32F4, you would refer to following resource:
Application note
->Table 4. STM32 peripheral compatibility analysis F1 versus F4 series
IF the response is useful, you would press the correct button
-Walid F-
2018-05-21 04:41 AM
I'm developing an application with STM32f446 and I need one CAN bus with which I I want to use CAN bootloader in system memory (preprogrammed bootloader via CAN). In STM32F446 the CAN bootloader is implemented in CAN2 that is slave and therefore I have to use only CAN2.
In this case it's necessary to activate also CAN1?2018-05-21 07:27 AM
As has been long established the CAN2 is a slave to CAN1, basically you have 1.5 CAN Peripherals that share a lot of logic.
You should enable both CAN1 and CAN2, and use the upper filters.