STM32 rccReset macro clears bits not in mask Topic is solved
Posted: Wed Aug 16, 2017 2:13 pm
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
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; \
}