Skip to content
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

make and main.c changes to support STM32F446RE Nucelo board #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEVICE = STM32F407xE
DEVICE = STM32F446RE
FLASH = 0x08000000

USE_ST_CMSIS = true
Expand Down
13 changes: 12 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ static void delay (unsigned int time) {
}

int main (void) {
// Turn on the GPIOC peripheral
// Turn on the GPIOx peripheral
#if defined(STM32F446xx)
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
#else
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN;
#endif

// Put pin 13 in general purpose output mode
// Note: The only difference here is the name of the register in the
// definition, both lines have the same effect.
#if defined(STM32F413xx) || \
defined(STM32F423xx)
GPIOC->MODER |= GPIO_MODER_MODE13_0;
#elif defined(STM32F446xx)
GPIOA->MODER |= GPIO_MODER_MODE5_0;
#else
GPIOC->MODER |= GPIO_MODER_MODER13_0;
#endif
Expand All @@ -25,6 +31,8 @@ int main (void) {
#if defined(STM32F413xx) || \
defined(STM32F423xx)
GPIOC->BSRR = GPIO_BSRR_BR_13;
#elif defined(STM32F446xx)
GPIOA->BSRR = GPIO_BSRR_BR_5;
#else
GPIOC->BSRR = GPIO_BSRR_BR13;
#endif
Expand All @@ -35,6 +43,8 @@ int main (void) {
#if defined(STM32F413xx) || \
defined(STM32F423xx)
GPIOC->BSRR = GPIO_BSRR_BS_13;
#elif defined(STM32F446xx)
GPIOA->BSRR = GPIO_BSRR_BS_5;
#else
GPIOC->BSRR = GPIO_BSRR_BS13;
#endif
Expand All @@ -45,3 +55,4 @@ int main (void) {
// Return 0 to satisfy compiler
return 0;
}