I'd assume that your board is the V2 board?
as given in this schematic?
https://github.com/FYSETC/FYSETC-S6/blo ... SCH%20.pdf
If you are not familiar with other tools. You'd need
STM32Cube programmer
https://github.com/stm32duino/wiki/wiki ... programmer
The procedure to programe using DFU (i.e. usb direct) is:
set BOOT0 jumper, press reset.
then run STM32Cube programmer to upload your firmware
(i think this is integrated in the menu, check in the Menus)
Otherwise, you can from the Arduino IDE, do a Sketch > Export compiled binary (something of that sort).
You need that *.bin file.
Then you can use STM32Cube programmer to program it manually.
--
For your sketch, the important thing is to choose the correct MCU variant.
Preferably with exact matching MCU.
Then you need to review the variant include files in your locally installed folders.
the important thing is the external crystal speed that is specified in the variant file. i.e. the HSE crystral frequency
https://github.com/stm32duino/Arduino_C ... 6.cpp#L160
Code: Select all
RCC_OscInitStruct.PLL.PLLM = 6;
RCC_OscInitStruct.PLL.PLLN = 180;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
RCC_OscInitStruct.PLL.PLLR = 2;
look inside the ref manual for your chip e.g.
https://www.st.com/resource/en/referenc ... ronics.pdf
look in the 'reset and clock control' section, look at the clock tree.
e.g. system clock = HSE freq * N / M / P
so say the HSE clock is 12 mhz, 12 * 180 / 6 / 2 = 180 Mhz
note the PLLQ divisor won't work for USB - it needs to be 48 Mhz
HSE * N / M / Q = 12 * 180 / 6 / 7 = 51.43 Mhz - usb won't run on this
need to match that on your board
https://github.com/FYSETC/FYSETC-S6/blo ... SCH%20.pdf
so on your board that HSE crystal needs to be 12 mhz
if it isn't, you would need to find new values for M, N, P, Q, those PLL dividers. You can try playing with this python script
viewtopic.php?f=41&t=78