2024-05-27 12:07 PM - last edited on 2024-05-30 03:06 PM by Tesla DeLorean
Hello all,
I am developing with a STM32F429bit6 by STM32CUBEIDE v1.15.1 and TouchGfx v4.23.2. The LCD display works well. The screen layout is portrait.
However, when I moved the images to the SPI flash (w25q64), the display was crashed.
The changes are as below:
void DataReader_WaitForReceiveDone() {
return;
}
void DataReader_ReadData(uint32_t address24, uint8_t *buffer, uint32_t length) {
W25Q_Read(address24, 0, length, buffer);
}
void DataReader_StartDMAReadData(uint32_t address24, uint8_t *buffer, uint32_t length) {
W25Q_Read(address24, 0, length, buffer);
}
Solved! Go to Solution.
2024-05-30 03:05 PM
Couple of thoughts.
The page size is 256-bytes, make sure it writes suitably aligned blocks (address and length), so they don't span across boundaries. Wait for completion of PAGE WRITE
Make sure to mask the address passed to the memory. The memory has a zero-basis, it doesn't under stand anything about 0x90000000, that's an STM32 side decode range
ie
.Address = Addr & 0x0FFFFFFF; // 28-bit address
2024-05-27 01:04 PM
Validate the data readable on the STM32 side matches the data on the PC side.
2024-05-27 05:49 PM
Hello Telsa,
Thanks for your replay. When I verified the flash by the STM32CubeProgrammer, I got the the data dismatched.
Data mismatch found at address 0x90004400 (byte = 0xF8 instead of 0x8C)
But the data value (0x8C) in the flash is correct.
The below is the verify code in the Loader_Src.c
uint64_t Verify(uint32_t MemoryAddr, uint32_t RAMBufferAddr, uint32_t Size, uint32_t missalignement) {
__set_PRIMASK(0); // enable interrupts
uint32_t VerifiedData = 0, InitVal = 0;
uint64_t checksum;
Size *= 4;
uint8_t Buffer[2];
uint32_t posBuf;
checksum = CheckSum((uint32_t)MemoryAddr + (missalignement & 0xf), Size - ((missalignement >> 16) & 0xF), InitVal);
while (Size > VerifiedData) {
flash_ReadMemory(MemoryAddr + VerifiedData, 2, Buffer);
posBuf = 0;
while ((Size > VerifiedData) && (posBuf < 1024)) {
if (Buffer[posBuf] != *((uint8_t *)RAMBufferAddr + VerifiedData)) {
__set_PRIMASK(1); // disable interrupts
return ((checksum << 32) + MemoryAddr + VerifiedData);
}
posBuf++;
VerifiedData++;
}
}
__set_PRIMASK(1); // disable interrupts
return (checksum << 32);
}
2024-05-27 07:18 PM
The suggestion was to validate content at the application level.
2024-05-30 02:56 PM
I have moved the function to an application. And it can run successfully. However, when I tested it as a stldr, it failed to verify with a bigger size file (500K).
The error message is Error: Data mismatch found at address 0x90000A00 (byte = 0xA8 instead of 0x01)
I compared the file with the memory as below. The wrong section address is from 0x9000_0A00 to 0x9005_F5FF.
The first error data is 0x8F5BB4A8, which can be found in the bin file while the address is 0x9006_2800 rather than 0x9000_0A00.
So it seems some blocks data were wrotten to wrong place. Howerver, accroding to the serial port output, there is not error or wrong operations during downloanding. May I know how can fix it? Thanks.
[2024-05-30 16:28:52.269]# RECV ASCII>
Init app...
[2024-05-30 16:29:02.764]# RECV ASCII>
Init app...
[2024-05-30 16:29:02.873]# RECV ASCII>
Write: 90000000(66816)
[2024-05-30 16:29:06.028]# RECV ASCII>
Write: 90010500(66816)
[2024-05-30 16:29:09.162]# RECV ASCII>
Write: 90020A00(66816)
[2024-05-30 16:29:12.328]# RECV ASCII>
Write: 90030F00(66816)
[2024-05-30 16:29:15.469]# RECV ASCII>
Write: 90041400(66816)
[2024-05-30 16:29:18.601]# RECV ASCII>
Write: 90051900(66816)
[2024-05-30 16:29:21.754]# RECV ASCII>
Write: 90061E00(61696)
[2024-05-30 16:29:24.658]# RECV ASCII>
Write: 90070F00(61696)
[2024-05-30 16:29:52.109]# RECV ASCII>
Init app...
[2024-05-30 16:29:52.231]# RECV ASCII>
Read: 90000000(133632)
[2024-05-30 16:29:53.167]# RECV ASCII>
Init app...
[2024-05-30 16:29:53.275]# RECV ASCII>
Read: 90020A00(133632)
[2024-05-30 16:29:54.210]# RECV ASCII>
Init app...
[2024-05-30 16:29:54.320]# RECV ASCII>
Read: 90041400(133632)
[2024-05-30 16:29:55.251]# RECV ASCII>
Init app...
[2024-05-30 16:29:55.390]# RECV ASCII>
Read: 90061E00(123392)
2024-05-30 03:05 PM
Couple of thoughts.
The page size is 256-bytes, make sure it writes suitably aligned blocks (address and length), so they don't span across boundaries. Wait for completion of PAGE WRITE
Make sure to mask the address passed to the memory. The memory has a zero-basis, it doesn't under stand anything about 0x90000000, that's an STM32 side decode range
ie
.Address = Addr & 0x0FFFFFFF; // 28-bit address