two USART configuration failed (USART3 problem)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 6:27 AM
Hi,
Here is my code for configuring two different usart but my USART3 doesn't work properly and USART2 works fine.(I remap both of them). what is my mistake that I didn't pay attention?
Problem: I don't have any signal on USART3_TX pin when I send a char. however my USART1 works fine(send and receive)
USART_InitTypeDef USARTConfiguration;
GPIO_InitTypeDef GPIOS; RCC_APB2PeriphClockCmd(RCC_APB1Periph_USART2|RCC_APB1Periph_USART3|RCC_APB2Periph_GPIOD |RCC_APB2Periph_GPIOC |RCC_APB2Periph_AFIO,ENABLE); GPIO_PinRemapConfig(GPIO_Remap_USART2|GPIO_PartialRemap_USART3,ENABLE); GPIOS.GPIO_Mode=GPIO_Mode_AF_PP ; GPIOS.GPIO_Speed=GPIO_Speed_50MHz; GPIOS.GPIO_Pin=GPIO_Pin_5; GPIO_Init(GPIOD,&GPIOS); GPIOS.GPIO_Mode=GPIO_Mode_IN_FLOATING ; GPIOS.GPIO_Pin=GPIO_Pin_6; GPIO_Init(GPIOD,&GPIOS); USARTConfiguration.USART_BaudRate=9600; USARTConfiguration.USART_StopBits=USART_StopBits_1; USARTConfiguration.USART_WordLength=USART_WordLength_8b; USARTConfiguration.USART_Parity=USART_Parity_No ; USARTConfiguration.USART_HardwareFlowControl=USART_HardwareFlowControl_None; USARTConfiguration.USART_Mode=USART_Mode_Rx | USART_Mode_Tx; USART_Init(USART2,&USARTConfiguration); USART_ITConfig(USART2,USART_IT_RXNE,ENABLE); NVIC_EnableIRQ(USART2_IRQn); USART_Cmd(USART2,ENABLE); GPIOS.GPIO_Mode=GPIO_Mode_AF_PP ; GPIOS.GPIO_Speed=GPIO_Speed_50MHz; GPIOS.GPIO_Pin=GPIO_Pin_10; GPIO_Init(GPIOC,&GPIOS); GPIOS.GPIO_Mode=GPIO_Mode_IN_FLOATING ; GPIOS.GPIO_Pin=GPIO_Pin_11; GPIO_Init(GPIOC,&GPIOS); USARTConfiguration.USART_BaudRate=9600; USARTConfiguration.USART_StopBits=USART_StopBits_1; USARTConfiguration.USART_WordLength=USART_WordLength_8b; USARTConfiguration.USART_Parity=USART_Parity_No ; USARTConfiguration.USART_HardwareFlowControl=USART_HardwareFlowControl_None; USARTConfiguration.USART_Mode=USART_Mode_Rx | USART_Mode_Tx; USART_Init(USART3,&USARTConfiguration); USART_Cmd(USART3,ENABLE);Thanks in advance.
#context-context-contextSolved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 7:32 AM
Thanks for your comment.
You are correct and I did some mistake when I wanted to copy my source code , I fix the above problem but still it doesn't work
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2|RCC_APB1Periph_USART3,ENABLE);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 7:05 AM
RCC_
APB2
PeriphClockCmd (RCC_APB1
Periph_USART2|RCC_APB1
Periph_USART3|RCC_APB2Periph_GPIOD |RCC_APB2Periph_GPIOC |RCC_APB2Periph_AFIO,ENABLE);Different buses, doesn't match.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 7:32 AM
Thanks for your comment.
You are correct and I did some mistake when I wanted to copy my source code , I fix the above problem but still it doesn't work
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2|RCC_APB1Periph_USART3,ENABLE);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 8:26 AM
Hi,
Thanks for your contribution
I split each line with different lines but it doesn't work again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 8:55 AM
I don't think you can combine these, split them up
GPIO_PinRemapConfig(GPIO_Remap_USART2|GPIO_PartialRemap_USART3,ENABLE);
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 9:12 AM
Thanks dear friends for your contribution and sorry for taking your time
It was my fault that I have reconfigured port c in other part my my program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-01 9:32 AM
What part specifically are you using? Have you reviewed the Data Sheet and Reference Manuals to make sure the pins and remapping are correct?
Is this some custom board, or one we should be familiar with? Does anything clash at a pin level that might cause them not to function?
Post complete testable code as currently compiling.
#context%20context%20context
‌Up vote any posts that you find helpful, it shows what's working..
