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
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.