-
Notifications
You must be signed in to change notification settings - Fork 1k
Add custom devboard - Databoard #2806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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>
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 |
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; |
There was a problem hiding this comment.
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.
* | ||
****************************************************************************** | ||
*/ | ||
/* |
There was a problem hiding this comment.
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) | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| :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 | ||
}; | ||
|
There was a problem hiding this comment.
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:
Arduino_Core_STM32/variants/STM32F1xx/F103C8T_F103CB(T-U)/variant_MAPLEMINI_F103CB.cpp
Lines 72 to 135 in 2095f53
// ---------------------------------------------------------------------------- | |
#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 |
#if defined(ARDUINO_GENERIC_F103C8TX) || defined(ARDUINO_GENERIC_F103CBTX) ||\ | ||
defined(ARDUINO_GENERIC_F103CBUX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(ARDUINO_GENERIC_F103C8TX) || defined(ARDUINO_GENERIC_F103CBTX) ||\ | |
defined(ARDUINO_GENERIC_F103CBUX) | |
#if defined(ARDUINO_DATABOARD) |
17 // A9, PB1 | ||
}; | ||
|
||
#endif /* ARDUINO_GENERIC_* */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#endif /* ARDUINO_GENERIC_* */ | |
#endif /* ARDUINO_DATABOARD */ |
#ifndef PIN_SERIAL_TX | ||
#define PIN_SERIAL_TX PA2 | ||
#endif | ||
|
There was a problem hiding this comment.
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:
#define HSE_VALUE 16000000U /*!< Value of the External oscillator in Hz */ | |
You can create alias in the variant_DATABOARD.h like this:
#define IO1 PA10
#define AIO10 PA5
Before it gets merged? |
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
Code formatting
Closing issues
Fixes #xxx