Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

understanding meaning of | << opertation for GPIO clock in EFR32FG14

Status
Not open for further replies.

yefj

Advanced Member level 4
Joined
Sep 12, 2019
Messages
1,242
Helped
1
Reputation
2
Reaction score
3
Trophy points
38
Activity points
7,488
Hello,Inside CMU_ClockEnable(cmuClock_GPIO, true); we have cmuClock_GPIO parameter which is defined inside
em_cmu.h file and its definition is shown in code bellow.
What is the logical meaning of such expression?
how do i know a what register we write the value?

i know that | is "or" << is shift

I have tried to read and we shift at no prescale register some PRESC REG POS.what is the logical thing they are doing?
Thanks.


Code:
#if defined(CMU_HFBUSCLKEN0_GPIO)
  /** General-purpose input/output clock */
  cmuClock_GPIO = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
                  | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
                  | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
                  | (_CMU_HFBUSCLKEN0_GPIO_SHIFT << CMU_EN_BIT_POS)
                  | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
#endif
 

Attachments

  • 1676890319096.png
    1676890319096.png
    9 KB · Views: 75

Hi,

this [ | ] is the OR operator
this [ << ] is the shift left operator

so doing
Code:
data = a << a_shift
     | b << b_shift

... you have four variables.
Example: Let´s say:
a = 1 = 0b00000001
a_shift = 2
b = 3 = 0b00000011
b_shift = 4

so a = 0b00000001 shifted 2 bits left becomes 0b00000100
and b = 0b00000011 shifted 4 bits left becomes 0b00110000

now do:
0b00000100 OR 0b00110000 to get 0b00110100

Klaus
 

Sorry for duplicating Klaus. The idea is to build a selection of bits but using the bit names rather than a number. The value of cmuClock is the state of bits selected by the named amount shifted the named '_POS' places.

Brian.
 

Hello Brian, Regarding the prescaler setting, i am using the register called High Frequency Clock Prescaler Register shown bellow.
i and trying to understand the logic of this register.
we have bits 8:12 which define the prescaler for HFCLK
They say presc is clock divition factor of PRESC+1
I cant understand this line if i want to prescal my frequence by 4 what values should i write for 8:12 bits in CMU_HFPRESC?
Thanks.
page 301



1676922869901.png


1676924735493.png
 

Attachments

  • 1676915460198.png
    1676915460198.png
    53.2 KB · Views: 86
  • 1676922565060.png
    1676922565060.png
    91.7 KB · Views: 78
  • 1676923058271.png
    1676923058271.png
    17.4 KB · Views: 80

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top