MM9Z1_638 Microcontroller GPIOB Input Set Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MM9Z1_638 Microcontroller GPIOB Input Set Problem

4,445 Views
mfatihkoseoglu
Contributor I

Hello All, 

I'am programming MM9Z1_638 microcontroller. I set output and input PORTA, but i don't set input GPIOB.

I wrote this function: 

void GPIOB_Init(void)
{
B_GPIO_CTL = (B_GPIO_CTL_PE1M_MASK |0);
B_GPIO_CTL = (B_GPIO_CTL_PE2M_MASK |0);
B_GPIO_CTL = (B_GPIO_CTL_PE3M_MASK |0);
B_GPIO_CTL = (B_GPIO_CTL_PE4M_MASK |0);

B_GPIO_CTL = (B_GPIO_CTL_PE1M_MASK |0);

B_GPIO_CTL = (B_GPIO_CTL_DIR2M_MASK|0);
B_GPIO_CTL = (B_GPIO_CTL_PE2M_MASK |B_GPIO_CTL_PE2_MASK);
B_GPIO_CTL = (B_GPIO_CTL_DIR3M_MASK|0);
B_GPIO_CTL = (B_GPIO_CTL_PE3M_MASK |B_GPIO_CTL_PE3_MASK);
}

mfatihkoseoglu_1-1632134275182.png

mfatihkoseoglu_2-1632134289064.png

 

and i wath B_GPIO register and B_GPIO_CTL register is 0x0000. 

 

Why cant i set port and how can i use this port? 

 

mfatihkoseoglu_0-1632134256163.png

 

0 Kudos
5 Replies

4,430 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Muhammed,

No problem, just note the B_GPIO_CTL register has different bit’s meaning from the commonly used standards.

The *_MASK bits block (“0”) or allow (“1”) to write value into data bit. So if you want to have all port’s bits accessible you need use:

void GPIOB_Init(void)
{
B_GPIO_CTLH = (B_GPIO_CTLH_PE1M_MASK |   // enable write to PE1;

B_GPIO_CTLH_PE2M_MASK |   // enable write to PE2;

B_GPIO_CTLH_PE3M_MASK |   // enable write to PE3;

B_GPIO_CTLH_PE4M_MASK |   // enable write to PE4;

B_GPIO_CTLH_DIR1M_MASK |   // enable write to DIR1;

B_GPIO_CTLH_DIR2M_MASK |   // enable write to DIR2;

B_GPIO_CTLH_DIR3M_MASK);   // enable write to DIR3;

// and then write values to low byte of B_GPIO_CTLL register;

B_GPIO_CTLL = (B_GPIO_CTLL_PE1_MASK |   // PE1 enabled;

B_GPIO_CTLL_PE2_MASK |   // PE2 enabled;

B_GPIO_CTLL_PE3_MASK |   // PE3 enabled;

B_GPIO_CTLH_DIR1_MASK |   // PE1 as output;

B_GPIO_CTLH_DIR2_MASK |   // PE2 as output;

B_GPIO_CTLH_DIR3_MASK );    // PE3 as output;

}

Sorry I don’t have the board with MCU for test, but I hope my suggestion could help you.

Best Regards,

Stano.

0 Kudos

4,426 Views
mfatihkoseoglu
Contributor I

Hello StanoA,

 

I tried the way you said but it is not work. 

My init function: 

Not: I want to use input GPIOB pins. 

void GPIOB_Init(void)
{
B_GPIO_CTLH = (B_GPIO_CTLH_PE1M_MASK | B_GPIO_CTLH_PE2M_MASK | B_GPIO_CTLH_PE3M_MASK | B_GPIO_CTLH_PE4M_MASK
| B_GPIO_CTLH_DIR1M_MASK | B_GPIO_CTLH_DIR2M_MASK | B_GPIO_CTLH_DIR2M_MASK);
B_GPIO_CTLL = (B_GPIO_CTLL_PE1_MASK | B_GPIO_CTLL_PE2_MASK | B_GPIO_CTLL_PE3_MASK | B_GPIO_CTLL_PE4_MASK);
}

