Skip to main content
Explorer
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.

 

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    AHB != APB2, different busses

     

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

    2 replies

    Visitor II
    November 11, 2024

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

    vneffAuthor
    Explorer
    November 11, 2024

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

    Still shows 0001C014.

    Graduate II
    November 11, 2024

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

    Graduate II
    November 11, 2024

    AHB != APB2, different busses

     

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

    vneffAuthor
    Explorer
    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.