cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H523 QUADSPI W25Q64 External Loader

MMira.4
Associate

Hi, I'm trying to do an external loader according ST's MOOC and this forum https://community.st.com/t5/stm32-mcus-products/stm32h5-external-loader/td-p/601134.

My code pass on all ST's tests of memory, but when I generate a stldr it does not read on cubeprog.

I attached my project and log of cubeprog.

I already do the same with a G474 without problems.

 

BR

1 REPLY 1

The log implies Init() failed, so might want to instrument that

I'd expect Write() needs to leave with memory mapping, depends what STM32 Cube Programmers expectations are to be able to read the memory directly, as NOR_FLASH does not use Read() function.

/**
 * @brief   Program memory.
 * @PAram   Address: page address
 * @PAram   Size   : size of data
 * @PAram   buffer : pointer to data buffer
 * @retval  LOADER_OK = 1       : Operation succeeded
 * @retval  LOADER_FAIL = 0 : Operation failed
 */
int Write(uint32_t Address, uint32_t Size, uint8_t* buffer) {

	__set_PRIMASK(0); //enable interrupts

// Abort out of memory mapped

	if (HAL_XSPI_GetState(&hospi1) != HAL_XSPI_STATE_READY) {
	    if (HAL_XSPI_Abort(&hospi1) != HAL_OK) {
            //console(consoleDefault,"WRITE abort err\r\n");
		    __set_PRIMASK(1); //disable interrupts
		    return LOADER_FAIL;
	    }
	}

    if (CSP_QSPI_WriteMemory((uint8_t*) buffer, (Address & (0x0fffffff)), Size) != HAL_OK) {
        __set_PRIMASK(1); //disable interrupts
        return LOADER_FAIL;
    }

#if 1 // re-enable memory mapped
    if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK) {
        __set_PRIMASK(1); //disable interrupts
        return LOADER_FAIL;
    }
#endif

    __set_PRIMASK(1); //disable interrupts
    return LOADER_OK;
}

STM32H523 / WINBOND W25Q64

PB2:AF9 CLK

PA15:AF9 NCS

PB1:AF6 IO0

PB0:AF6 IO1

PA7:AF10 IO2

PA6:AF6 IO3

 

 

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..