2022-03-30 03:55 AM
Hi,
I created one external loader to write and erase one NOR FLASH and works well (STM32H7A3 with S29GL512S11).
When I try to access the memory in my application code the memory returns 0xFFFF every time. When I try to read the memory the first time when external loader is loaded to microcontroller, I read the same values. But if I click second time in Read button the STM32Programmer read the memory correctly.
My question is, what are the commands sent to microcontroller when Read Button is clicked? In my custom external loader I don't have any function to read, and the read task is executed by STM32Programmer and works fine.
Best regards,
Luis Cristóvão
2022-03-30 04:05 AM
It generally expects the Init() function to memory-map the QSPI/OCTOSPI device into the 0x90000000 address space, and then the debug interface reads that directly.
2022-03-30 04:17 AM
Thanks for your fast reply,
First of all I don't use QSPI or OCTOSPI, because my memory don't use it. When i try to read the memory address 0x60000000 (my first bank address FMC) is returned 0xFFFF. When I read the device ID and other this with commands works fine, only doesn't work when I try to access directly to address. My thought is, have any configuration sent by STM32Programmer before read all memory address?
Best regards,
Luis Cristóvão
2022-03-30 04:35 AM
It should call Init() to setup clocks, peripheral, pins and memory.
SPI_FLASH class devices would need a Read() function.
I've seen STM32 Cube Programmer fumble the first round read of memory, the app is buggy and poorly tested.
Set Verbose logging to 3, make sure it calls Init()
2022-03-30 05:48 AM
Sorry, but i don't use any SPI_FLASH device in my custom board. I use one NOR FLASH connected to FMC Bank 1 and PSRAM connected to FMC Bank 2. The PSARM I can read and write and all works fine. Only the NOR FLASH I can't read the correct values.
I use this code to read:
uint16_t verify[3]={0};
verify[0]=*(__IO uint16_t *)(NOR_MEMORY_ADRESS1);
verify[1]=*(__IO uint16_t *)(NOR_MEMORY_ADRESS1+2);
verify[2]=*(__IO uint16_t *)(NOR_MEMORY_ADRESS1+4);
2022-03-30 06:48 AM
On debug after all configurations I try to see the sections of memory that controller have and I read this:
>info mem
Using memory regions provided by the target.
Num Enb Low Addr High Addr Attrs
0 y 0x00000000 0x08000000 rw nocache
1 y 0x08000000 0x08080000 flash blocksize 0x2000 nocache
2 y 0x08080000 0x100000000 rw nocache
Is it possible the STM32Programmer when I try to read the memory by the button declare a new section and that way I can read the memory?
In my linker file only have
/* Specify the memory areas */
MEMORY
{
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 1024K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
FLASH1 (rx) : ORIGIN = 0x8000000, LENGTH = 512K
FLASH2 (rx) : ORIGIN = 0x8100000, LENGTH = 512K
NOR1 (xrw) : ORIGIN = 0x60000000, LENGTH = 64M
SRAM (xrw) : ORIGIN = 0x64000000, LENGTH = 4M
}
2022-03-30 07:17 AM
Fine, but using the "SPI_FLASH" class in the loader structures lets you dictate how the memory is accessed via the Read/Write API, it could be QSPI, FMC, SPI, NAND, eMMC or whatever, the programmer software doesn't touch the memory device directly.
Is your complaint that your application side code isn't reading the NOR FLASH properly, but the External Loader is? If that's the case your initialization code isn't right, and you'll need to review the clocks, timing, pins, etc
2022-03-30 07:31 AM
Ok, but I can read without problems the internal registers of the memory like CommandSet, DeviceID, Size, Manufacture, etc. How and where I can add SPI_FLASH for dictate how the memory is accessed via the Read/Write API?
Thanks for help I'm very noob in this mater of external memories.
2022-04-03 11:27 PM
The external loader as be created by me, and this loader have a same configuration in booth places (external loader and application). I have too one SRAM on Bank 2 of FMC peripheral, and I can read and write correctly the values into the external SRAM. Only have issues when I try to read NOR FLASH.
The external loader only can read the values from the memory after click on "Read". My question is:
What is executed when I click in Read button on STM32CubeProgrammer (see image below). The STM32cubeProgrammer Read Button have some things more than read the memory only. I repeat the external loader are be created by me and the code of configuration (clock's, timings, GPIO and peripheral FMC) is the same in booth places, my code and external loader code.
Best regards,
Luis Cristovão