Skip to main content
Mku1
Associate II
March 10, 2020
Question

CAN and USB CDC on stm32f407 discovery

  • March 10, 2020
  • 11 replies
  • 2200 views

Hi is it possible to use in the same time can and USB CDC because i need to receive message from can and then transmit over usb to PC?

This topic has been closed for replies.

11 replies

Mku1
Mku1Author
Associate II
March 10, 2020

I can transmit over USB message using CDC_Transmit and i can send CAN message but dont get interrupt for receiving CAN message. Interrupt occurs that can message is received only when i dont initialize USB_CDC

Mku1
Mku1Author
Associate II
March 11, 2020

anyone?

JoniS
Senior
March 11, 2020

Should be possible, or atleast the reference manual did not tell anything else when i fast looked at it.

​

How did observe that receive can rx interrupt is not called when USB is initialised? Have you looked at the can register values before and after USB init? Have you tried different order of init, ie. If USB is now first, init can first etc.

​

There are quite alot of ​discussion about the USB cdc within these forums with many mcu's, maybe you can find something related from there.

​

I myself have custom board with stm32f446 and have no proplems with USB cdc and can simultaneously, thought i haven't really pushed it more than ~40kb/s rate from can to PC.

Mku1
Mku1Author
Associate II
March 11, 2020

I have debugging and put that in interupt when can rx occurs it should toggle led. When i dont call MX_USB_DEVICE_INIT led has toggled when i send from can device message and during debug session i get data and everything what i have sent from another device over CAN. But when i call MX_USB_DEVICE_INIT led doesnt turn on and in debug session breakpoint doest hit in interrupt. I have configured in CUBE_MX usb_FS as device only and CDC class

Mku1
Mku1Author
Associate II
March 23, 2020

hi are somebody else have maybe some hint ?

Mku1
Mku1Author
Associate II
April 6, 2020

anyone?