cancel
Showing results for 
Search instead for 
Did you mean: 

STM3221G-EVAL : working with rs-232

mailmail9116
Associate II
Posted on November 29, 2012 at 11:54

Hi All ,

I am working with STM3221G-EVAL board, i loaded the STM32F2-F4_Demonstration fw ,that came with the board ,i am trying to work with RS-232 , for now using this fw.

when i am trying to type on the LCD and send something back to my pc,it does nothing at all,the settings of the hyperterminal and the settings of the board are identical.

the jumper (jp22) is set to rs232 as instructed in the manual.

what am i missing? what else should i configure ?any other jumper or something?

if there is any other example that relevant only for configuring rs232 and sending data ,it will be mostly appreciated .

Thanks

Michael

#rs-232
3 REPLIES 3
Posted on November 29, 2012 at 16:28

// STM32 USART3 (Tx PC.10, Rx PC.11) STM3221G-EVAL - sourcer32@gmail.com
#include ''stm32f2xx.h''
/**************************************************************************************/
void RCC_Configuration(void)
{
/* --------------------------- System Clocks Configuration -----------------*/
/* USART3 clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
/* GPIOC clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
}
/**************************************************************************************/
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*-------------------------- GPIO Configuration ----------------------------*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect USART pins to AF */
GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_USART3);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_USART3);
}
/**************************************************************************************/
void USART3_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;
/* USARTx configuration ------------------------------------------------------*/
/* USARTx configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
*/
USART_InitStructure.USART_BaudRate = 115200;
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_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure);
USART_Cmd(USART3, ENABLE);
}
/**************************************************************************************/
int main(void)
{
RCC_Configuration();
GPIO_Configuration();
USART3_Configuration();
while(1)
{
while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET); // Wait for Empty
USART_SendData(USART3, 0x49); // Send 'I'
}
while(1); // Don't want to exit
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mailmail9116
Associate II
Posted on December 02, 2012 at 11:51

Hi ,

Thanks

But i cannot compile the file,can you please maybe attach the whole project?

thanks

Posted on December 02, 2012 at 17:00

But i cannot compile the file,can you please maybe attach the whole project?

I don't have this board, or know what tool chain you have. Can you not clone an existing project, strip it down and merge the basic example.

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