Can the USB and CAN Interfaces on the STM32F103RCT6 Be Used Simultaneously?

The short answer is no — on the STM32F103RCT6, USB and CAN cannot run at the same time. The two peripherals are both present on the die and both appear in the device datasheet, but they share a single dedicated 512-byte SRAM buffer used for packet transmission and reception. That buffer can only be accessed by one peripheral at a time. ST states the restriction explicitly in reference manual RM0008: the USB and CAN can be used in the same application, but never concurrently. In practice this means firmware must shut CAN down before starting USB traffic, and vice versa.

Why the Two Peripherals Conflict

The STM32F103RCT6 is a high-density performance-line device built on an ARM Cortex-M3 core running at up to 72 MHz, with 256 KB of Flash, 48 KB of SRAM, one USB 2.0 full-speed device controller and one bxCAN controller supporting CAN 2.0B active frames. The conflict has nothing to do with CPU speed or bus bandwidth. It is architectural: instead of giving each interface its own packet memory, ST routed USB and CAN through one 512-byte block. A hardware arbiter grants exclusive access, so when CAN owns the block, the USB endpoint buffers are effectively dead. The same sentence in RM0008 covers low-, medium-, high- and XL-density parts, so the limitation applies to the whole F103 family, not only to the RCT6.

Shared Resource USB Usage CAN Usage Conflict?
Dedicated 512-byte SRAM Endpoint packet buffer Message buffer / filter memory Yes — exclusive access
PA11 / PA12 pins USB_DM / USB_DP CAN1_RX / CAN1_TX (default) Yes — but fixable by remap
APB1 clock domain 48 MHz USB clock (from PLL) APB1 bus clock No
Interrupt vectors USB_LP / USB_HP USB_LP_CAN1_RX0 shared vector Yes — shared handler entry

The Pin Conflict and How to Work Around It

There is also a physical-layer collision. USB requires PA11 and PA12, and those are exactly the reset-default pins for CAN1. Routing CAN to PB8 and PB9 through the alternate-function remap register removes the wiring problem, but it does not restore simultaneous operation, because the SRAM restriction is independent of pin assignment. Remapping is useful only when CAN is used alone on a board that also carries a USB connector.

Signal Default Pins Alternate Pins Remap Setting
USB_DM / USB_DP PA11 / PA12 None Not remappable
CAN1_RX / CAN1_TX PA11 / PA12 PB8 / PB9 CAN_REMAP = 10

Symptoms When Both Are Enabled by Mistake

  • USB enumeration failure: the virtual COM port simply never appears, or the device descriptor request fails.
  • CAN data corruption: frames arrive with wrong payloads or trigger error counters.
  • Intermittent lock-up: whichever peripheral wins arbitration starves the other, sometimes ending in a HardFault.

Practical Options for Real Projects

If a product genuinely needs both buses, the workable routes are time-multiplexing, a different MCU, or an external bridge. Time-multiplexing is the cheapest but the weakest: USB has a NAK handshake that lets a host retry, while CAN has no flow-control handshake, so frames can be lost while the peripheral is switched off.

Option How It Works Trade-off
Time-multiplexing Enable CAN, then disable it and enable USB No true concurrency; CAN frames at risk
Switch to STM32F105/107 Connectivity-line parts with separate USB OTG and CAN Different pinout; board redesign
External bridge chip USB-to-UART or USB-to-CAN converter plus MCU Extra BOM cost and space
Remap CAN to PB8/PB9 Clears the pin clash only Does not fix the shared SRAM

Frequently Asked Questions

Q1: Is this limitation specific to the RCT6, or does it affect all STM32F103 parts?
It affects the entire F103 family. The reference manual wording covers low-, medium-, high- and XL-density devices, so an STM32F103C8T6 and an STM32F103ZET6 have exactly the same restriction. Choosing a bigger package or more Flash does not change it.
Q2: What happens if I simply enable both peripherals in firmware?
You will usually see the USB device fail to enumerate while CAN still works, or CAN fail while USB works. Only one peripheral can own the shared SRAM, so the loser of the arbitration behaves as if it were unconfigured. It is a functional failure rather than immediate hardware damage.
Q3: Can I fix it by remapping CAN1 to PB8 and PB9?
No. Remapping only eliminates the electrical clash on PA11 and PA12. The shared 512-byte SRAM is an internal architectural constraint, so the two interfaces still cannot operate at the same instant. Remapping is worthwhile only when the application uses one interface at a time.
Q4: Which STM32 devices do allow USB and CAN at the same time?
The STM32F105 and STM32F107 connectivity-line devices provide independent USB OTG and CAN blocks and can run both concurrently. Parts in the STM32F4 series, such as the STM32F405 and STM32F407, likewise allow simultaneous bxCAN and USB operation.
Q5: Is time-multiplexing reliable enough for a USB-to-CAN adapter design?
Only for slow, non-critical traffic. Because CAN lacks a NAK-style handshake, frames received while the CAN peripheral is switched off are lost with no retry from the sender. For a real USB-to-CAN bridge, use an MCU whose two peripherals are independent, or offload one bus to an external controller.

Conclusion

On the STM32F103RCT6, USB and CAN share one 512-byte SRAM block and therefore cannot be used simultaneously. Both interfaces can exist in the same firmware, but only one may be active at any moment, and the PA11/PA12 pin overlap must also be resolved by remapping CAN to PB8 and PB9. Designs that require genuine concurrent operation should move to the STM32F105/107 connectivity line or an STM32F4 device, or add an external USB-to-CAN bridge chip beside the MCU. For firmware that needs USB only for occasional maintenance alongside CAN, a carefully sequenced time-multiplexing scheme is enough.