AnsweredAssumed Answered

the problem of STM32F417 about the Internal Buffer defined in SDRAM memory

Question asked by lin.joey on Oct 18, 2015
Latest reply on Oct 21, 2015 by Clive One
Hello,
I have a STM32F4-EVB-V2 Board with MCU STM32F417IGH6. I want to display a BMP picture from SDcard to TFT LCD. So I have used an example "Display/LTDC_PicturesFromSDCard" from one of the  STM324xG_EVAL's application. The function has been written as following:


void readBmpFile(uint8_t *Address, const char* BmpName)
{
     uint32_t index = 0, size = 0, i1 = 0;
  uint32_t BmpAddress;
     
  if (f_mount(0, &filesystem) != FR_OK) {
          LCD_DisplayStringLine(LCD_LINE_1, (uint8_t *) "Could not open filesystem!");
  }
  Delay(10);          
     ret = f_open(&myFile, BmpName, FA_READ);     




     if (ret) {
          LCD_DisplayStringLine(LCD_LINE_2, (uint8_t *) "Not exist file!");
  }else{
          LCD_DisplayStringLine(LCD_LINE_2, (uint8_t *) "The file content:");
    ret = f_read(&myFile, sector, 16, (UINT *)&BytesRead);//30
       BmpAddress = (uint32_t)sector;
     
       /* Read bitmap size */
    size = *(uint16_t *) (BmpAddress + 2);
    size |= (*(uint16_t *) (BmpAddress + 4)) << 16;  
 
    /* Get bitmap data address offset */
    index = *(uint16_t *) (BmpAddress + 10);
    index |= (*(uint16_t *) (BmpAddress + 12)) << 16; 
          f_close(&myFile);
          f_open(&myFile, BmpName, FA_READ);     
          
          do{
      if (size < 256*2){
        i1 = size;
      }else{
        i1 = 256*2;
      }
      size -= i1;
      f_read (&myFile, sector, i1, (UINT *)&BytesRead);




      for (index = 0; index < i1; index++)
      {
        *(__IO uint8_t*) (Address) = *(__IO uint8_t *)BmpAddress;
      
        BmpAddress++;  
        Address++;
      }  
    
      BmpAddress = (uint32_t)sector;
    } while (size > 0);     
          
          LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *) "Close the file.");
    ret = f_close(&myFile);
          if (ret) {
               LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *) "Close file error?");
    }else{
               LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *) "Close correctly.");
          }
    
  }
}


and 
uint8_t *uwInternelBuffer;
int  main()
{
uwInternelBuffer = (uint8_t *)0xC0260000;
..........
  readBmpFile(uwInternelBuffer, Bmpfile);
  LCD_DrawBitmap(0,0, uwInternelBuffer);

Everytime, the process goes to "Address++", the program is broken down! 


Is there someone can help me? Thank you very much.

Outcomes