cancel
Showing results for 
Search instead for 
Did you mean: 

problem with pb3

kazem
Associate
Posted on December 06, 2012 at 20:43

hi every body

i have problem with pb3 pb4 and some other pins

when i remap it in program have no response on simulator

my programmer is j-link & when i program via jtag

i want to use pb3 in gpio mode but doesn't work correctly

#include ''stm32f10x.h''

#include ''lcd4bit.h''

#include ''RCC_init.h''

//////////////////////////////////////////////////////////

//void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);

extern void RCCPreInit();

int main(void)

{    unsigned int i=0;

    unsigned int s=0;    

    unsigned int A=100;    

    GPIO_InitTypeDef GPIO_InitStructure;

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE);

    GPIO_PinRemapConfig( GPIO_Remap_SWJ_Disable, DISABLE);/*!< Full SWJ Disabled (JTAG-DP + SW-DP) */

    RCCPreInit();

    RCC_INIT();    

    

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7

                                                                |GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13

                                                                |GPIO_Pin_14|GPIO_Pin_15;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

  GPIO_Init(GPIOB, &GPIO_InitStructure);     

    GPIO_Init(GPIOA, &GPIO_InitStructure);

        while(1)

         {

                GPIOA->ODR=0x0000;

                 GPIOB->ODR=0x0000;

        for(i=0;i<350000;i++){} //delay              

          GPIOB->ODR=0xffff;

                GPIOA->ODR=0xffff;    

          for(i=0;i<350000;i++){} //delay                   

                 }

}
1 REPLY 1
Posted on December 06, 2012 at 21:23

Are you complaining that the J-Link stops working? In JTAG mode PB3 is JTDO, so kind of important.

Are you trying to use SWD mode? Are you in fact using SWD?  Do you have PB3 connected to the debug interface?

Try example

STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\GPIO\JTAG_Remap\main.c

    /* Disable the Serial Wire Jtag Debug Port SWJ-DP */

    GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); // << NOT DISABLE !!

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..