Hallo zusammen, ich versuche gerade meinen stm32f302r8 zum laufen zu bringen. Ich verwende CubeMX für die Pin Konfiguration und die IDE SW4STM32. Wenn ich die pins versuche zu konfigurieren, wird eclipse normal geöffnet aber die Konfiguration nicht übernommen. Das erkenne ich daran, dass in der main.h sonst per #define die Pins definiert wurden die ich konfiguriert habe. Im Anhang meine ioc Datei.
Was passiert wenn du die main.h löschst? Wird sie neu angelegt? Sicher dass CubeMX den generierten Code im richtigen Verzeichnis anlegt? Startest du die Code-Generierung überhaupt nach Änderung der Konfiguration... ;-)
Ja, davon gehe ich aus weil die main.h Datei nach dem generieren wieder erstellt wird, allerdings leer: Die main.h sieht so aus: /** ************************************************************************ ****** * @file : main.h * @brief : Header for main.c file. * This file contains the common defines of the application. ************************************************************************ ****** ** This notice applies to any and all portions of this file * that are not between comment pairs USER CODE BEGIN and * USER CODE END. Other portions of this file, whether * inserted by the user or by software development tools * are owned by their respective copyright owners. * * COPYRIGHT(c) 2018 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ************************************************************************ ****** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef _MAIN_H_ #define _MAIN_H_ /* Includes ------------------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ /* Private define ------------------------------------------------------------*/ /* ########################## Assert Selection ############################## */ /** * @brief Uncomment the line below to expanse the "assert_param" macro in the * HAL drivers code */ /* #define USE_FULL_ASSERT 1U */ /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ #ifdef __cplusplus extern "C" { #endif void _Error_Handler(char *, int); #define Error_Handler() _Error_Handler(_FILE_, _LINE_) #ifdef __cplusplus } #endif #endif /* _MAIN_H_ */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ ich vermisse daher die #define befehle für die konfigurierten Pins.
Die #defines in der main.h bekommst du, wenn du deinen GPIOs in CubeMX unter "Configuration"->"GPIO" ein "User label" zuweist, das ist aber nur ein Alias. Die eigentliche GPIO-Konfiguration landet als MX_GPIO_Init() in der main.c
Ok das wusste ich nicht, danke für die Info. Das mit dem #define hab ich überprüft indem ich einen GPIO gelabelt habe und siehe da, es funktioniert. Allerdings kann ich mittlerweile nicht mehr compilieren. Ich bekomme einfach nur ein rotes x ohne Fehlermeldung angezeigt. Neu starten und ein und ausstöpseln nicht schonmal nicht. Übrigens hab ich die Fehlermeldung auch wenn der stm32 nicht angeschlossen ist. Ne Ahnung was das sein könnte ?
Marco D. schrieb: > Ne Ahnung was das sein könnte ? Das Übliche. Du hast ihm in CubeMX das SWD abgeschaltet.
Wenn du es zum Laufen bekommen hast, könntest du mal versuchen, in Cube etwas am Setup zu verändern. Dabei drauf achten, dass dein Code immer zwischen den User code begin und user code end packst, sonst löscht cube deinen Code nämlich. Was dann nämlich nach der Änderung interessant wäre, ob die ganzen inits noch da sind. Ich hatte das Problem, dass ich ein Projekt mit Display fürs f746disco erstellt hab. Dann wollt ich im Nachhinein noch nen ADC mit im Boot haben. Also in Cube den ADC dazu geklickt in SW4STM32 aktualisiert, und plötzlich waren alle Inits rot ausser den neu zugekommenen vom ADC
pegel schrieb: > Marco D. schrieb: >> Ne Ahnung was das sein könnte ? > > Das Übliche. > Du hast ihm in CubeMX das SWD abgeschaltet. Auch wenn er gar keinen STM dran hat, kommt der Fehler beim Compilieren? Marco D. schrieb: > Übrigens hab ich > die Fehlermeldung auch wenn der stm32 nicht angeschlossen ist.
Beim compilieren? Dann mach mal ein Index->Rebuild
Mittlerweile taucht ein neuer Fehler beim compilieren auf: Polling target STM32F302R8Tx.cpu failed, trying to reexamine. Keine Ahnung was mit meinem PC bzw. dem STM32 abgeht, hab eig nur mehrmals CUbeMX und SW4STM32 neu installiert und mehrere Workspaces und Projekte ausprobiert. Hab in den Projekten bzw. in der main keine Zeile code stehen. Ich kompiliere nur direkt nachdem ich auf "generate source code based on user settings" ausgeführt habe. Das SW4STM32 öffnet sich dann ja automatisch.
Dann kannst du probieren die CubeMX Grundeinstellungen zu verwenden. Ich habe mal die .ioc angehängt. Probier damit mal ein Projekt zu erstellen.
Yippie !! Es funktioniert, vielen vielen Pegel. Scheint wirklich an den CubeMX Einstellungen gelegen zu haben.
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.