Skip to content

Conversation

its-kronos
Copy link

Summary

This PR fixes/implements the following bugs/features

Explain the motivation for making this change. What existing problem does the pull request solve?

Since it's a custom board, it has slightly different configuration compared to the generic (16 MHZ crystal instead of 8 MHZ), which means the exported binary from arduino with generic board doesn't work to establish serial communication

Validation

  • Ensure CI build is passed.
  • Demonstrate the code is solid. [e.g. Provide a sketch]

Code formatting

  • Ensure AStyle check is passed thanks CI

Closing issues

Fixes #xxx

Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
Signed-off-by: its-kronos <140297693+its-kronos@users.noreply.github.com>
@its-kronos
Copy link
Author

If there is a way to have custom pin namings, please let me know, the guide for adding a board isn't really clear on this

@its-kronos
Copy link
Author

also, is there a way I can test the code generated by stm32cubemx before the board gets into the offical

@@ -29,63 +28,43 @@ WEAK void SystemClock_Config(void)
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not have to change this clock.
It is for the generic variant and have to use the internal oscillator.
Please revert back the changes on that file.

*
******************************************************************************
*/
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here no specific change. Only formatting an comments. Please revert back.

@@ -303,6 +303,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
| :green_heart: | STM32F101ZC<br>STM32F101ZD<br>STM32F101ZE | Generic Board | *2.4.0* | |
| :green_heart: | STM32F103C6<br>STM32F103C8<br>STM32F103CB | [Blue Pill](https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill) | *1.2.0* | USB CDC support since *1.5.0*<br> Maple bootloaders support since *1.6.0* |
| :green_heart: | STM32F103C8<br>STM32F103CB | [Black Pill](https://stm32-base.org/boards/STM32F103C8T6-Black-Pill) | *1.5.0* | |
| :yellow_heart: | STM32F103C8 | [Databoard](https://github.com/its-kronos/Databoard) | | |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| :yellow_heart: | STM32F103C8 | [Databoard](https://github.com/its-kronos/Databoard) | | |
| :yellow_heart: | STM32F103C8 | [Databoard](https://github.com/its-kronos/Databoard) | **2.12.0** | |

16, // A8, PB0
17 // A9, PB1
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add here your your dedicated clock config:

// ----------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief System Clock Configuration
* The system Clock is configured as follow :
* System Clock source = PLL (HSE)
* SYSCLK(Hz) = 72000000
* HCLK(Hz) = 72000000
* AHB Prescaler = 1
* APB1 Prescaler = 2
* APB2 Prescaler = 1
* PLL_Source = HSE
* PLL_Mul = 9
* Flash Latency(WS) = 2
* ADC Prescaler = 6
* USB Prescaler = 1.5
* @param None
* @retval None
*/
WEAK void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
/* Initializes the CPU, AHB and APB busses clocks */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/* Initializes the CPU, AHB and APB busses clocks */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC | RCC_PERIPHCLK_USB;
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}
}
#ifdef __cplusplus
}
#endif

Comment on lines +13 to +14
#if defined(ARDUINO_GENERIC_F103C8TX) || defined(ARDUINO_GENERIC_F103CBTX) ||\
defined(ARDUINO_GENERIC_F103CBUX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(ARDUINO_GENERIC_F103C8TX) || defined(ARDUINO_GENERIC_F103CBTX) ||\
defined(ARDUINO_GENERIC_F103CBUX)
#if defined(ARDUINO_DATABOARD)

17 // A9, PB1
};

#endif /* ARDUINO_GENERIC_* */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif /* ARDUINO_GENERIC_* */
#endif /* ARDUINO_DATABOARD */

@fpistm fpistm added the new variant Add support of new bard label Sep 1, 2025
@fpistm fpistm added this to the 2.11.1/2.12.0 milestone Sep 1, 2025
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX PA2
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you HSE is different from the default one you can add it here:

Suggested change
#define HSE_VALUE 16000000U /*!< Value of the External oscillator in Hz */

@fpistm
Copy link
Member

fpistm commented Sep 1, 2025

If there is a way to have custom pin namings, please let me know, the guide for adding a board isn't really clear on this

You can create alias in the variant_DATABOARD.h like this:

#define My_CUSTOM_NAME PYn

#define IO1              PA10
#define AIO10              PA5

also, is there a way I can test the code generated by stm32cubemx before the board gets into the offical

Before it gets merged?
Well if you used the git repo instead of the package you could test it with Arduino IDE.
https://github.com/stm32duino/Arduino_Core_STM32/wiki/Using-git-repository

@its-kronos its-kronos marked this pull request as draft September 1, 2025 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new variant Add support of new bard
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants