Flash writing problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16898
Level 4
Level 4
Hi

I try to adopt Flash deomo to my project.

I try to erase a sector then put some data to it.
When erasing sectors works normally.
writing not at all.


Before I execute this functions I'm copying necessary functions to PSPR RAM, and call them from PSPR.
I do it the same way as in flash demo.

static void PFlashProgram(uint32 flash, uint32 sector_addr, uint32 start_page, uint32 no_of_pages)
{
uint32 offset;
uint32 page;
uint16 endinitSfty_pw;
endinitSfty_pw = IfxScuWdt_getSafetyWatchdogPasswordInline();

/* program the given no of pages */
for (page = start_page; page < no_of_pages; ++page)
{
uint32 pageAddr = sector_addr + page * FLASHDEMO_PFLASH_PAGE_LENGTH;
g_Pflash.command.enterPageMode(pageAddr);

/* wait until unbusy */
g_Pflash.command.waitUnbusy(flash, g_Pflash.flashType);

/* write 32 bytes (8 doublewords) into assembly buffer */
for (offset = 0; offset < FLASHDEMO_PFLASH_PAGE_LENGTH; offset += 😎
{
g_Pflash.command.loadPage2X32(pageAddr, pageAddr, offset);
}

/* write page */
IfxScuWdt_clearSafetyEndinitInline(endinitSfty_pw);
g_Pflash.command.writePage(pageAddr);
IfxScuWdt_setSafetyEndinitInline(endinitSfty_pw);

/* wait until unbusy */
g_Pflash.command.waitUnbusy(flash, g_Pflash.flashType);
}
}

This code, from ILLD demo, write first 5 pages of sector 1.
When program run this function,(runned from PSPR) everything is falling apart.
code never reaches next tline.
Stopping program, in debbuger, results in trap (class 3 ( i cannot read tin number )
on the other hand disassembly shows some data proving that program is running correctly.

what could the problem here ?

Tc222L
0 Likes
1 Reply
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
You execute the function PFlashProgram also from PFLASH? This is necessary. Otherwise you must debug the function with single step to look which functions are called, maybe there is a problem with the function pointers.
0 Likes