Hallo, ich versuche gerade vergebens über die serielle Schnittstelle Daten mit meinem STM32F4 zu senden. Ich möchte eine Baudrate von 115200 Baud verwenden aber irgendwie kommen da nur komische Zeichen an. Wenn ich auf eine andere Baudrate umstelle funktioniert alles. Code sieht wie folgt aus: GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_USART1); GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_USART1); // TX pin GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); //RX pin GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); USART_InitTypeDef USART_InitStructure; USART_OverSampling8Cmd(USART1, ENABLE); USART_InitStructure.USART_BaudRate = 57600; 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(USART1, &USART_InitStructure); USART_Cmd(USART1, ENABLE); Ich habe auch OverSampling eingestellt hat aber nichts geändert. Kann mir da bitte jemand weiterhelfen?
OK da war ich wohl zu voreilig :) Jetzt funktionierts, folgende Initialisierungen haben gefehlt: GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; Grüße
STM schrieb: > // TX pin > GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; STM schrieb: > //RX pin > GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; Hmm...
STM schrieb: > Ich möchte eine Baudrate von 115200 Baud > verwenden aber irgendwie kommen da nur komische Zeichen an. STM schrieb: > USART_InitStructure.USART_BaudRate = 57600; Hmm...
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.