AnsweredAssumed Answered

STM32F7 DISCOVERY NOT WORKING BECAUSE CONFLICT?

Question asked by Luong_Hong.Duy_Khanh on May 9, 2017
Latest reply on May 11, 2017 by Luong_Hong.Duy_Khanh

   Dear community, I am using STM32F746 Discovery and the IDE is Keil C. I have a problem with Keil C Compiler.
   My project have 2 parts:

      Part 1. Get pictures (BMP) from SD Card and print to LCD screen. It is working well.

      Part 2. Measure analog signal by ADC, get and save data from/to RTC , External Flash, then print the data to LCD screen. It is working well too.

 

   However, the problem is just only one part is working without the other part in my code. When i add both in my code, it is not work (just only SD Card is not work).

 

 Example:

A. Only part 1:

int main(void)
{

      System_Config();                           // Configure the System

      SD_BMP_LCD();         // PART 1 - INIT - then get bmp picture from sd card then show in LCD - WORK WELL

  //  ADC_RTC_EXFLASH_LCD();      // PART 2 - INIT - then ADC measure, get and save data f/t RTC and External Flash then show in LCD. NOT RUN, of course

}

Program Size: Code=31416 RO-data=49736 RW-data=256 ZI-data=104808  

---------------------------------------------------------------------------------------------------------------------------------------

 

B. Only part 2:

int main(void)
{

      System_Config();                           // Configure the System

   // SD_BMP_LCD();                           // PART 1 - NOT RUN, of course
      ADC_RTC_EXFLASH_LCD();      // PART 2 -  WORK WELL

}

Program Size: Code=129840 RO-data=49784 RW-data=296 ZI-data=103360  

---------------------------------------------------------------------------------------------------------------------------------------

 

C. Both part 1 and 2:

int main(void)
{

      System_Config();                           // Configure the System

      SD_BMP_LCD();                           // PART 1 - NOT WORK !?
      ADC_RTC_EXFLASH_LCD();      // PART 2 - WORK WELL

}

Program Size: Code=144036 RO-data=49980 RW-data=316 ZI-data=105020  

In this case, the SD Card cannot interface. Fatfs not work. f_mount, f_open, f_read return error result. However, LCD and other peripherals still working very good. Just only SD Card peripheral has a problem.

---------------------------------------------------------------------------------------------------------------------------------------

 

In other case, i changed my code as follow:

int main(void)
{

      System_Config();                           // Configure the System

      SD_BMP_LCD();                           // PART 1 - WORK WELL

      while(1);                                         // Add this forever loop to prevent program access to PART 2

      ADC_RTC_EXFLASH_LCD();     // PART 2 - NOT RUN, of course

}

Program Size: Code=31416 RO-data=49736 RW-data=256 ZI-data=104808  

 

>> Although i add both part 1 and 2 into the source code, the Code Size is only 31416 byte. It means PART 2 is not built into machine code. So i thought that the optimization setting have an affect to my code. The currently optimization is Level 3 (-O3) and Optimize for Time is checked.

---------------------------------------------------------------------------------------------------------------------------------------

 

So that, i change my code as follow

int main(void)
{

      System_Config();                           // Configure the System

      SD_BMP_LCD();                           // PART 1 - NOT WORK !?

 

      int i = 0;                                           // Add this function to prevent program access to PART 2, but focus to build PART 2

      HAL_Delay(100);

      if (i == 50)

       {

            ADC_RTC_EXFLASH_LCD();     // PART 2 - NOT RUN, of course

      }

}

Program Size: Code=144076 RO-data=49980 RW-data=316 ZI-data=105020

 

Now the Code size is 144076. It seems that both part 1 and 2 were build. But only part 1 is accessable, part 2 can not accessed. However, part 1 now work in this situation. !?!?!???

---------------------------------------------------------------------------------------------------------------------------------------

 

Besides, i changed startup_stm32f746xx.s (currently):

 

Stack_Size EQU 0x10000

Heap_Size EQU 0x10000

 

 

The orginal is:

 

Stack_Size EQU 0x400

Heap_Size EQU 0x800

 

I don't know what is the means of stack and heap size. So i just change for fun, just try, but no any happening in both situation.
Now, I am deadlocking after many times to try in other to make both part 1 and 2 work well. So i thought that i should be ask here. Anyone have any idea? I would be very happy if someone could comment on this topic.

Duy Khanh

Outcomes