Closed EG-Julien closed 9 months ago
Adding: -D HSE_VALUE=32000000 to build flags solve the problems.
Final main.cpp:
static void vTask( void * pvParameters )
{
vTaskDelay(1);
while (true)
{
SerialUSB.println(millis());
SerialUSB.println(HAL_RCC_GetHCLKFreq());
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void setup()
{
SerialUSB.begin(115200);
while (!SerialUSB);
delay(1000);
xTaskCreate(vTask, "task1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
vTaskStartScheduler();
}
void loop()
{
;
}
Final platformio.ini:
[env:genericSTM32F303CC]
platform = ststm32
board = genericSTM32F303CC
framework = arduino
lib_deps = stm32duino/STM32duino FreeRTOS@^10.3.2
board_build.f_cpu = 72000000
build_flags =
-fexceptions
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
; -D USBD_USE_CDC
-D HAL_PCD_MODULE_ENABLED
-D HSE_VALUE=32000000
upload_protocol = stlink
Hello everyone, I'm using an STM32F303CCT6 to control a TMC5160, a W5500 and some other stuffs. I'm using the STM32Duino FreeRTOS lib with the Arduino frameworks (In Platform IO, I'm not sure if it's a bug from PIO nor the lib ...). Everything is working fine except the clock system ... The max CPU frequency achievable is 72 MHz. I have a 32 MHz HSE on my board (homemade), I have generated my
SystemClockConfig
function with STM32CubeMX.If I check HSE_IN with an oscilloscope I have my 32MHz, as soon as I remove the code above, my crystal stops running as expected. I would say that my clock hardware is fine.
Now, I have just created a dummy sketch to test things:
This is the first time I'm playing with CPU clocks frequencies. I'm pretty sure I missed something in the documentation.
I tried:
board_build.f_cpu = 72000000
in the platformio.ini but I read that it's reserved for esp, isn't it ? And it doesn't work anyway, The task is still running 10 times a second;system_stm32f3xx.h
to writeSystemCoreClock = 72000000;
configCPU_CLOCK_HZ
in mySTM32FreeRTOSConfig_extra.h
;configTICK_RATE_HZ
in mySTM32FreeRTOSConfig_extra.h
;Nothing worked for now. If anyone has any idea, or documentation that I might have missed ... Thanks for your help !
I've posted this on PIO forum too