STM32 rccReset macro clears bits not in mask Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
User avatar
FXCoder
Posts: 403
Joined: Sun Jun 12, 2016 4:10 am
Has thanked: 188 times
Been thanked: 134 times

STM32 rccReset macro clears bits not in mask

Post by FXCoder »

Hi Giovanni,
All the Chibios STM32 rccReset macros clear the entire register after applying the reset bits specified by the mask (see example below).
In the event that some other independent (non Chibios) driver code has intentionally set a Reset bit in the rcc register then that other driver code expects the bit to remain set until it clears it.

Suggest all rccReset macros to use RCC->xxxxRSTR &= ~(mask);

Bob

Code: Select all

/**
 * @brief   Resets one or more peripheral on the APB1 bus.
 *
 * @param[in] mask      APB1 peripherals mask
 *
 * @api
 */
#define rccResetAPB1(mask) {                                                \
  RCC->APB1RSTR |= (mask);                                                  \
  RCC->APB1RSTR = 0;                                                        \
}
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 rccReset macro clears bits not in mask

Post by Giovanni »

Moved in change request.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 rccReset macro clears bits not in mask

Post by Giovanni »

Hi,

Implemented in trunk and 18.2.x.

Giovanni
Post Reply