Page 1 of 1

VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 9:37 am
by ruslanpopov
I have made a simple board for STM32VLDiscovery: see schematic.

I have strange values on PB12..15 pins if I upload my firmware: pb12 - 3v pb13 - 0v, pb14 - 1.6v, pb15 - 0v. These pins are pulled up. So if DIP is on off state, then PB12..15 have to be in 1111 state.

I have configured port like this:

Code: Select all

/*
 * Port B setup.
 * Everything input with pull-up except:
 * PB12 - Push pull output  (SPI2 NSS), initially high state.
 * PB13 - Alternate output  (SPI2 SCK).
 * PB14 - Normal input      (SPI2 MISO).
 * PB15 - Alternate output  (SPI2 MOSI).
 */
#define VAL_GPIOBCRL            0x88888888      /*  PB7...PB0 */
#define VAL_GPIOBCRH            0x88888833      /* PB15...PB8 */
#define VAL_GPIOBODR            0xFFFFFFFF


But I have doubt about the comment lines above.
What I did wrong?

P.S. If i upload original discovery's firmware the PB12..15 have 0.1v on each pin.

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 9:52 am
by Giovanni
Hi,

You programmed them as inputs with pull-up resistors so you should read a 1 state or them unless there is something connected to those pins driving them down.

Giovanni

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 10:28 am
by ruslanpopov
Yes, I know about it. The matter is that if I disconnect my board from discovery, these pins keep their strange levels. I.e. the matter is not in my board.
It seems the firmware enables SPI on there pins.

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 11:17 am
by Giovanni
The demo uses the SPI, if you want to modify those pins then you have to modify main.c too and strip the code you don't need.

Giovanni

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 11:26 am
by ruslanpopov
It seems my code has no SPI related stuff. Can you check, please?
vl100-dock-cargobutton.tar.gz
Firmware for VLDiscovery related board.
(223.06 KiB) Downloaded 449 times

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 11:45 am
by Giovanni
There is no SPI-related code.

Note that your board.h file contains:

Code: Select all

#define VAL_GPIOBCRL            0x88888888      /*  PB7...PB0 */
#define VAL_GPIOBCRH            0xB4B38888      /* PB15...PB8 */
#define VAL_GPIOBODR            0xFFFFFFFF


So it is not what you posted.

Giovanni

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 11:59 am
by ruslanpopov
Big, Huge THANKS!

That was because I have edited the original file ``ST_STM32VL_DISCOVERY/board.h`` :)

By the way, now ``pbXX`` variables show right state of dip switch. Why ``index`` variable still keeps zero after palReadGroup()?

Re: VLDiscovery has strange state on PB12..15 pins

Posted: Mon Nov 05, 2012 1:04 pm
by ruslanpopov
ah, because palReadGroup(port, mask, offset) !