2022-09-05 10:08 PM
I have a STM32F7508-DK board and I'm using the last version of the STM32CubeIDE and TouchGFX.
I create a project in TouchGFX (or open one of the examples that are there) -> generate code -> open project in STM32CubeIDE -> compile -> run -> works fine.
Now in STM32CubeIDE I want to generate separate c and h files for each of the periphery. I open Device Configuration Tool -> Project Manager tab -> Code Generator -> and select Generate peripheral initialization as a pair of '.c /' h ' files per peripheral -> generate code again -> compile -> run -> doesn't work, black screen on the board. I don't change anything in the code, I only select the option to generate separate files.
Could someone please help me where can be problem?
Solved! Go to Solution.
2022-09-06 03:18 AM
Hello @TGrot.1
Actually this is a known issue and it's the subject of an internal ticket.
I'll keep you posted with the updates.
Internal ticket number: 125071 (This is an internal tracking number and is not accessible or usable by customers).
Kind regards,
Semer.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-09-06 12:21 AM
>Could someone please help me where can be problem?
Are there any warnings youre not paying attention to?
when i do this (separate .c and.h files) sometimes i need to declare structs as external or include the corresonding .h files in some unexpected places
2022-09-06 03:18 AM
Hello @TGrot.1
Actually this is a known issue and it's the subject of an internal ticket.
I'll keep you posted with the updates.
Internal ticket number: 125071 (This is an internal tracking number and is not accessible or usable by customers).
Kind regards,
Semer.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-11-02 11:36 AM
I'd like to throw a "me too" into this conversation.
I switched over to pairs of files and my project wouldn't even compile anymore. It's especially useful in that the FreeRTOS stuff gets split out into its own file too, very useful for real projects, not just sample code. There's nothing worse for maintenance than a project that is all stored in one huge file.
2023-10-11 03:45 PM - edited 2023-10-11 03:48 PM
After one year I want to share the solution :grinning_face:. Problem is in fmc.c file. There is missing section:
/* USER CODE BEGIN FMC_Init 2 */
BSP_SDRAM_DeInit();
if(BSP_SDRAM_Init() != SDRAM_OK)
{
Error_Handler();
}
/* USER CODE END FMC_Init 2 */
Also is nessesery add include at the top.
#include "stm32f7508_discovery_sdram.h"
It may look different in other boards. Unfortunately, you have to compare the old main.c with the new generated files and look for differences.
2024-04-15 06:34 AM - edited 2024-04-22 10:58 PM
Its April 2024 and this is still an issue in the latest version of CubeIDE.
When generating a project in TouchGFX default setting for "Generate peripheral initialization as a pair of '.c /' h ' files per peripheral" is unchecked/false. All initialization is packed into the main file. In some intialization functions TouchGFX generates also the /* USER CODE */ sections.
When checking peripheral initialization as a pair of '.c /' h ' files those /* USER CODE */ sections will not be transfered out of the main.c to the new peripherial.c file. So use a file compare tool and copy the section form main.c to the peripherial.c.
See details for STM32H735-DK in next post.
Feel free to check out my unresolved issues with STM32H7 and CANFD
H723 FDCAN1 and FDCAN2 - STMicroelectronics Community
Thank You!
2024-04-22 12:19 PM - edited 2024-04-22 12:24 PM
In case of the STM32H735-DK code is missing, when switching to "generate pair of .c and .h files", so here is a workaround.
in TouchGFX
in CubeIDE
void MX_OCTOSPI1_Init(void)
void MX_OCTOSPI2_Init(void)
with the "copy_main.c" functions of the same name
/* USER CODE BEGIN 0 */
// ---------------------------------------------------
// added for generate pair of .c and .h files
#include "stm32h735g_discovery_ospi.h"
// ---------------------------------------------------
/* USER CODE END 0 */
/* OCTOSPI1 init function */
void MX_OCTOSPI1_Init(void)
{
/* USER CODE BEGIN OCTOSPI1_Init 0 */
// ---------------------------------------------------
// added for generate pair of .c and .h files
BSP_OSPI_NOR_Init_t ospi_nor_int;
// ---------------------------------------------------
/* USER CODE END OCTOSPI1_Init 0 */
/* USER CODE BEGIN OCTOSPI1_Init 2 */
// ---------------------------------------------------
// added for generate pair of .c and .h files
HAL_OSPI_DeInit(&hospi1);
ospi_nor_int.InterfaceMode = BSP_OSPI_NOR_OPI_MODE;
ospi_nor_int.TransferRate = BSP_OSPI_NOR_DTR_TRANSFER;
BSP_OSPI_NOR_DeInit(0);
if(BSP_OSPI_NOR_Init(0, &ospi_nor_int) != BSP_ERROR_NONE)
{
Error_Handler();
}
if(BSP_OSPI_NOR_EnableMemoryMappedMode(0) != BSP_ERROR_NONE)
{
Error_Handler();
}
// ---------------------------------------------------
/* USER CODE END OCTOSPI1_Init 2 */
/* OCTOSPI2 init function */
void MX_OCTOSPI2_Init(void)
{
/* USER CODE BEGIN OCTOSPI2_Init 0 */
// ---------------------------------------------------
// added for generate pair of .c and .h files
BSP_OSPI_RAM_Init_t ospi_ram_init;
// ---------------------------------------------------
/* USER CODE END OCTOSPI2_Init 0 */
/* USER CODE BEGIN OCTOSPI2_Init 1 */
// ---------------------------------------------------
// added for generate pair of .c and .h files
OSPI_HyperbusCmdTypeDef sCommand = {0};
OSPI_MemoryMappedTypeDef sMemMappedCfg = {0};
// ---------------------------------------------------
/* USER CODE END OCTOSPI2_Init 1 */
/* USER CODE BEGIN OCTOSPI2_Init 2 */
// ---------------------------------------------------
// added for generate pair of .c and .h files
sCommand.AddressSpace = HAL_OSPI_MEMORY_ADDRESS_SPACE;
sCommand.AddressSize = HAL_OSPI_ADDRESS_32_BITS;
sCommand.DQSMode = HAL_OSPI_DQS_ENABLE;
sCommand.Address = 0;
sCommand.NbData = 1;
if (HAL_OSPI_HyperbusCmd(&hospi2, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
sMemMappedCfg.TimeOutActivation = HAL_OSPI_TIMEOUT_COUNTER_DISABLE;
if (HAL_OSPI_MemoryMapped(&hospi2, &sMemMappedCfg) != HAL_OK)
{
Error_Handler();
}
// ---------------------------------------------------
/* USER CODE END OCTOSPI2_Init 2 */
Cheers!
Feel free to check out my unresolved issues with STM32H7 and CANFD
H723 FDCAN1 and FDCAN2 - STMicroelectronics Community
Thank You!