STM32F411RE cmsis led don't turn off
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-10 10:46 AM
Hi,
I've got problem with code. LED on my board STM32F411RE don't turn off when I'm using cmsis library but in HAL or StdPeriph it works. &sharpinclude ''stm32f4xx.h'' &sharpinclude ''core_cm4.h'' int main(void) { //configure output RCC->AHB1ENR = RCC_AHB1ENR_GPIOAEN; __DSB(); GPIOA -> MODER |= GPIO_MODER_MODER5_0; //as output GPIOA -> ODR |= GPIO_ODR_ODR_5; //set high GPIOA -> ODR &=~ GPIO_ODR_ODR_5; while(1){} } When I'm using ''GPIOA -> ODR ^=GPIO_ODR_ODR_5;'' led is still on. Best regards, ?ukasz #cmsis #stm32f4- Labels:
-
CMSIS
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-10 12:34 PM
Everything is ok.
LED active on '1'??- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-11 1:35 AM
Yes, LED is active on '1' but not turn off when I'm using
''GPIOA -> ODR &=~ (GPIO_ODR_ODR_5);'' or ''GPIOA -> BSRR = GPIO_BSRR_BR_5;''. Is it problem with code or with Nucleo?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-11 2:08 AM
Did you try debug? Maybe you get hardfault?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-11 8:33 AM
Hi mendyk.lukasz,
This is a working code (tested on STM32F411RE Nucelo C-03). Try to test it in a template project of Hal library to figure out what it is causing problem in your project. Step by step debugging is your freind. The template project path is : stm32cubef4_1.11\STM32Cube_FW_F4_V1.11.0\Projects\STM32F411RE-Nucleo\Templates -Hannibal-- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-11 1:20 PM
Hi Hannibal,
I was using HAL library and it was working. I've already started with CMSIS. I was debugging it in Keil but LED didn't wanna turn off. I don't know what the problem is.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-11 1:44 PM
Use the peripheral view within Keil to confirm that the configuration is correct, and that as you toggle the output pin you can see that reflected in the register and the pin. Use the debugger and step through the code. You can contrast the peripheral settings between the cases you have working, against those that don't.
Where the configuration uses multiple bits, you might want to mask it into the register, rather than assume initial conditions.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-11 2:37 PM
Hi,
I don't know why but at this moment it's working. Thanks for all answers. I should spend more time at debugging and check config.