Skip to main content
KYou.1
Associate II
February 20, 2020
Question

Can I use CAN and USB pin only if USB plugged in?

  • February 20, 2020
  • 2 replies
  • 1662 views

Hello,

I am using STM32F103 for my project and it requires CAN most of the time however if a USB connector is plugged in, it should behave like a virtual COM port.

CAN_R and CAN_T pins are connected to PA11 and PA12

together with USB_DP and USB_DM pints.

Below image is the circuit I used to disable CAN transceiver when USB 5V exist.

0690X00000DBywYQAT.png

MCU_USBV comes from the USB 5V and USB_DP is pulled up.

0690X00000DByxMQAT.png

This circuit didn't work for me.

What need to be changed?

This topic has been closed for replies.

2 replies

Amel NASRI
ST Technical Moderator
February 26, 2020

Hi @KYou.1​ ,

You find the answer to your question and the required explanation in this knowledge article: https://community.st.com/s/article/FAQ-Concurrent-use-of-USB-and-CAN-with-STM32F103.

In the article page, please answer the question "Was this article helpful?"

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
waclawek.jan
Super User
February 28, 2020

Hi @Amel NASRI​  ,

as CAN and USB share pins, it does not appear that the problem is in trying to use both modules simultaneously.

I believe the main problem is in how the CAN transceiver is "disabled" - floating its GND pin is not a proper way, as the chip gets parasitically supplied from its other pins through the protection diodes.

A multiplexer or a three-stating gate (e.g. 74HC125) or a transmission-gate (e.g. 74HC4016) should be used to isolate the CAN transceiver's D and R from the USB DP/DM terminals.

JW