Can i write to the entire port to data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 9: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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 9:55 AM
or 0x0 -> GPIOB->ODR |= 0x0000; = nonsense.
need: GPIOB->ODR &= 0x0000;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 10:08 AM
which also not working bro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 10:32 AM
Just gives led to the port .not blingking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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
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
‎2023-10-04 10:49 AM
Which STM32 are you actually using? How is the LED wired up? Show a schematic. Show code.
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
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 7: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 7:53 PM
Here can see the data change in ODR regiter
https://www.kapwing.com/651e24acbc4f1a6b8e3cdf61/studio/editor/sharing
