VLDiscovery has strange state on PB12..15 pins

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
ruslanpopov
Posts: 35
Joined: Sun Aug 19, 2012 9:36 pm

VLDiscovery has strange state on PB12..15 pins

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

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

Post 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
ruslanpopov
Posts: 35
Joined: Sun Aug 19, 2012 9:36 pm

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

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

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

Post 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
ruslanpopov
Posts: 35
Joined: Sun Aug 19, 2012 9:36 pm

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

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

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

Post 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
ruslanpopov
Posts: 35
Joined: Sun Aug 19, 2012 9:36 pm

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

Post 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()?
ruslanpopov
Posts: 35
Joined: Sun Aug 19, 2012 9:36 pm

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

Post by ruslanpopov »

ah, because palReadGroup(port, mask, offset) !
Post Reply