Skip to main content
peter_l
Associate II
January 10, 2012
Question

Can't set PORT B4

  • January 10, 2012
  • 7 replies
  • 1684 views
Posted on January 10, 2012 at 21:50

Hello guys,

i have a problem.I can't set port b4 on STM32VL-Discovery.I tryed with debug and on watch window it is set, but voltage stay 2.4V.I tryed and other, to reset port b4.But there it's still stay 2.4V.Just can't toggle.With other pins there are no problem.
    This topic has been closed for replies.

    7 replies

    Tesla DeLorean
    Guru
    January 10, 2012
    Posted on January 11, 2012 at 00:13

    I'd wager that you need to Remap JTAG off the pin(s)

    7.1.1 General-purpose I/O (GPIO)

    During and just after reset, the alternate functions are not active and the I/O ports are configured in Input Floating mode (CNFx[1:0]=01b, MODEx[1:0]=00b).

    The JTAG pins are in input PU/PD after reset:

    PA15: JTDI in PU

    PA14: JTCK in PD

    PA13: JTMS in PU

    PB4: NJTRST in PU

    When configured as output, the value written to the Output Data register (GPIOx_ODR) is output on the I/O pin. It is possible to use the output driver in Push-Pull mode or Open-Drain mode (only the N-MOS is activated when outputting 0).

    The Input Data register (GPIOx_IDR) captures the data present on the I/O pin at every APB2 clock cycle.

    All GPIO pins have an internal weak pull-up and weak pull-down which can be activated or not when configured as input.

    Hello guys,

    i have a problem.I can't set port b4 on STM32VL-Discovery.I tryed with debug and on watch window it is set, but voltage stay 2.4V.I tryed and other, to reset port b4.But there it's still stay 2.4V.Just can't toggle.With other pins there are no problem.
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    dennisvantienhoven
    Associate II
    January 11, 2012
    Posted on January 11, 2012 at 12:18

    @clive1

    I've also faced this problem (I wan't to use PB3 and PB4 as GPIO).

    But I'm programming my STM32VLD with a J-Link from SEGGER (external Programmer & debugger) but when I disable JTAG-DP and let SW-DP be enabled can I still use that external programmer and debugger? Or do I have to reset the board to use these pins again?

    Or Can't I use these external programmer and debugger anymore because its reprogrammed now..?

    That's were I'm afraid off..

    Greets,

    Dennis

    Tesla DeLorean
    Guru
    January 11, 2012
    Posted on January 11, 2012 at 14:04

    I'd imagine you'd use a J-Link model/version that was SWD capable, and select that mode only. And your code to set SWD_CFG = 010b (Enable SWD, Disable JTAG).

    I don't see this loosing SWD/Debug connectivity, and should be demonstrable with the VL-Discovery and ST-LINK, but haven't been using these pins.

    Generally I'd be using a serial debug console to augment JTAG/SWD connectivity.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    dennisvantienhoven
    Associate II
    January 11, 2012
    Posted on January 11, 2012 at 15:35

    @clive1

    OK that didn't work well.. my fear is comming true. I lost my program and debug connection.

    Um could you please help me with programming the IC with the IC on board of the SMT32VLD?

    You can PM me if you want (its not my topic).

    Greets,

    Dennis.

    peter_l
    peter_lAuthor
    Associate II
    January 11, 2012
    Posted on January 11, 2012 at 16:38

    Tesla DeLorean
    Guru
    January 11, 2012
    Posted on January 11, 2012 at 17:53

    OK that didn't work well.. my fear is comming true. I lost my program and debug connection.

     

    Um could you please help me with programming the IC with the IC on board of the SMT32VLD?

     

    You can PM me if you want (its not my topic).

     

    If you need to recover the chip pull BOOT0 high, it will then enter the System ROM, not your code, and the JTAG/SWD will work normally.

    I have no idea how to do that in this forum.  sourcer32@gmail.com

    Using the VL-Discovery as a programmer is a matter of pulling some jumpers, and connecting the two SWD pins, and a GND, and perhaps a VCC or RESET. I'm not using it that way, so beyond reading/interpreting the documentation I'm not going to be able to provide explicit instructions.

    You could post your code demonstrating how things are getting setup, and I could see if that makes sense, or if I can duplicate it on the VL-Discovery.

    Whatever version J-Link, or other pod you use, you need to be very sure it is in SWD mode, and locked there.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    dennisvantienhoven
    Associate II
    January 12, 2012
    Posted on January 12, 2012 at 09:15

    @clive1

    Thank you sir, It works again.

    For everyone who disabled the J-TAG function and can't reprogram there micrcocontroller again:

    De soled the SB16 soldering bridge (0 ohm resistor).

    power on your MCU

    (Power down the MCU) Solder the soldering bridge back on.

    Your MCU is now reset.

    @kyosev

    So you can experiment with the pins if you keep this in mind.

    The reason why I didn't use the internal programmer, is because I use the J-Link from Segger.