Skip to main content
kdeganck9
Associate
Oct 22, 2009 8:28 AM UTC
Question

usart3 remapping

Posted on October 22, 2009 at 10:28

usart3 remapping

    This topic has been closed for replies.

    5 replies

    kdeganck9
    kdeganck9Author
    Associate
    May 17, 2011 11:26 AM UTC
    Posted on May 17, 2011 at 13:26

    I do not succeed in 'half' remapping the USART3 on a STM32F103RB device (64LQFP, 128K Flash/20K RAM)

    The software works when port 3 in not remapped (with I2C2 clock disabled) and uses the same code as for port 1 and 2.

    The pins PC10 and PC11 can be toggled when used as push pull output.

    Has anyone experienced a similar problem or can just advice me in what to do next ?

    Thanks in advance.

    The code below shows the only difference between remap or not by means of the definition of 'USART3_PartialRemap'.

    #ifdef USART3_PartialRemap

    /* Configure USART3 Rx (PC.11) as input floating */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

    GPIO_Init(GPIOC, &GPIO_InitStructure);

    /* Configure USART3 Tx (PC.10) as alternate function push-pull */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

    GPIO_Init(GPIOC, &GPIO_InitStructure);

    GPIO_PinRemapConfig( GPIO_PartialRemap_USART3, ENABLE );

    #else

    /* Configure USART3 Rx (PB.11) as input floating */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

    /* Configure USART2 Tx (PB.10) as alternate function push-pull */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

    #endif

    RCC_APB1PeriphClockCmd( RCC_APB1Periph_USART3, ENABLE);

    kdeganck9
    kdeganck9Author
    Associate
    May 17, 2011 11:26 AM UTC
    Posted on May 17, 2011 at 13:26

    Dear Clive,

    Thanks for your response.

    I tried on a 'RET6' device too and I have the same problem.

    The GPIO clocks are enabled, otherwise I would be able to toggle the pins via JTAG.

    I also tried the remap statement before and after.

    But in the next coming days I'll try some other things you propose.

    regards,

    Koen

    clive2
    Visitor II
    May 17, 2011 11:26 AM UTC
    Posted on May 17, 2011 at 13:26

    I'm using USART3 in partial remap mode, also using flow control on a STM32F103RET6 (64LQFP, 512K/64K). Initialization code is similar to yours, I have the remap statement before the GPIO init. I have a GSM modem attached, works fine.

    Would look at GPIO-C clock. For the flow control to work you have to park the CAN controller off the RTS/CTS pins, otherwise it interferes with the operation (see errata)

    Finally after configuring the pins, enable the clock, then the USART

    ..

    else if (Uart->Port == USART3)

    {

    /* Enable USART3 Clock */

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);

    }

    USART_Cmd(Uart->Port, ENABLE); /* Enable the USART */

    ..

    What is the failure mode? Do you not see data on the Tx pin? Is the USART taking data and do you see the registers/status reflect changing internal state?

    -Clive

    kdeganck9
    kdeganck9Author
    Associate
    May 17, 2011 11:26 AM UTC
    Posted on May 17, 2011 at 13:26

    Domen,

    Thank you very much.

    Now it works.

    domen2
    Associate II
    May 17, 2011 11:26 AM UTC
    Posted on May 17, 2011 at 13:26

    AFIO clock?