Hi, Toley
I have tested your code. It's not work like you but when i change alias of bit variable from
GPIOE_ODRbits.ODR15 to
ODR15_GPIOE_ODR_bit then it's work. Led's blinking now.
Code: Select all
{
GPIO_Digital_Output(&GPIOE_BASE, _GPIO_PINMASK_ALL); // PIN8-15 LEDs
while(1)
{
while(1)
{
ODR15_GPIOE_ODR_bit = 0;
delay_ms(500);
ODR15_GPIOE_ODR_bit = 1;
delay_ms(500);
}
}
}
I think there may be a problem with bit variable declaration so i take a look at file STM32F303VC.C and i think that i found the problem.
bit variable declaration that worked
Code: Select all
sfr far unsigned long volatile GPIOE_ODR absolute 0x48001014;
sbit ODR15_GPIOE_ODR_bit at GPIOE_ODR.B15;
sbit ODR14_GPIOE_ODR_bit at GPIOE_ODR.B14;
sbit ODR13_GPIOE_ODR_bit at GPIOE_ODR.B13;
sbit ODR12_GPIOE_ODR_bit at GPIOE_ODR.B12;
sbit ODR11_GPIOE_ODR_bit at GPIOE_ODR.B11;
sbit ODR10_GPIOE_ODR_bit at GPIOE_ODR.B10;
sbit ODR9_GPIOE_ODR_bit at GPIOE_ODR.B9;
sbit ODR8_GPIOE_ODR_bit at GPIOE_ODR.B8;
sbit ODR7_GPIOE_ODR_bit at GPIOE_ODR.B7;
sbit ODR6_GPIOE_ODR_bit at GPIOE_ODR.B6;
sbit ODR5_GPIOE_ODR_bit at GPIOE_ODR.B5;
sbit ODR4_GPIOE_ODR_bit at GPIOE_ODR.B4;
sbit ODR3_GPIOE_ODR_bit at GPIOE_ODR.B3;
sbit ODR2_GPIOE_ODR_bit at GPIOE_ODR.B2;
sbit ODR1_GPIOE_ODR_bit at GPIOE_ODR.B1;
sbit ODR0_GPIOE_ODR_bit at GPIOE_ODR.B0;
bit variable declaration that not worked
Code: Select all
typedef struct tagGPIOE_ODRBITS {
union {
struct {
unsigned ODR0 : 1;
unsigned ODR1 : 1;
unsigned ODR2 : 1;
unsigned ODR3 : 1;
unsigned ODR4 : 1;
unsigned ODR5 : 1;
unsigned ODR6 : 1;
unsigned ODR7 : 1;
unsigned ODR8 : 1;
unsigned ODR9 : 1;
unsigned ODR10 : 1;
unsigned ODR11 : 1;
unsigned ODR12 : 1;
unsigned ODR13 : 1;
unsigned ODR14 : 1;
unsigned ODR15 : 1;
unsigned : 16;
};
};
} typeGPIOE_ODRBITS;
sfr volatile typeGPIOE_ODRBITS GPIOE_ODRbits absolute 0x48001014;
I can see one thing differences. In the SFR declaration of
GPIOE_ODRbits don't have far typy qualifier.
when change
Code: Select all
sfr volatile typeGPIOE_ODRBITS GPIOE_ODRbits absolute 0x48001014;
to
Code: Select all
sfr far volatile typeGPIOE_ODRBITS GPIOE_ODRbits absolute 0x48001014;
now it works.
Best regard.