From d41f5c21d6ad5640ecfab1a5ff6b804aa969d501 Mon Sep 17 00:00:00 2001 From: Matthew Gilpin Date: Sun, 26 Feb 2023 11:30:34 +1000 Subject: [PATCH 1/2] Update main.c OSPEEDR is a 2 bits per pin according to the reference manual - may need to change this in other places as well --- examples/gpio/interrupt/nucleo-f429/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gpio/interrupt/nucleo-f429/main.c b/examples/gpio/interrupt/nucleo-f429/main.c index 85a160b..707e4ab 100644 --- a/examples/gpio/interrupt/nucleo-f429/main.c +++ b/examples/gpio/interrupt/nucleo-f429/main.c @@ -48,7 +48,7 @@ void hardware_init(void) { // Enable GPIO Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode @@ -98,4 +98,4 @@ void EXTI15_10_IRQHandler(void) { pb_callback(13); // Callback for C13 } -} \ No newline at end of file +} From 55de4f83e98ccc9c7870d3f6d4937f925bba8fc1 Mon Sep 17 00:00:00 2001 From: Matthew Gilpin Date: Sun, 26 Feb 2023 12:07:24 +1000 Subject: [PATCH 2/2] Updated other references to correct OSPEEDR --- examples/getting-started/fsm/nucleo-f401/main.c | 2 +- examples/getting-started/fsm/nucleo-f429/main.c | 2 +- examples/getting-started/fsm/nucleo-l476/main.c | 2 +- examples/gpio/interrupt/nucleo-f401/main.c | 2 +- examples/gpio/interrupt/nucleo-f429/main.c | 2 +- examples/gpio/interrupt/nucleo-l476/main.c | 2 +- examples/os/fr_queueset/nucleo-f401/main.c | 2 +- examples/os/fr_queueset/nucleo-f429/main.c | 2 +- examples/os/fr_queueset/nucleo-l476/main.c | 2 +- examples/os/fr_semaphore/nucleo-f401/main.c | 2 +- examples/os/fr_semaphore/nucleo-f429/main.c | 2 +- examples/os/fr_semaphore/nucleo-l476/main.c | 2 +- examples/pwm/static/nucleo-l476/main.c | 2 +- examples/timer/inputcapture/nucleo-f401/main.c | 2 +- examples/timer/inputcapture/nucleo-f429/main.c | 2 +- examples/timer/inputcapture/nucleo-l476/main.c | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/getting-started/fsm/nucleo-f401/main.c b/examples/getting-started/fsm/nucleo-f401/main.c index 1b5955e..c9ae6cf 100644 --- a/examples/getting-started/fsm/nucleo-f401/main.c +++ b/examples/getting-started/fsm/nucleo-f401/main.c @@ -155,7 +155,7 @@ void hardware_init(void) { __GPIOC_CLK_ENABLE(); //Enable pushbutton input - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/getting-started/fsm/nucleo-f429/main.c b/examples/getting-started/fsm/nucleo-f429/main.c index 84b9356..ab94d45 100644 --- a/examples/getting-started/fsm/nucleo-f429/main.c +++ b/examples/getting-started/fsm/nucleo-f429/main.c @@ -155,7 +155,7 @@ void hardware_init(void) { __GPIOC_CLK_ENABLE(); //Enable pushbutton input - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/getting-started/fsm/nucleo-l476/main.c b/examples/getting-started/fsm/nucleo-l476/main.c index 1b5955e..c9ae6cf 100644 --- a/examples/getting-started/fsm/nucleo-l476/main.c +++ b/examples/getting-started/fsm/nucleo-l476/main.c @@ -155,7 +155,7 @@ void hardware_init(void) { __GPIOC_CLK_ENABLE(); //Enable pushbutton input - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/gpio/interrupt/nucleo-f401/main.c b/examples/gpio/interrupt/nucleo-f401/main.c index 5908b60..6f6df8d 100644 --- a/examples/gpio/interrupt/nucleo-f401/main.c +++ b/examples/gpio/interrupt/nucleo-f401/main.c @@ -48,7 +48,7 @@ void hardware_init(void) { // Enable GPIO Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/gpio/interrupt/nucleo-f429/main.c b/examples/gpio/interrupt/nucleo-f429/main.c index 85a160b..a4e25ac 100644 --- a/examples/gpio/interrupt/nucleo-f429/main.c +++ b/examples/gpio/interrupt/nucleo-f429/main.c @@ -48,7 +48,7 @@ void hardware_init(void) { // Enable GPIO Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/gpio/interrupt/nucleo-l476/main.c b/examples/gpio/interrupt/nucleo-l476/main.c index 2643929..f78aaaa 100644 --- a/examples/gpio/interrupt/nucleo-l476/main.c +++ b/examples/gpio/interrupt/nucleo-l476/main.c @@ -48,7 +48,7 @@ void hardware_init(void) { // Enable GPIO Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/os/fr_queueset/nucleo-f401/main.c b/examples/os/fr_queueset/nucleo-f401/main.c index b37c484..cdc9421 100644 --- a/examples/os/fr_queueset/nucleo-f401/main.c +++ b/examples/os/fr_queueset/nucleo-f401/main.c @@ -254,7 +254,7 @@ static void hardware_init( void ) { // Enable GPIOC Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/os/fr_queueset/nucleo-f429/main.c b/examples/os/fr_queueset/nucleo-f429/main.c index b37c484..cdc9421 100644 --- a/examples/os/fr_queueset/nucleo-f429/main.c +++ b/examples/os/fr_queueset/nucleo-f429/main.c @@ -254,7 +254,7 @@ static void hardware_init( void ) { // Enable GPIOC Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/os/fr_queueset/nucleo-l476/main.c b/examples/os/fr_queueset/nucleo-l476/main.c index 1a01a3d..3eff2a2 100644 --- a/examples/os/fr_queueset/nucleo-l476/main.c +++ b/examples/os/fr_queueset/nucleo-l476/main.c @@ -254,7 +254,7 @@ static void hardware_init( void ) { // Enable GPIOC Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/os/fr_semaphore/nucleo-f401/main.c b/examples/os/fr_semaphore/nucleo-f401/main.c index 0ff15ac..f6550ea 100644 --- a/examples/os/fr_semaphore/nucleo-f401/main.c +++ b/examples/os/fr_semaphore/nucleo-f401/main.c @@ -157,7 +157,7 @@ static void hardware_init( void ) { // Enable GPIOC Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/os/fr_semaphore/nucleo-f429/main.c b/examples/os/fr_semaphore/nucleo-f429/main.c index 0ff15ac..f6550ea 100644 --- a/examples/os/fr_semaphore/nucleo-f429/main.c +++ b/examples/os/fr_semaphore/nucleo-f429/main.c @@ -157,7 +157,7 @@ static void hardware_init( void ) { // Enable GPIOC Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/os/fr_semaphore/nucleo-l476/main.c b/examples/os/fr_semaphore/nucleo-l476/main.c index d5729c2..89016c2 100644 --- a/examples/os/fr_semaphore/nucleo-l476/main.c +++ b/examples/os/fr_semaphore/nucleo-l476/main.c @@ -157,7 +157,7 @@ static void hardware_init( void ) { // Enable GPIOC Clock __GPIOC_CLK_ENABLE(); - GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << 13); //Set fast speed. + GPIOC->OSPEEDR |= (GPIO_SPEED_FAST << (13 * 2)); //Set fast speed. GPIOC->PUPDR &= ~(0x03 << (13 * 2)); //Clear bits for no push/pull GPIOC->MODER &= ~(0x03 << (13 * 2)); //Clear bits for input mode diff --git a/examples/pwm/static/nucleo-l476/main.c b/examples/pwm/static/nucleo-l476/main.c index 67ee908..5eba148 100644 --- a/examples/pwm/static/nucleo-l476/main.c +++ b/examples/pwm/static/nucleo-l476/main.c @@ -48,7 +48,7 @@ void hardware_init(void) { // Enable GPIOC Clock __GPIOB_CLK_ENABLE(); - GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << 2); //Set fast speed. + GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << (5 * 2)); //Set fast speed. GPIOB->PUPDR &= ~(0x03 << (5 * 2)); //Clear bits for no push/pull GPIOB->MODER &= ~(0x03 << (5 * 2)); //Clear bits GPIOB->MODER |= (GPIO_MODE_AF_PP << (5 * 2)); //Set Alternate Function Push Pull Mode diff --git a/examples/timer/inputcapture/nucleo-f401/main.c b/examples/timer/inputcapture/nucleo-f401/main.c index 22b518d..ffdb930 100644 --- a/examples/timer/inputcapture/nucleo-f401/main.c +++ b/examples/timer/inputcapture/nucleo-f401/main.c @@ -47,7 +47,7 @@ void hardware_init(void) { // Enable GPIOB Clock __GPIOB_CLK_ENABLE(); - GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << 1); //Set fast speed. + GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << (1 * 2)); //Set fast speed. GPIOB->PUPDR &= ~(0x03 << (1 * 2)); //Clear bits for no push/pull GPIOB->MODER &= ~(0x03 << (1 * 2)); //Clear bits GPIOB->MODER |= (GPIO_MODE_AF_PP << (1 * 2)); //Set Alternate Function Push Pull Mode diff --git a/examples/timer/inputcapture/nucleo-f429/main.c b/examples/timer/inputcapture/nucleo-f429/main.c index 283b3aa..1a8bf6a 100644 --- a/examples/timer/inputcapture/nucleo-f429/main.c +++ b/examples/timer/inputcapture/nucleo-f429/main.c @@ -47,7 +47,7 @@ void hardware_init(void) { // Enable GPIOB Clock __GPIOB_CLK_ENABLE(); - GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << 1); //Set fast speed. + GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << (1 * 2)); //Set fast speed. GPIOB->PUPDR &= ~(0x03 << (1 * 2)); //Clear bits for no push/pull GPIOB->MODER &= ~(0x03 << (1 * 2)); //Clear bits GPIOB->MODER |= (GPIO_MODE_AF_PP << (1 * 2)); //Set Alternate Function Push Pull Mode diff --git a/examples/timer/inputcapture/nucleo-l476/main.c b/examples/timer/inputcapture/nucleo-l476/main.c index 22b518d..ffdb930 100644 --- a/examples/timer/inputcapture/nucleo-l476/main.c +++ b/examples/timer/inputcapture/nucleo-l476/main.c @@ -47,7 +47,7 @@ void hardware_init(void) { // Enable GPIOB Clock __GPIOB_CLK_ENABLE(); - GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << 1); //Set fast speed. + GPIOB->OSPEEDR |= (GPIO_SPEED_FAST << (1 * 2)); //Set fast speed. GPIOB->PUPDR &= ~(0x03 << (1 * 2)); //Clear bits for no push/pull GPIOB->MODER &= ~(0x03 << (1 * 2)); //Clear bits GPIOB->MODER |= (GPIO_MODE_AF_PP << (1 * 2)); //Set Alternate Function Push Pull Mode