Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


USB CDC and CAN not running together on STM32F103 (imported from CubeMX)

I’ve taken a quick look at your configuration and I don’t have any definitive answer for you, just a few observations and suggestions.

My first guess at the problem is that there’s some sort of undesired interaction between the CAN and USB controllers due to the fact that they both share interrupt vector(s).

Observations:
- On this device, USB “low priority” events and CAN receive (FIFO 0) share an interrupt vector. The USB device stack is definitely using this interrupt, if the Cube configuration UI is to be believed.
- I presume you’re using the Cube HAL to configure and operate the CAN bus. I can’t tell from just the Cube .ioc file if the HAL uses interrupts for CAN or not, nor can I tell if it is enabling interrupt sources on the CAN controller.
- The NVIC configuration for this project is setting all enabled interrupt sources to the highest priority (0 = highest priority I think, 15 = lowest).

Suggestions:
- Fix the NVIC priority settings so SysTick is running at the lowest priority (15). USB/CAN priority should be something other than 0 (highest).
- Make sure you’re not accidentally turning on any CAN interrupts. If you (or the HAL) are using CAN interrupts, you’ll need to determine if the HAL code is dealing with the shared interrupt properly - i.e. invoking an appropriate sub-ISR specific to USB or CAN depending on which peripheral generated the interrupt.

I’ve not used the F103 or the (Cube HAL) USB code so I’m afraid I can’t offer any more advice based on direct experience. I have used CAN (on the F091), but wrote my own custom low level drivers for it; I did not use the Cube HAL routines.

Hey, I’m sorry to disappoint you, but in F103 chip you cannot use USB and CAN at the same time. It is not clear from Reference Manual, but that’s the reality. Out of F1 family only F105/107 (Connectivity line) have a different USB peripheral arhitecture (USB OTG) so that allows to use it with CAN bus simultaneously. F3\F4 serial almost all have USB OTG so no problem with that. Out of F0 family only F072 series can have both at the same time, rest are just as limited as F103.

The reason behind this limitation is the following: there’s an internal 512b RAM buffer for storing received and sent data (since both CAN and USB are highly loaded protocols and asynchronous) which can be used either only for USB or only for CAN. CubeMX though still allows to check both peripherals for use at the same time, but in reality you will be able to use only one (only one can be initialized at the time) - the shared RAM is accessed through CAN and USB exclusively.

My suggestion is to use UART instead of USB and then add an external USB-UART converted (either smth like FT232, CH340, CP2102 or you can use another F103 chip) :-)

Screenshot from F10x reference manual, page 622 (USB) see below
Reference Manual