NETMF / netmf-interpreter

.NET Micro Framework Interpreter
http://netmf.github.io/netmf-interpreter/
Other
487 stars 224 forks source link

STM32F411 is not supported #11

Closed Savvkin closed 9 years ago

Savvkin commented 9 years ago

platform_selector.h doesn't allow to configure STM32F411 to run at stock 100 MHz frequency (Unable to set 100000000 value to SYSTEM_CLOCK_HZ and SYSTEM_CYCLE_CLOCK_HZ), so it's not possible to run STM32F411 at full speed.

Here is the original C++ configuration from the STM32F411 SDK sample:

SYSCLK(Hz)        = 100000000
HCLK(Hz)          = 100000000
AHB Prescaler     = 1
APB1 Prescaler    = 2
APB2 Prescaler    = 1
HSI Frequency(Hz) = 16000000
PLL_M             = 16
PLL_N             = 400
PLL_P             = 4
PLL_Q             = 7
smaillet-ms commented 9 years ago

Can you be more specific on what the issue is here? Platform_selector.h is (as the name implies) platform specific, so you can set whatever values you need or want.

Savvkin commented 9 years ago

If you try to set SYSTEM_CLOCK_HZ to 100000000 you will get compilation error in STM32F4_bootstrap.cpp at Line:68, because the code that calculates PLL values doesn't expect 100MHz frequency.

smaillet-ms commented 9 years ago

Excellent, thanks for the quick response. That's pretty clear and actionable. If you've got a fix, please fill out a [Contribution License Agreement (CLA)](Contribution License Agreement) if you haven't already and post a pull request.

josesimoes commented 9 years ago

Setting sys clock @ 100MHz won't work if you need to use the UART and USB. With that frequency isn't possible to get proper PPL values in order to achieve the standard baud rates and standard USB clock and bus timings. For everything else I would say that it should work at any sys clock. My point is that I don't think this is a bug, you simply can't have it running @100MHz.

Savvkin commented 9 years ago

I've tested the settings above by creating uVision app and deploying it to Nucleo-F411RE board and can confirm that UART works. I can't say anything about USB, because board doesn't have it so I don't need it. I thinks it's a bug, there should be more flexisble way to set Clock and PLL values, than it currently exists in netmf. For example, override automatic configuration and allow manually set Clock/PLL values. Not every application requires USB. Why should we trade speed for USB that not even wired? Even if USB exists, we can boot underclocked with USB enabled only when we need it.

piwi1263 commented 9 years ago

Hi savvkin,

I just got netmf 4.3 running on a Nucleo-F411RE by not using the regular USB but via the Morpho connectors, using PA11, PA12 connected to a USB cables D+, D- and used the VBUS as well all without using the ST-Link USB Connector. Works OK for me. One can even cutoff the ST-Link part of the PCB but need to solder a crystal X3 marked on the PCB.

Look here for more details -> https://www.ghielectronics.com/community/forum/topic?id=18762&page=2#msg188043

Hope this helps.

Kind regards,

Peter

2015-04-22 9:42 GMT+02:00 Savvkin notifications@github.com:

I've tested the settings above by creating uVision app and deploying it to Nucleo-F411RE board and can confirm that UART works. I can't say anything about USB, because board doesn't have it so I don't need it. I thinks it's a bug, there should be more flexisble way to set Clock and PLL values, than it currently exists in netmf. For example, override automatic configuration and allow manually set Clock/PLL values. Not every application requires USB. Why should we trade speed for USB that not even wired? Even if USB exists, we can boot underclocked with USB enabled only when we need it.

— Reply to this email directly or view it on GitHub https://github.com/NETMF/netmf-interpreter/issues/11#issuecomment-95063625 .

Savvkin commented 9 years ago

Peter, the bug report is about running STM32F411 at stock clock frequency, which is 100 MHz. Did you run it at 100 MHz?

piwi1263 commented 9 years ago

I never changed anything about the clock, so I recon it is running at the frequency the product is default setup for. At the moment one runs with the ST-Link PCB attached and taking the clock from that part of the PCB.

Savvkin commented 9 years ago

What is in your platform_selector.h file? I bet it's

#define SYSTEM_CLOCK_HZ                 72000000  // 72MHz
josesimoes commented 9 years ago

@Savvkin: I can't find a valid clock configuration to run SYS clock @ 100MHz... The closest I can get is 96MHz. Like Peter I'm running 4.3.1 in a Nucleo 411 board. I do have an 8MHz crystal fitted and I have USB connection and UART.

Please understand that I'm just commenting about the SYS clock values. No complaints about your suggestion to have more flexible clock configurations.

piwi1263 commented 9 years ago

@savvkin: Forget about my comments, I was only reacting on your entry stating no USB was avail on the board.

I've only got pre-build binaries (for 4.3 and NOT 4.4) without the sources, but the frequency has been set to 96 MHz with an 8 MHz crystal. For me that's close enough to 100 MHz.

smaillet-ms commented 9 years ago

Am I correct in understanding this is a resolved issue? (e.g. 96Mhz works in hardware and close enough to the desired frequency that no additional work is required) If so, please close the issue so it isn't considered for further action by anyone.

luca-saggese commented 9 years ago

Hello josesimoes, could you share your F411 Solution folder? i was able to compile it with 96MHz clock, but i'm missing something as the compiled thinibooter does not work.

thanks Luca

josesimoes commented 9 years ago

Hi,

Sure. I'm out right now and will be back to the office next week. I'll send you that then.

Cheers,


De: luca-saggesemailto:notifications@github.com Enviado: ‎27/‎07/‎2015 18:48 Para: NETMF/netmf-interpretermailto:netmf-interpreter@noreply.github.com Cc: José Simõesmailto:jose.simoes@eclo.pt Assunto: Re: [netmf-interpreter] STM32F411 is not supported (#11)

Hello josesimoes, could you share your F411 Solution folder? i was able to compile it with 96MHz clock, but i'm missing something as the complete thinibooter does not work.

thanks Luca

— Reply to this email directly or view it on GitHubhttps://github.com/NETMF/netmf-interpreter/issues/11#issuecomment-125284993.

luca-saggese commented 9 years ago

thanks you! will wait anxiously :)

josesimoes commented 9 years ago

Hi Luca,

Can't send an attachment trough GitHub messaging... Please email me your address at jose DOT simoes AT eclo DOT pt.