USART2 problem....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-02 10:20 AM
i am trying to interface gsm module , I want to use USART2 and USART3 ...
but I am not getting how to do that can anyone suggest me ... thank you .. iam attaching the code i am using in the attachments . #rs232-discovery-max3232-usart #tldr- Labels:
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-02 10:35 AM
Figure out what pins you plan on using. Determine if the external peripherals need to connect at CMOS Serial levels, or RS232 levels.
Insufficient data here. STM32L USART3, tryUp 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
‎2013-05-02 10:40 AM
sorry , I think u ddnt see my attachment in this post ...
iam attaching my program file here .. ________________ Attachments : yogesh.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzZg&d=%2Fa%2F0X0000000bNj%2FVxmca7uQTMvJvT.IeSCxWIpIcrCTDS.1vo9FZSOcAPY&asPdf=false- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-02 10:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-02 10:48 AM
If you're using PB10/11, then you'll need to enable the GPIOB clock also.
Enable APB1 clocks for USART2 and USART3Up 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
‎2013-05-02 11:02 AM
sorry , I think u ddnt see my attachment in this post ...iam attaching my program file here ..
Sorry, I saw, a lot to wade through. Doesn't really describe the connectivity, and failure. The STM32L-Discovery has no serial ports attached, need to be more explicit about how this is wired up, and to what (part#, pin designations, not generic description). Should have this separate from code, ie summary. Try to evaluate USART function outside core application, then integrate.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
‎2013-05-02 11:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-02 11:12 AM
From other thread, blind mod for USART2
// sourcer32@gmail.com - STM32L15x USART2 Demo 9600 8N1
#include ''stm32l1xx.h''
void main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
/* Assumes CMSIS and SystemInit() set up clocks before calling main() */
/* Enable GPIO A clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
/* Enable USART2 clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
/* Configure USART Rx & Tx as alternate function */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Mux out USART2 Rx & Tx */
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_USART2); // PA2 USART2_TX
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_USART2); // PA3 USART2_RX
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_None;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
/* USART configuration */
USART_Init(USART2, &USART_InitStructure);
/* Enable USART */
USART_Cmd(USART2, ENABLE);
while(1)
{
while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET); /* Waitwhile TX full */
USART_SendData(USART2, 0xAA);
}
}
Up vote any posts that you find helpful, it shows what's working..
