Skip to main content
vneff
Associate III
November 11, 2024
Solved

Can't enable port B & D clocks

  • November 11, 2024
  • 2 replies
  • 1220 views

I tried the following code in a STM32F107:

RCC->AHBENR = RCC->AHBENR | RCC_APB2ENR_IOPBEN_Msk| RCC_APB2ENR_IOPDEN_Msk;

and

RCC->AHBENR = RCC->AHBENR | 0x00000008 | 0x00000020;

When I display RCC->AHBENR, it always shows 0001C014.

I expected to see 0x0001C03C.

I found this because Ethernet never finished resetting.

 

 

Best answer by Tesla DeLorean

AHB != APB2, different busses

 

RCC->APB2ENR = RCC->APB2ENR | RCC_APB2ENR_IOPBEN_Msk| RCC_APB2ENR_IOPDEN_Msk;

2 replies

Emre Kiremitci
Associate II
November 11, 2024

Hello. Could you try this RCC->APB2ENR|=(1<<5)|(1<<3);

vneff
vneffAuthor
Associate III
November 11, 2024

Tried RCC->APB2ENR|=(1<<5)|(1<<3);

Still shows 0001C014.

Tesla DeLorean
Guru
November 11, 2024

Sure you're reading RCC->APB2ENR, and not RCC->AHBENR again? Would be odd for them both to read as 0x0001C014

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
November 11, 2024

AHB != APB2, different busses

 

RCC->APB2ENR = RCC->APB2ENR | RCC_APB2ENR_IOPBEN_Msk| RCC_APB2ENR_IOPDEN_Msk;

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
vneff
vneffAuthor
Associate III
November 11, 2024

My BAD.

I had been checking the Ethernet clocks.

Thanks for pointing out my error.

Unfortunately, I now have no idea why the Ethernet reset is not working. It times out.