2011-08-29 10:12 PM
So i took the Stm32 gpio.zip project and changed the configuration to the bank i wanted to use and changed the main to a very simple bit switch. can someone tell me why it wont work?
#include <stm32f10x_lib.h> // STM32F10x Library Definitions #include ''STM32_Init.h'' // STM32 Initialization /*---------------------------------------------------------------------------- MAIN function *----------------------------------------------------------------------------*/ int main (void) { stm32_Init (); // STM32 setup while (1) { // Loop forever /* Set PE0 */ GPIOE->ODR |= (1 << 5); } // end while } // end main2011-08-29 10:57 PM
Can't suggest anything for the initialization code as it's not presented.
You appear to be setting PE52011-08-29 11:25 PM
i used the keil configuration wizard. i set the gpioe to pin5 out put.
2011-08-30 04:22 AM
So you're pretty much reliant on the code generator/wizard to produce the correct code. What part/board are you using? When you debug or single step the code can you see it altering peripheral registers?
while (1) { // Loop forever /* Toggle PE5 */ GPIOE->ODR ^= (1 << 5); } For it to work the GPIOE clocks need to have been enabled, and the pins configured. You could dig through the generated code to confirm that, or look at a peripheral window in the debugger.2011-08-30 09:38 AM
the board im using
its a no name board from china. a stm32f103fvet6. when compile i get a warning: Gpio.c(35): warning: #1-D: last line of file ends without a newline when i debug: http://i55.tinypic.com/2ziu810.jpg the GPIOE clock is disabled. so i check the APB2 register and see that the clock is disabled here too. so i enabled the peripheral clock for GPIOE and notice that GPIOE is set to all inputs. i switch PE.5 to output and it works. but when i download it to the board it doesnt do anything.2011-08-30 11:24 AM
I am puzzled by the wizard screens. None of the GPIOE pins can function as analog inputs. Does the wizard assume the user knows best ?
If the wizard can produce a C code listing, look at that and, if you can't spot the error, post it for review. Cheers, Hal2011-08-30 01:23 PM
The debug screen suggests the PE5 pin is configured as open-drain, you'd need a pull-up for it to go high.
Make sure it's push-pull, and instead of just repeatedly trying to set PE5 high, you should perhaps toggle it so you can observe it with an oscilloscope.2011-08-30 07:50 PM
can you tell me how to manually enable apb2 gpioe in KEIL? i dont think the config wizard is doing anything.
2011-08-30 07:51 PM
can you tell me how to manually enable apb2 gpioe in KEIL? i dont think the config wizard is doing anything.
2011-09-09 04:58 PM
UPDATE!!!
i just wanted to let u know i solved the problem by switching to IAR workbench :))