2024-09-17 02:44 AM - edited 2024-09-17 03:50 AM
Hello,
I want to write and read large size data to external QSPI flash memory. I worked on an external loader for Cubeprogrammer and small data reading, writing or flash deletion operations. But when I try to read bytes 0x400000 from address 0x00000000 for example, it doesn't work. Because RAM is not enough for this job.
int Read(uint32_t address, uint32_t size, uint8_t* buffer)
Cubeprogrammer is sending size 0x400000 and it is correct. But the buffer size is not enough. If the buffer is not enough for this job, I just want to split the size and buffer.
Cube programmer reading -> 0x400000
divide :
int Read(0x00000000, 1024, buffer);
int Read (0x00000100, 1024, buffer+1024);
int Read (0x00000200, 1024, buffer+2048);
can i do this? I don't want to use memory map mode because I don't want to use only the read function. Read, write, erase sector or flash, calculate crc etc. I want to use functions.
see second picture 40000₁₆ = 262144₁₀ but cubeprogrammer sending max ram size value 221696₁₀ = 36200₁₆
Solved! Go to Solution.
2024-09-20 05:24 AM
Thanks for your reply. I found the solution. It's call multiple times init function and i forgot write deinit QSPI in init function.
When you clicked read button it's split buffer size to RAM size and it's calling every time init func and read func.
Init() -> Read(RAM SIZE) -> Init() -> Read(RAM SIZE) .......... -> finished(BUFFER SIZE)
But problem is it's losing too much time in init function. (about 1.8 seconds). When i try read all qspi flash memory(64Mbyte) i losing 8,98 minutes. Because my free RAM size 220Kb. It's splitting 64Mbyte to 220Kbyte.
64*1024 / 220 = 297. It's meaning it's calling init function 297 times. 297*1.8 = 536 seconds.
How can i make one time call init funtion?
int Init(void)
{
SystemInit();
SCB->VTOR = 0x20000000 | 0x200;
HAL_UART_DeInit(&huart1);
HAL_DeInit();
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_QUADSPI_Init();
//__set_PRIMASK(1); //disable interrupts
__set_PRIMASK(0); //enable interrupts
return 1;
}
2024-09-19 11:51 AM
Doesn't it call multiple times, that's how it normally works. The request from the Windows UI gets decomposed and the data copied in to buffers PC side to display. The 0x40000 length here gets broken into multiple STM32 side External Loader Read() requests.
The loader can only use available RAM. In your own applications you can read to SDRAM, or whatever.
2024-09-20 05:24 AM
Thanks for your reply. I found the solution. It's call multiple times init function and i forgot write deinit QSPI in init function.
When you clicked read button it's split buffer size to RAM size and it's calling every time init func and read func.
Init() -> Read(RAM SIZE) -> Init() -> Read(RAM SIZE) .......... -> finished(BUFFER SIZE)
But problem is it's losing too much time in init function. (about 1.8 seconds). When i try read all qspi flash memory(64Mbyte) i losing 8,98 minutes. Because my free RAM size 220Kb. It's splitting 64Mbyte to 220Kbyte.
64*1024 / 220 = 297. It's meaning it's calling init function 297 times. 297*1.8 = 536 seconds.
How can i make one time call init funtion?
int Init(void)
{
SystemInit();
SCB->VTOR = 0x20000000 | 0x200;
HAL_UART_DeInit(&huart1);
HAL_DeInit();
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_QUADSPI_Init();
//__set_PRIMASK(1); //disable interrupts
__set_PRIMASK(0); //enable interrupts
return 1;
}