Trouble configuring STM32 IO for PUSHPULL mode

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
bsprajc
Posts: 6
Joined: Fri Aug 24, 2012 11:28 pm

Trouble configuring STM32 IO for PUSHPULL mode

Post 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
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Trouble configuring STM32 IO for PUSHPULL mode

Post 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
bsprajc
Posts: 6
Joined: Fri Aug 24, 2012 11:28 pm

Re: Trouble configuring STM32 IO for PUSHPULL mode

Post 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 :)
Post Reply