cancel
Showing results for 
Search instead for 
Did you mean: 

how do i find the names of individual bits in registers

deep_rune
Associate III

where can i find the names of individual bits inside each register? i like to be able to use these to go

thing -> register |= 1<<name;

but although i know the header file that contains the register names, i can't find the names of the bits within the registers

6 REPLIES 6
TDK
Guru

Consult the reference manual.

The header files also include macros such as TIM_CR1_CEN for the CEN bit within the CR1 register.

If you feel a post has answered your question, please click "Accept as Solution".
deep_rune
Associate III

do you mean that they are the same names as in the reference manual?

if i use

I2C2 ->CR2 |= 1<<START; 

START being the name of the bit listed in the ref manual, it doesn't work

Yes. Go check it out.
If you feel a post has answered your question, please click "Accept as Solution".

where in the ref manual? the names given in the register descriptions dont work

Guessing theprune is using the L4

https://www.st.com/resource/en/reference_manual/dm00151940-stm32l41xxx42xxx43xxx44xxx45xxx46xxx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Exact naming will be in the CMSIS Include file, gives bit positions, etc. Might have subtly different names, or prefix/suffix to keep the namespaces unique

Repository\STM32Cube_FW_L4_V1.14.0\Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l432xx.h

#define DAC_CR_DMAEN2_Pos      (28U)

#define DAC_CR_DMAEN2_Msk      (0x1UL << DAC_CR_DMAEN2_Pos)        /*!< 0x10000000 */

#define DAC_CR_DMAEN2        DAC_CR_DMAEN2_Msk             /*!<DAC channel2 DMA enabled */

#define DAC_CR_DMAUDRIE2_Pos    (29U)

#define DAC_CR_DMAUDRIE2_Msk    (0x1UL << DAC_CR_DMAUDRIE2_Pos)      /*!< 0x20000000 */

#define DAC_CR_DMAUDRIE2      DAC_CR_DMAUDRIE2_Msk            /*!<DAC channel2 DMA underrun interrupt enable >*/

#define DAC_CR_CEN2_Pos       (30U)

#define DAC_CR_CEN2_Msk       (0x1UL << DAC_CR_CEN2_Pos)         /*!< 0x40000000 */

#define DAC_CR_CEN2         DAC_CR_CEN2_Msk              /*!<DAC channel2 calibration enable >*/

0693W000004Iho6QAC.jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..