Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

Traveo II

mandar_bhat
New Contributor

Hi ,

I am using sample code from TVII_Sample_Driver_Library_7.2.0 library example code of work flash

it is storing some data in workflash and reading data from work flash. ( I want to use this to store some application specific settings data similar to eeprom).

I implemented the sample function in my application and found that fault is generated and my call stack list is lost, as soon as i execute Erase API => (Cy_FlashSectorErase(SectorAddr, CY_FLASH_DRIVER_BLOCKING))

or also may be any other API related to work flash

As my call stack is lost , so after exiting this BasicWorkFlashBlockingTest function, my stack pointer cannot return to the place where this function was invoked, so sytem fault is generated.

I am running this code from M4 code-flash.

Microcontroller's M0+ Core is also initialized.

//***************************************************************************************

// Initialization
Cy_FlashInit(false /*blocking*/);

 

// Test for Small Sector
BasicWorkFlashBlockingTest(TEST_W_SS_ADDR, CY_WORK_SES_SIZE_IN_BYTE);

//***************************************************************************************

// In this routine, whole one sector erased/written/read/verified
void BasicWorkFlashBlockingTest(uint32_t SectorAddr, uint32_t SectorSizeInByte)
{
uint32_t* p_TestFlsTop = (uint32_t*)SectorAddr;

uint32_t SectorSizeInWord = SectorSizeInByte / 4ul;

/** Erasing **/
// Erase
Cy_FlashSectorErase(SectorAddr, CY_FLASH_DRIVER_BLOCKING);

// Verify
Cy_WorkFlashBlankCheck(SectorAddr, CY_FLASH_DRIVER_BLOCKING);

/** Programming **/
for(uint32_t i_addr = SectorAddr, i_addrOffset = 0; i_addr < SectorAddr + SectorSizeInByte; i_addr+=4, i_addrOffset+=4)
{
uint32_t i_dataPos = i_addrOffset % PROGRAM_DATA_SIZE_IN_BYTE;

// Flash
Cy_FlashWriteWork(i_addr, (uint32_t*)&programData[i_dataPos], CY_FLASH_DRIVER_BLOCKING);
}

// Verify
uint32_t* pProgramData = (uint32_t*)programData;
for(uint32_t i_wordId = 0; i_wordId < SectorSizeInWord; i_wordId++)
{
uint32_t i_dataPos = i_wordId % PROGRAM_DATA_SIZE_IN_WORD;
CY_ASSERT(p_TestFlsTop[i_wordId] == pProgramData[i_dataPos]);
}

/** Erasing Again **/
// Erase
/*Cy_FlashSectorErase(SectorAddr, CY_FLASH_DRIVER_BLOCKING); */

// Verify
/*Cy_WorkFlashBlankCheck(SectorAddr, CY_FLASH_DRIVER_BLOCKING); */
}

 

Please suggest any ideas to make it work.

Thanks in Advance.

 

 

 

0 Likes
3 Replies
yanf
Moderator
Moderator

Hi mandar_bhat,

Can you double check your configuration is selected correctly according to your evaluation board. 

It seems no problems with these codes you have provided when I test it on my board. 

Kind Regards,

Finn

0 Likes
mandar_bhat
New Contributor

Hi Finn,

      I donot have an evaluation board with me.

I am using an project hardware, wherein i am testing this workflash feature.

Already in this board features like uart, adc, timer, i2c and other things are working according to my application.

I am running M0+ core at 80-mhz and M4 core at 160-mhz.

My microntroller chip revision is : rev_c  (CY_MCU_rev_c)

Please can you suggest which all configuration settings i should check. I am using IAR workbench for development.

I see that, if i try to access any work flash related api, my controller hangs 

Thanks and Regards,

Mandar Bhat

0 Likes
yanf
Moderator
Moderator

Hi Mandar,

 

If I understand you correctly, you are using your own board design and a MCU from Infineon, right?

That will make some difference but for this particular instance, I think they are still the same if you use internal flash, which is implemented in MCU. 

I would suggest you use the address in SDL demo project first to do the test. Because there are some addresses that are forbidden to write on (or even read). Please refer to the TRM, Chapter 4.3.

And you should also change the project configuration profile (on the left upper in IAR) to rev_c according to your MCU.

Screenshot (27).png

 Then, the linker file should have been changed to " $PROJ_DIR$\..\..\linker_directives_tviibe.icf " now. You can double check it. 

Have a try if these settings bring it back to work.

Best Regards,

Finn

0 Likes