After the work, B_GPIO_C register value is 0x0000. 

 

mfatihkoseoglu_0-1632148309820.png

 

My init function: 

mfatihkoseoglu_1-1632148344518.png

 

0 Kudos

4,398 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Muhammed,

Please reset the MCU in debug mode, set the breakpoint to line “for(;;) { …” and run the code. When it will stop on breakpoint read the variables:

value and value2.

This means select them in window:

StanoA_0-1632239299914.png

 

And check the values.

Best Regards,

Stano.

0 Kudos

4,391 Views
mfatihkoseoglu
Contributor I

Hello StanoA,

I reset mcu in debug mode and set break point in for loop, i see the all values is 0.  

 

mfatihkoseoglu_0-1632295513346.pngmfatihkoseoglu_1-1632295558725.png

 

 

0 Kudos

4,373 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Muhammed,

I asked our specialist for help. The result is:

The port bit must be written together with their mask bit = 1.

If the associated mask bit = 0, the write is not allowed.

The masked bits (e.g. GPIO...PE1M and GPIO...PE1) have to be written in a single access. In this case as 16bit write. Please see the attached gpio.h file also for this example:

//-------------------------------------------------

// enable PTB1 as output

B_GPIO_CTL = GPIO_CTL_PTB1_ENABLE | GPIO_CTL_PTB1_OUTPUT;
B_GPIO_OUT1 = OUT_PTBx;

// set PTB1
B_GPIO_OUT1 = OUT_PTBx;
// clear PTB1
B_GPIO_OUT1 = 0;

//----------------------------------------------------

Please see also this AN for this product:

https://www.nxp.com/docs/en/application-note/AN12301.pdf

I hope it could help you with your task.

Best Regards,

Stano.

0 Kudos
%3CLINGO-SUB%20id%3D%22lingo-sub-1342703%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMM9Z1_638%20Microcontroller%20GPIOB%20Input%20Set%20Problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1342703%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20All%2C%26nbsp%3B%3C%2FP%3E%3CP%3EI'am%20programming%20MM9Z1_638%20microcontroller.%20I%20set%20output%20and%20input%20PORTA%2C%20but%20i%20don't%20set%20input%20GPIOB.%3C%2FP%3E%3CP%3EI%20wrote%20this%20function%3A%26nbsp%3B%3C%2FP%3E%3CP%3Evoid%20GPIOB_Init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE1M_MASK%20%7C0)%3B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE2M_MASK%20%7C0)%3B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE3M_MASK%20%7C0)%3B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE4M_MASK%20%7C0)%3B%3CBR%20%2F%3E%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE1M_MASK%20%7C0)%3B%3CBR%20%2F%3E%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_DIR2M_MASK%7C0)%3B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE2M_MASK%20%7CB_GPIO_CTL_PE2_MASK)%3B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_DIR3M_MASK%7C0)%3B%3CBR%20%2F%3EB_GPIO_CTL%20%3D%20(B_GPIO_CTL_PE3M_MASK%20%7CB_GPIO_CTL_PE3_MASK)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_1-1632134275182.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_1-1632134275182.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156504i9CD7439680AD8A44%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_1-1632134275182.png%22%20alt%3D%22mfatihkoseoglu_1-1632134275182.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_2-1632134289064.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_2-1632134289064.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156505i1C4DBFCCE30E28CB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_2-1632134289064.png%22%20alt%3D%22mfatihkoseoglu_2-1632134289064.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eand%20i%20wath%20B_GPIO%20register%20and%20B_GPIO_CTL%20register%20is%200x0000.%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EWhy%20cant%20i%20set%20port%20and%20how%20can%20i%20use%20this%20port%3F%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_0-1632134256163.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_0-1632134256163.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156503i180093A00507C206%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_0-1632134256163.png%22%20alt%3D%22mfatihkoseoglu_0-1632134256163.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1344005%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MM9Z1_638%20Microcontroller%20GPIOB%20Input%20Set%20Problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1344005%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Muhammed%2C%3C%2FP%3E%0A%3CP%3EI%20asked%20our%20specialist%20for%20help.%20The%20result%20is%3A%3C%2FP%3E%0A%3CP%3EThe%20port%20bit%20must%20be%20written%20together%20with%20their%20mask%20bit%20%3D%201.%3C%2FP%3E%0A%3CP%3EIf%20the%20associated%20mask%20bit%20%3D%200%2C%20the%20write%20is%20not%20allowed.%3C%2FP%3E%0A%3CP%3EThe%20masked%20bits%20(e.g.%20GPIO...PE1M%20and%20GPIO...PE1)%20have%20to%20be%20written%20in%20a%20single%20access.%20In%20this%20case%20as%2016bit%20write.%20Please%20see%20the%20attached%20gpio.h%20file%20also%20for%20this%20example%3A%3C%2FP%3E%0A%3CP%3E%2F%2F-------------------------------------------------%3C%2FP%3E%0A%3CP%3E%2F%2F%20enable%20PTB1%20as%20output%3C%2FP%3E%0A%3CP%3EB_GPIO_CTL%20%3D%20GPIO_CTL_PTB1_ENABLE%20%7C%20GPIO_CTL_PTB1_OUTPUT%3B%3CBR%20%2F%3EB_GPIO_OUT1%20%3D%20OUT_PTBx%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%2F%2F%20set%20PTB1%3CBR%20%2F%3EB_GPIO_OUT1%20%3D%20OUT_PTBx%3B%3CBR%20%2F%3E%2F%2F%20clear%20PTB1%3CBR%20%2F%3EB_GPIO_OUT1%20%3D%200%3B%3C%2FP%3E%0A%3CP%3E%2F%2F----------------------------------------------------%3C%2FP%3E%0A%3CP%3EPlease%20see%20also%20this%20AN%20for%20this%20product%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN12301.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN12301.pdf%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EI%20hope%20it%20could%20help%20you%20with%20your%20task.%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3C%2FP%3E%0A%3CP%3EStano.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1343788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MM9Z1_638%20Microcontroller%20GPIOB%20Input%20Set%20Problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1343788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20StanoA%2C%3C%2FP%3E%3CP%3EI%20reset%20mcu%20in%20debug%20mode%20and%20set%20break%20point%20in%20for%20loop%2C%20i%20see%20the%20all%20values%20is%200.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_0-1632295513346.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_0-1632295513346.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156706i805F722042A807B0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_0-1632295513346.png%22%20alt%3D%22mfatihkoseoglu_0-1632295513346.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_1-1632295558725.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_1-1632295558725.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156707i00EFDCE4B9A45FD2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_1-1632295558725.png%22%20alt%3D%22mfatihkoseoglu_1-1632295558725.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1343382%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MM9Z1_638%20Microcontroller%20GPIOB%20Input%20Set%20Problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1343382%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Muhammed%2C%3C%2FP%3E%0A%3CP%3EPlease%20reset%20the%20MCU%20in%20debug%20mode%2C%20set%20the%20breakpoint%20to%20line%20%E2%80%9Cfor(%3B%3B)%20%7B%20%E2%80%A6%E2%80%9D%20and%20run%20the%20code.%20When%20it%20will%20stop%20on%20breakpoint%20read%20the%20variables%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3Evalue%3C%2FEM%3E%20and%20%3CEM%3Evalue2.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EThis%20means%20select%20them%20in%20window%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22StanoA_0-1632239299914.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22StanoA_0-1632239299914.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156618iE9FBFB24D109D6B1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22StanoA_0-1632239299914.png%22%20alt%3D%22StanoA_0-1632239299914.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EAnd%20check%20the%20values.%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3C%2FP%3E%0A%3CP%3EStano.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1342804%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MM9Z1_638%20Microcontroller%20GPIOB%20Input%20Set%20Problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1342804%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20StanoA%2C%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20tried%20the%20way%20you%20said%20but%20it%20is%20not%20work.%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20init%20function%3A%26nbsp%3B%3C%2FP%3E%3CP%3ENot%3A%20I%20want%20to%20use%20input%20GPIOB%20pins.%26nbsp%3B%3C%2FP%3E%3CP%3Evoid%20GPIOB_Init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EB_GPIO_CTLH%20%3D%20(B_GPIO_CTLH_PE1M_MASK%20%7C%20B_GPIO_CTLH_PE2M_MASK%20%7C%20B_GPIO_CTLH_PE3M_MASK%20%7C%20B_GPIO_CTLH_PE4M_MASK%3CBR%20%2F%3E%7C%20B_GPIO_CTLH_DIR1M_MASK%20%7C%20B_GPIO_CTLH_DIR2M_MASK%20%7C%20B_GPIO_CTLH_DIR2M_MASK)%3B%3CBR%20%2F%3EB_GPIO_CTLL%20%3D%20(B_GPIO_CTLL_PE1_MASK%20%7C%20B_GPIO_CTLL_PE2_MASK%20%7C%20B_GPIO_CTLL_PE3_MASK%20%7C%20B_GPIO_CTLL_PE4_MASK)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3EAfter%20the%20work%2C%20B_GPIO_C%20register%20value%20is%200x0000.%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_0-1632148309820.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_0-1632148309820.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156516i2F5960577C24B4A7%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_0-1632148309820.png%22%20alt%3D%22mfatihkoseoglu_0-1632148309820.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EMy%20init%20function%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mfatihkoseoglu_1-1632148344518.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mfatihkoseoglu_1-1632148344518.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F156517iAEE595480915A974%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mfatihkoseoglu_1-1632148344518.png%22%20alt%3D%22mfatihkoseoglu_1-1632148344518.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1342796%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MM9Z1_638%20Microcontroller%20GPIOB%20Input%20Set%20Problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1342796%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Muhammed%2C%3C%2FP%3E%0A%3CP%3ENo%20problem%2C%20just%20note%20the%20B_GPIO_CTL%20register%20has%20different%20bit%E2%80%99s%20meaning%20from%20the%20commonly%20used%20standards.%3C%2FP%3E%0A%3CP%3EThe%20*_MASK%20bits%20block%20(%E2%80%9C0%E2%80%9D)%20or%20allow%20(%E2%80%9C1%E2%80%9D)%20to%20write%20value%20into%20data%20bit.%20So%20if%20you%20want%20to%20have%20all%20port%E2%80%99s%20bits%20accessible%20you%20need%20use%3A%3C%2FP%3E%0A%3CP%3Evoid%20GPIOB_Init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EB_GPIO_CTLH%20%3D%20(B_GPIO_CTLH_PE1M_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20PE1%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_PE2M_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20PE2%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_PE3M_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20PE3%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_PE4M_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20PE4%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_DIR1M_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20DIR1%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_DIR2M_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20DIR2%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_DIR3M_MASK)%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20enable%20write%20to%20DIR3%3B%3C%2FP%3E%0A%3CP%3E%2F%2F%20and%20then%20write%20values%20to%20low%20byte%20of%20B_GPIO_CTLL%20register%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLL%20%3D%20(B_GPIO_CTLL_PE1_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20PE1%20enabled%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLL_PE2_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20PE2%20enabled%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLL_PE3_MASK%20%7C%26nbsp%3B%20%26nbsp%3B%2F%2F%20PE3%20enabled%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_DIR1_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20PE1%20as%20output%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_DIR2_MASK%20%7C%26nbsp%3B%26nbsp%3B%20%2F%2F%20PE2%20as%20output%3B%3C%2FP%3E%0A%3CP%3EB_GPIO_CTLH_DIR3_MASK%20)%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20PE3%20as%20output%3B%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3ESorry%20I%20don%E2%80%99t%20have%20the%20board%20with%20MCU%20for%20test%2C%20but%20I%20hope%20my%20suggestion%20could%20help%20you.%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3C%2FP%3E%0A%3CP%3EStano.%3C%2FP%3E%3C%2FLINGO-BODY%3E