2023-10-04 09:38 AM
Hai experts .
Can i wrte data to the entire Port as follows
GPIOB->ODR |= 0x0000;
HAL_Delay(1000);
GPIOB->ODR |=0xffff;
Whenever i write like wise the SFR register shows correct value in Debug mode
But in Hardware its not working .whats the wrong with me ?
2023-10-04 09:55 AM
or 0x0 -> GPIOB->ODR |= 0x0000; = nonsense.
need: GPIOB->ODR &= 0x0000;
2023-10-04 10:08 AM
which also not working bro
2023-10-04 10:22 AM
> But in Hardware its not working .whats the wrong with me ?
Why don't you think it's working? You are probably misinterpreting something, or there is another issue.
2023-10-04 10:32 AM
Just gives led to the port .not blingking
2023-10-04 10:48 AM
The clocks for GPIOB need to be enabled, and the pin suitably configured.
You don't show any of that code. Suggest you use libraries until you've got a better mastery of this.
ORing ZERO is not how you clear bits.
You could use ODR or BSRR. GPIOB->ODR &= ~GPIO_PIN_12; or GPIOB->BSRR = GPIO_PIN_12 << 16; // Clear
2023-10-04 10:49 AM
Which STM32 are you actually using? How is the LED wired up? Show a schematic. Show code.
2023-10-04 11:17 AM
This code doesn't blink an LED. It does nothing (first line), waits a second then sets all outputs to high.
GPIOB->ODR |= 0x0000;
HAL_Delay(1000);
GPIOB->ODR |=0xffff;
There is no loop which would be needed to blink. It doesn't configure any pins as output which would also be needed to blink an LED. It doesn't configure any ports. It is also missing a second delay, which, if in a loop, would be needed to blink an LED.
Maybe you do these somewhere else in the program, maybe not.
2023-10-04 07:50 PM
GPIOB->ODR = 0x0000;
HAL_Delay(1000);
GPIOB->ODR = 0xffff;
HAL_Delay(1000);
Changed as per above .
GPIOB perpheral clock enabled ,GPIOB enabled as output .
external 8mhz clock is used .
In debug mode the ODR 1,2,3 bit of PORT B changing as per programm
But not refflect in hardware .
I think GPIOB->ODR canot write entire data
2023-10-04 07:53 PM
Here can see the data change in ODR regiter
https://www.kapwing.com/651e24acbc4f1a6b8e3cdf61/studio/editor/sharing