Skip to main content
frank239955_stm1_stmicro_com
Associate II
June 29, 2010
Question

Strange situation for a newbie

  • June 29, 2010
  • 3 replies
  • 777 views
Posted on June 30, 2010 at 00:01

Strange situation for a newbie

    This topic has been closed for replies.

    3 replies

    frank239955_stm1_stmicro_com
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:56

    I have thought about that and I used this:

        GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable | GPIO_Remap_SWJ_NoJTRST, ENABLE);

    since I am using SWJ 3pin, shouldn't this be OK to release that pin?

    This is my GPIO config:

    void Port_Configuration(void) {

        GPIO_InitTypeDef GPIO_InitStructure;

        GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable | GPIO_Remap_SWJ_NoJTRST, ENABLE);

        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD|RCC_APB2Periph_AFIO, ENABLE); 

       

    // SPI Bitbang -----------------------------------------------------------------

        GPIO_InitStructure.GPIO_Pin   =  GPIO_Pin_5 | GPIO_Pin_7;

        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

        GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;

        GPIO_Init(GPIOA, &GPIO_InitStructure);

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;

        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

        GPIO_Init(GPIOA, &GPIO_InitStructure);

    // SST25 CS------------------------------------------------------------------------

                                                            

        GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_15;

        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

        GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;

        GPIO_Init(GPIOA, &GPIO_InitStructure);

    }

    Thanks

    Frank

    raptorhal2
    Lead
    May 17, 2011
    Posted on May 17, 2011 at 13:56

    I believe it is simple. PA15 default after reset is JTAG Data In. Use another pin.

    Cheers, Hal

    chikos332
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 13:56

    Hi,

    The remap is part of the AFIO IP, so you are using the IP before enabling its clock:

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD|RCC_APB2Periph_AFIO, ENABLE); 

    //then you can call

    GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable | GPIO_Remap_SWJ_NoJTRST, ENABLE);