Spark Logic

Improving pinMode

Hello,

Maybe i missed something (i am new here) but am i wrong or i can t use some of the nice features of the STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog like the pulldown input?

I would like to add this: pinMode(pin, INPUT_PULLDOWN)

Another function i would like to add is to choose the speed of gpio for example pinMode(pin, OUTPUT, LOWSPEED)

Maybe more experienced people than me tried and it is not simple,so i thought to write here before trying it
Tell me and i will try then i post the code here :)

Replies12

Tue Apr 11, 2017 8:50 am

aster wrote:Hello,

Maybe i missed something (i am new here) but am i wrong or i can t use some of the nice features of the STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog like the pulldown input?

I would like to add this: pinMode(pin, INPUT_PULLDOWN)

Another function i would like to add is to choose the speed of gpio for example pinMode(pin, OUTPUT, LOWSPEED)

Maybe more experienced people than me tried and it is not simple,so i thought to write here before trying it
Tell me and i will try then i post the code here :)

Tue Apr 11, 2017 8:57 am

You cannot activate only the built-in pull-down resistor separately from the pull-up resistor.
See available modes in RM0008 chapters 9.2.1, 9.2.2:
CNFy[1:0]: Port x configuration bits (y= 0 .. 7)
These bits are written by software to configure the corresponding I/O port.
Refer to Table 20: Port bit configuration table.
In input mode (MODE[1:0]=00):
00: Analog mode
01: Floating input (reset state)
10: Input with pull-up / pull-down
11: Reserved

Tue Apr 11, 2017 9:08 am

INPUT_PULLDOWN should already work
http://wiki.stm32duino.com/index.php?ti … #Pin_Modes

and about the speed, what would be the advantage in being able to define that? atm it defaults to the highest speed i think, is there any reason we would want it differently?

I tried it yesterday and it didn t worked, for sure i wrote it wrong :cry:

Yep about the speed it is not so usefull except for power saving application (not my case)

Tue Apr 11, 2017 9:55 am

OK, I have to reformulate: The F103 does not have any INPUT_PULLDOWN mode.
The wiki should be corrected as well.

Tue Apr 11, 2017 10:33 am

Mmm what about adding it? In this way the wiki will be correct :roll:

Tue Apr 11, 2017 10:39 am

aster wrote:Mmm what about adding it? In this way the wiki will be correct :roll:

Tue Apr 11, 2017 10:43 am

stevestrong wrote:OK, I have to reformulate: The F103 does not have any INPUT_PULLDOWN mode.
The wiki should be corrected as well.

Tue Apr 11, 2017 11:21 am

Maybe the software has it but the hardware definitely not:
stevestrong wrote:You cannot activate only the built-in pull-down resistor separately from the pull-up resistor.
See available modes in RM0008 chapters 9.2.1, 9.2.2:
CNFy[1:0]: Port x configuration bits (y= 0 .. 7)
These bits are written by software to configure the corresponding I/O port.
Refer to Table 20: Port bit configuration table.
In input mode (MODE[1:0]=00):
00: Analog mode
01: Floating input (reset state)
10: Input with pull-up / pull-down
11: Reserved

Tue Apr 11, 2017 11:52 am

stevestrong wrote:Maybe the software has it but the hardware definitely not:
stevestrong wrote:You cannot activate only the built-in pull-down resistor separately from the pull-up resistor.
See available modes in RM0008 chapters 9.2.1, 9.2.2:
CNFy[1:0]: Port x configuration bits (y= 0 .. 7)
These bits are written by software to configure the corresponding I/O port.
Refer to Table 20: Port bit configuration table.
In input mode (MODE[1:0]=00):
00: Analog mode
01: Floating input (reset state)
10: Input with pull-up / pull-down
11: Reserved

Tue Apr 11, 2017 12:01 pm

Thanks @edogaldo, it seems that your right, it’s never too late to learn something new ;)
Just that I have never seen an example where this is used.
Has anyone tried this out?
Is this working also in combination with GPIOx_BSRR register values?

Tue Apr 11, 2017 12:05 pm

stevestrong wrote:Thanks @edogaldo, it seems that your right, it’s never too late to learn something new ;)
Just that I have never seen an example where this is used.
Has anyone tried this out?
Is this working also in combination with GPIOx_BSRR register values?

Tue Apr 11, 2017 7:35 pm

edogaldo wrote:aster wrote:Mmm what about adding it? In this way the wiki will be correct :roll:

Post a reply

Optional · up to 10 MiB