Trouble setting output pins to pull down resistor mode

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

Trouble setting output pins to pull down resistor mode

Jump to solution
747 Views
injunear1
Contributor IV

I trying to read inputs on pins 1, 3, & 5 (PTB8, PTB9 & PTB10 respectively). I want to ground pins PTB9 and PTB10 for an input and connect PTB8 to P3V3 for an input. If I understand things correctly, this would mean that I set PTB8 for pull down and PTB9 & 10 for pull up.

Although I have been able to read PTB9 & 10 as expected, PTB8 always reads high. However, it reads a low when shorted to ground.

After looking at the control register for the pin (PORTB_PCR8) in the register view, it appears as though both the slew rate and pull up resistor are hard set to on.

I was not able to clear them with:

PORTB_PCR8 = (PORTB_PCR8 & 0xFFFFFFF8);

(FWIW, it appears the same is true for PORTB_PCR9 as well. And PORTB_PCR10 has the slew rate set off, but the pull up resistor seems to be hard coded on.)

Is this a bug or a "feature" or am I not using these pins correctly?

And where do I find a definition of "slew rate", please?


Thank you.

Labels (1)
0 Kudos
1 Solution
576 Views
pgo
Senior Contributor V

Dear Injun,

You haven't specified which micro you are talking about.

However - The description of operation of the port registers is general.  A particular port may not implement all possible features.  There is usually another table indicating which features are available on which ports.

e.g. for the KL25

3.10.1.2 Port Control and Interrupt Summary

This confused me a lot as well!!

bye

View solution in original post

0 Kudos
3 Replies
577 Views
pgo
Senior Contributor V

Dear Injun,

You haven't specified which micro you are talking about.

However - The description of operation of the port registers is general.  A particular port may not implement all possible features.  There is usually another table indicating which features are available on which ports.

e.g. for the KL25

3.10.1.2 Port Control and Interrupt Summary

This confused me a lot as well!!

bye

0 Kudos
577 Views
JimDon
Senior Contributor III

pgo is  correct. According to the table he has mentioned, PORTB has no pull select control implemented, so that would explain why your code seems to do nothing.

It also says "All the pins are hard wired to be pullup except for SWD_CLK."

577 Views
JimDon
Senior Contributor III

I believe the correct setting for pull down would be bit 1 =  1 and bit 0 = 0, that is pull enable, use pull down.

0 Kudos