dmitrystu / libusb_stm32

Lightweight USB device Stack for STM32 microcontrollers
Apache License 2.0
713 stars 163 forks source link

Remove PMA size warning #54

Closed dzarda closed 4 years ago

dzarda commented 4 years ago

What's the reason of having the PMA size configurable? Isn't it fixed for a concrete part number?

dmitrystu commented 4 years ago

It was defined in the include headers for some devices. So, this message is just for information and can be removed or moved to #pragma message

dmitrystu commented 4 years ago

Also, PMA memory is shared between CAN and USB for some devices. In this case, USB_PMASIZE must be defined manually to avoid data overlapping with CAN.

dzarda commented 4 years ago

to avoid data overlapping with CAN.

So you're saying that both CAN be used together? (pun intended)

dmitrystu commented 4 years ago

I'm not sure about this, but according to section 32.3 of the RM0316 (STM32F303) it looks possible for the F303D/E

  1. When the CAN peripheral clock is enabled in the RCC_APB1ENR register, only the first 768 Bytes are available to USB while the last 256 Bytes are used by CAN.
dmitrystu commented 4 years ago

Checked datasheet. Yes, it's possible to use both CAN and USB at the same time. At least for F303xE

PA11, PA12 - USB
PB8, PB9 - CAN
dzarda commented 4 years ago

Interesting, F10xxx says

Note: In low, medium-, high- and XL-density devices the USB and CAN share a dedicated 512- byte SRAM memory for data transmission and reception, and so they cannot be used concurrently (the shared SRAM is accessed through CAN and USB exclusively). The USB and CAN can be used in the same application but not at the same time.

dmitrystu commented 4 years ago

Yeah. Sometimes devices from ST make me crazy. What does it mean not at the same time for the single-core CPU? OK, It doesn't matter. Will use #pragma message instead of #warning. It has no side effect with -Werror option

dzarda commented 4 years ago

Cool, closing