cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 MCU to use CAN and USB simultaneously

kavinkumar
Associate III

Hi there 
Is there any stm32 MCU versions that has can run both CAN and USB simultaneously without conflicting with the PB8 boot pin? Also the USB will only be recognized if the PB8 pin is pulled high can i just directly connect it to 3.3v and always keep it on. will that be a problem 

12 REPLIES 12
Karl Yamashita
Principal

STM32F105xx, STM32F072 and many more depending on any other requirements. 

 

You can't keep the boot pin tied high else it'll stay in boot mode.

 

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

In order to enter the USB the PB8 pins needs to be pulled high. But I can't do it externally is there a way I can pull the pin high just so it enters USB bootloader.

Also i need a smaller package size the ones you mentioned are really big

Karl Yamashita
Principal

As far as I can remember, but I could be wrong, 48 pin packages is about the smallest you can go to be able to use both USB and CAN at the same time without any conflicts with shared resources. STM32F042 is another that I use.

The F105 has dual CAN controllers. You didn't give enough info so i threw that out there. 

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

Yeah sorry my bad 48 pin package is good. Thank you @Karl Yamashita . 
I just need to figure one more thing out. How can i enter into USB mode without any external work like pulling the PB8 pin  high using a button. i need it to be just pluggable and i should enter into USB mode . I just need data transmission via USB.

You'll need the software application to send a command to the application FW which will then jump to the built in bootloader. But that's not a good idea as you can brick the device if the FW fails to update, unless you can get to the boot pin.

A better approach is to make a custom bootloader. So even if the application fails to update, you still have the custom bootloader that will still stay in bootloader mode until there is a validate application code in the device.

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

I don't need to program or update the stm32 via USB, just to need send and receive messages . Do i still need to do a custom bootloader ?

You repeatedly fail to indicate which STM32 part/family you're having issues with, or uses PB8

The STM32F103 parts shared a 2KB buffer between USB and CAN, and had an expectation of a resistor on PA11 or PA12 as I recall.

STM32G0C1KC is 32-pin has 2x FDCAN and 1x USB, although lacks OSC_IN / CLK_IN pin

 

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Sorry, for some reason i thought you want to use the boot pin to enter DFU mode, so bootloader was on my mind.

It's not as simple as connecting to a computer and start sending/receiving messages. You have to set the USB for some communication class, Custom HID or CDC.  You need to create some communication protocol to go along with the USB class. 

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

Sorry if i was not clear. I need help in finding a MCU that doesn't share one of it pin with BOOT pin. Which i have found STM32F072 as you said. That works for me.

I had SRM32G4 which shared the PB8 pin as BOOT and CAN RX which was a problem i faced but i now i can replace it with STM32F072.

At last the thing is in order to use USB as VCP i need to pull the BOOT pin high while connecting the USB. How do i do it without any  external work like pulling the BOOT pin high using a button. which i cannot do. is there any other way to just plug the USB into my PC and it appears as VCP