Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USART3 Remapping on PA13 PA14 #93

Open
PL125 opened this issue Aug 24, 2024 · 1 comment
Open

USART3 Remapping on PA13 PA14 #93

PL125 opened this issue Aug 24, 2024 · 1 comment

Comments

@PL125
Copy link

PL125 commented Aug 24, 2024

Hi, I'm trying to remap USART3 to use pins PA13 and PA14 of a CH32V305FBP6, however it doesn't seem to be taking effect.

void UART_Config(uint32_t baudrate) {
    USART_InitTypeDef USART_InitStructure = {};
    GPIO_InitTypeDef  GPIO_InitStructure = {
        .GPIO_Speed = GPIO_Speed_50MHz,
    };

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOA, ENABLE);
    GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);

    GPIO_PinRemapConfig(GPIO_FullRemap_USART3, ENABLE);
    //GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE);
    //GPIO_PinRemapConfig(GPIO_PartialRemap1_USART3, ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_Init(GPIOA, &GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    GPIO_Init(GPIOA, &GPIO_InitStructure);

    USART_InitStructure.USART_BaudRate = baudrate;
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    USART_InitStructure.USART_StopBits = USART_StopBits_1;
    USART_InitStructure.USART_Parity = USART_Parity_No;
    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
    USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;

    USART_Init(USART3, &USART_InitStructure);

    USART_Cmd(USART3, ENABLE);
}
@qiyongshuang
Copy link
Collaborator

The (10b PA13 PA14) partial remapping function is not
supported for lot numbers where the fifth digit of
the lot number is less than 2 and the penultimate
sixth digit of the lot number is 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants