Page 1 of 1

Trouble configuring STM32 IO for PUSHPULL mode

Posted: Wed Sep 05, 2012 5:25 am
by bsprajc
Hi,
I'm trying to configure GPIOB pins on the STM32 Value line Discovery board, for PUSHPULL mode, and am running into some strange results. I must be missing something critical.

/* THIS will actually put the pins in PUSHPULL mode */
palSetGroupMode(GPIOB,0xffff,0,PAL_MODE_OUTPUT_OPENDRAIN );

/* This puts in ins in Open Drain mode */
palSetGroupMode(GPIOB,0xffff,0,PAL_MODE_OUTPUT_PUSHPULL );

Also, when using PAL_MODE_OUTPUT_OPENDRAIN, all pads will go into PUSHPULL mode, except for pads PB7,PB5, and PB4 which remain in open drain mode.

I've disabled all periphials except for serial device 2, and have disabled JTAG:
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_DISABLE;

I hope somebody has a clue what I'm doing wrong.
Thanks
Barry

Re: Trouble configuring STM32 IO for PUSHPULL mode

Posted: Wed Sep 05, 2012 2:53 pm
by Giovanni
Strange, the driver apparently is correct, I can't explain the behavior you reported.

I've disabled all periphials except for serial device 2


Did you disable GPIO and AFIO clocks too?

Anyway, can you check the content of the CRL and CRH registers for port GPIOB after calling palSetGroupMode()? Nibbles should contain 3 for PP and 7 for OD.

Giovanni

Re: Trouble configuring STM32 IO for PUSHPULL mode

Posted: Fri Sep 07, 2012 8:08 pm
by bsprajc
Oh I figured out what was wrong. It is my Logic Probe, which is an older cheap one and so doesn't support anything below 4.5v and so the readings were incorrect.

When I connected an LED directly to the output, it reflected the actual state perfectly.

Now I know to use a scope or get an new probe :)