2016-02-22 09:48 PM
I use stm32f407zg and stemwin library and freertos.
when I want load BMP , my microcontroller gose to HardFault after put some pixel on lcd( about half or less).FRESULT resultBMP;unsigned char _acBuffer[4096];FIL * phFile;FIL imageFile;uint32_t NumBytesRead;int _GetDataSD(void * p, const U8 ** ppData, uint16_t NumBytesReq, U32 Off) { phFile = (FIL *)p; // Check buffer size if (NumBytesReq > sizeof(_acBuffer)) { NumBytesReq = sizeof(_acBuffer); } // Set file pointer to the required position resultBMP = f_lseek(phFile, Off); // Read data into buffer resultBMP = f_read(phFile, _acBuffer, NumBytesReq, (uint32_t *)&NumBytesRead); if(NumBytesRead < NumBytesReq) f_close(phFile); // Set data pointer to the beginning of the buffer *ppData = _acBuffer; // Return number of available bytes return NumBytesRead; }////////////////////////////////////////////////////////////////////////////////////////////////////================================================================================================//////////////////////////////////////////////////////////////////////////////////////////////////void MyGui_Draw(char * sFilename){ resultBMP = f_open(&imageFile, sFilename , FA_READ); if(resultBMP == FR_OK) GUI_BMP_DrawEx(_GetDataSD, &imageFile,100,100); f_close(&imageFile); }