Why can't I enable USB and CAN simultaneously using STM32CubeMX?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-07-31 7:55 AM
I'm using STM32CubeMX v4.3 to generate my STM32F303x custom board pins.
I need both USB and CAN enabled.I can set USB (as FS Device) pins as:- PA11: USB_DM
- PA12: USB_DP
- PD0: CAN_RX
- PD1: CAN_TX
- ''CAN Not Available: CAN IP can be selected if USB IP is not selected''
- ''USB Not Available: USB IP can be selected if CAN IP is not selected''
- Labels:
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-07-31 8:58 AM
Why? Anything I'm missing here?
In the original F1 design CAN and USB shared a common 512 byte SRAM buffer, this is supposedly not the case with the F303 design, but the logic in CubeMX might still be blocking this option.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-07-31 7:24 PM
Hi clive1, thanks for the advise.
To confirm, I filed a bug report .- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-08-08 9:55 AM
Same situation here, can't enable the CAN while USB is enabled.
Can anybody tell me when will be this bug fixed?I am in the middle of a new design based on STM32F303x MCU with Cube...Best regards!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-08-12 2:48 AM
Not sure when the bug will be fixed, no response in the bug report I filed
/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Bug%20Report%20STM32CubeMX%20v4.3%2c%20can%27t%20enable%20USB%20and%20CAN%20at%20the%20same%20time%20for%20STM32F303x&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=16
. Anyway, what I did as a workaround was to manually set USB pins (PA11, PA12) and CAN (PD0, PD1) pins by clicking on them on the Pinout (right frame), before enabling them on the Pinout (left frame). After that I chose to enable USB than CAN inPinout (left frame). Then I added these lines in main.c:// Private variables
+CAN_HandleTypeDef hcan;
// Private function prototypes
+static void MX_CAN_Init(void);
// main()
+ MX_CAN_Init();
// Actual CAN init func
/* CAN init function */
+void MX_CAN_Init(void)
+{
+
+ hcan.Instance = CAN;
+ hcan.Init.Prescaler = 16;
+ hcan.Init.Mode = CAN_MODE_NORMAL;
+ hcan.Init.SJW = CAN_SJW_1TQ;
+ hcan.Init.BS1 = CAN_BS1_1TQ;
+ hcan.Init.BS2 = CAN_BS2_1TQ;
+ hcan.Init.TTCM = DISABLE;
+ hcan.Init.ABOM = DISABLE;
+ hcan.Init.AWUM = DISABLE;
+ hcan.Init.NART = DISABLE;
+ hcan.Init.RFLM = DISABLE;
+ hcan.Init.TXFP = DISABLE;
+ HAL_CAN_Init(&hcan);
+}
> I am in the middle of a new design based on STM32F303x MCU with Cube...
Great, same case as I am. Let's help each other then! :)
