2011-08-16 07:27 PM
Hello there, i am having problems setting up USART3 on my STM32f103c8t6 chip. there seems to be nothing wrong with the code, but the tx pin does not seem to be functioning at all.
I have tried my code on a STM32f103rb chip on a development board using the exact same settings (except selecting ''STM32f103RB'' as device as oppose to using ''STM32f103C8'') and using a oscilliscope to check if anything is happening on the Tx pin.
So far, on the STM32f103RB chip, i am able to see signals being generated, however i can't see any changes on the STM32f103C8 chip. I know that the C8 chip is working and that the USART3 is working (on a precompiled hex file, so i don't have the source code) and i have tried on a few of the same boards with same chips.
any feedback would be appreciated. thanks
Specs are:
-programming using Keil uVision 4.14
-using ST-Link utility to communicate
-Windows 7
Source Code:
================================
/* Includes ------------------------------------------------------------------*/
#include ''stm32f10x_lib.h''
#include ''platform_config.h''
typedef enum { FAILED = 0, PASSED = !FAILED} TestStatus;
USART_InitTypeDef USART_InitStructure;
TestStatus TransferStatus = FAILED;
ErrorStatus HSEStartUpStatus;
void RCC_Configuration(void);
void GPIO_Configuration(void);
void NVIC_Configuration(void);
int main(void)
{
RCC_Configuration();
NVIC_Configuration();
GPIO_Configuration();
USART_InitStructure.USART_BaudRate = 1200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_Odd;
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);
while(1)
{
USART_SendData(USART3, 0xDD);
}
}
void RCC_Configuration(void)
{
RCC_DeInit();
RCC_HSEConfig(RCC_HSE_ON);
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS)
{
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
FLASH_SetLatency(FLASH_Latency_2);
RCC_HCLKConfig(RCC_SYSCLK_Div1);
RCC_PCLK2Config(RCC_HCLK_Div1);
RCC_PCLK1Config(RCC_HCLK_Div2);
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
RCC_PLLCmd(ENABLE);
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
while(RCC_GetSYSCLKSource() != 0x08)
{
}
}
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
}
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
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);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
2011-08-18 07:35 AM
The forum doesn't work right with FireFox 6.
Try this, USART3, 1200 8N1 :020000040800F2 :1000000000040020450100087D0200086D02000880 :100010007902000899010008BB04000800000000F4 :100020000000000000000000000000005B0300086A :10003000B701000800000000810200085D0300080D :10004000BF0400087F0200085F0300085103000896 :10005000C70100084D030008B9010008BD010008F0 :10006000BF010008C1010008C3010008A101000888 :10007000A3010008A5010008A7010008A9010008C4 :10008000AB010008AD01000895010008B7040008A5 :10009000B90400089D0100089F010008C50100087F :1000A0006103000867030008650300086303000894 :1000B000690300086B0300086D0300087302000861 :1000C0007102000877020008750200085503000855 :1000D0005703000881030008830300088503000814 :1000E000BB0100084F030008B504000875030008B1 :1000F0007B030008790300087703000897010008D4 :10010000C9010008530300086F03000859030008E1 :100110007D0300087F0300087103000873030008D3 :10012000AF010008B1010008B3010008B5010008E3 :10013000DFF80CD000F01CF800480047E10400088C :1001400000040020004800473101000840EA010394 :100150009B0703D009E008C9121F08C0042AFAD27D :1001600003E011F8013B00F8013B521EF9D2704741 :10017000064C074D06E0E06840F0010394E80700F4 :1001800098471034AC42F6D3FFF7D6FF5805000865 :10019000680500087047704700BFFEE7704770476A :1001A0007047704770477047704770477047704797 :1001B0007047704770477047704770477047704787 :1001C000704770477047704770470000F0B5CB78B4 :1001D0000022DC0603F00F0301D58C7823430C8842 :1001E0000F2714F0FF0F4FF0010C1CD0D0F8005077 :1001F0000E880CFA02F42640A64210D1960007FAA7 :1002000006FE25EA0E0E03FA06F5CE7845EA0E053F :10021000282E00D14461CE78482E00D10461521CB2 :10022000082AE5D305600A88FF2A1ED945680022FE :1002300002F108060CFA06F40E882640A64210D1F8 :10024000960007FA06FE25EA0E0E03FA06F5CE78AA :1002500045EA0E05282E00D14461CE78482E00D103 :100260000461521C082AE3D34560F0BD00BFFEE7DD :10027000704770477047704700BFFEE77047704790 :1002800070470000044A0029D16901D0014300E011 :100290008143D1617047000000100240044A0029E8 :1002A000916901D0014300E08143916170470000F2 :1002B000001002407047000030B5204A5168204BC2 :1002C00011F00C0103D0042901D0082901D00360EA :1002D00011E05168022401F4701104EB914154685B :1002E000184D14F4803F02D05468A40301D569432B :1002F00000E0594301605168134B01F0F001090916 :100300005C5C0168E1404160546804F4E064240AE4 :100310001C5D21FA04F48460546804F46054E40A17 :100320001B5DD940C1605268074B02F44042920BFA :100330001B1F9A5CB1FBF2F1016130BD001002405D :1003400000127A0000093D00480500087047704718 :1003500070477047704770477047704770477047E5 :1003600070477047704770477047704770477047D5 :1003700070477047704770477047704770477047C5 :100380007047704770470029818902D041F40051BD :1003900001E021F4005181817047000000B585B073 :1003A00001210820FFF77AFF4FF48060ADF81000BC :1003B0004FF018008DF813004FF003008DF8120075 :1003C00004A91848FFF702FF4FF40060ADF81000D1 :1003D0004FF004008DF8130004A91248FFF7F6FE51 :1003E0004FF4966000904FF00000ADF80400ADF8B7 :1003F0000600ADF80800ADF80C004FF00C00ADF8A9 :100400000A004FF001014FF48020FFF73BFF6946DF :10041000054800F00BF801210348FFF7B4FF05B0D1 :1004200000BD0000000C01400048004030B504460B :10043000008A85B00D464CF6FF710840E9880143FB :100440002182A0894EF6F3110840A9882A89114318 :100450006A8902431143A181A08A4FF6FF410840F7 :10046000A9890143A1826846FFF726FF104884420C :1004700001D1039800E002981921484329686422B9 :100480008900B0FBF1F0B0FBF2F109010B096FF04C :1004900018056B43322500EB830005EB0010B0FB21 :1004A000F2F000F00F000843208105B030BD0000DD :1004B0000038014070477047704700BFFEE7704743 :1004C00002E008C8121F08C1002AFAD1704770471D :1004D000002001E001C1121F002AFBD1704700007B :1004E00088B04FF020020DA16846FFF72FFEFFF7FE :1004F000E1FEFFF753FF10E06C460BE000BF0F4832 :10050000008810F0400FFAD020780D49088004F1DF :100510000100044620780028F0D1EDE757656C63B0 :100520006F6D6520746F20776865726576657220DF :10053000796F75206172652E2E2E000000480040F4 :100540000448004002040608000000000102030401 :1005500001020304060708096805000800000020DE :0805600000040000D0040008B3 :0400000508000131BD :00000001FF