This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137: TI Flash and FEE API functions problems

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

I am trying to implement bootloader.  There are some modules  in your bootloader examples such as bl_flash.c /.h which allow us to modify flash and eeprom.

I tried to use this module. Once enabled fee driver in Halcogen and been sure system clock 160Mhz. 

I included Fapi static library and its path, then also included bl_flash module.

Then I wrote a test code like this;

				FlashBank7SectorErase((uint32_t) BOOTLOADER_REQUEST_ADDRESS);
				uint8_t Data2Wr = PENDING_BL_REQUEST;
				uint8_t BlockProgramStatus = FlashBank7Program(BOOTLOADER_REQUEST_ADDRESS, (uint32_t) &Data2Wr, sizeof(Data2Wr));
				if(BlockProgramStatus != 1)
				{
					/* send somethingh from uart*/
				}

The piece of code above did not work. When program enters into sector erase function, there is a function below.

Fapi_initializeFlashBanks((uint32_t) SYS_CLK_FREQ); /* used for API Rev2.01 */

  When started to execute this function , programram gives this error : Can't find a source file at "C:\Sid\work\GIT\catmcuauto-flashapi-f021-int\API\makefile/../Source/FlashStateMachine.InitializeFlashBanks.c

1. What can be the problem ?

 

I tried second solution and decided to use fee api functions and wrote this code block.

				uint8_t Data2Wr = PENDING_BL_REQUEST;
			    uint8_t BlockNumber=0x1;
			    Std_ReturnType ret;
			    ret = TI_Fee_WriteSync(BlockNumber, &Data2Wr);
			    ret=TI_Fee_Read(BlockNumber,0,&Read_Ptr,1);
			    TI_FeeModuleStatusType Status;
			     do
			     {
			         TI_Fee_MainFunction();
			         delay();
			         Status=TI_Fee_GetStatus(0);
			     }
			    while(Status!=IDLE);

				if(ret == E_OK)
				{
				  // Send UART..
				}

This code above works, and writes  the content to 0xF020_0038 address but As you see in the picture flash bank7 starts from 0xF020_0000.

And it was seperated 4 block in the picture.

2. What is the difference between the blocks in datasheets and the blocks in Halcogen fee driver ?

In fee driver, there specified a header takes part at top of block in size of 16bytes. But the offset in my case is 0x38H so 56 bytes.

3. Where can this offset come from ?

fourth one is lets say I designed as there will be single block in Halcogen, then I have to set size of block in terms of byte.

But there is no any info about maximum limit of this size.

4. How should I know max limit of the block size which I have to enter as input value to Halcogen ?

Okey I found it, in Fee Api Documantary there writes

Note: The size of all the Data Blocks cannot exceed the Virtual Sector length. 

and by default, one virtual sector is assigned one flash sector.

5. Lastly do you have flash programming api for programming and erasing BANK0 and BANK1  or recommending to use bl_flash ?

  • 1. What can be the problem ?

    Is the F02 Flash API library included in your project?

    My suggestion is to use FEE driver to program data to Bank 7 (emulated EEPROM). EEPROM allows users to erase and reprogram stored data repeatedly in an application. The TI FEE Driver provides a set of software functions intended to use a Sector of on-chip Flash memory (Bank 7) as the emulated EEPROM. These software functions are transparently used by the application program for writing, reading and modifying the data.

    2. What is the difference between the blocks in datasheets and the blocks in Halcogen fee driver ?

    Please refer to 2.1.2 Data Block Organization in FEE user manual.

    3. Where can this offset come from ?

    The size of virtual sector header is 32 bytes, and block header is 24 bytes. For the 1st block in the virtual sector, the address offset for data payload is at 32+24=56.

    4. How should I know max limit of the block size which I have to enter as input value to Halcogen ?

    You have found it. The size of all the Data Blocks cannot exceed the Virtual Sector length. 

    5. Lastly do you have flash programming api for programming and erasing BANK0 and BANK1  or recommending to use bl_flash ?

    You can use bl_flash.c/h as reference. 

  • I copied and paste "F021_API_CortexR4_BE_V3D16.lib" static library into project and added paths. Are there anything else to do ?

  • Sir QJ Wang,

    When I disabled Fee Driver in Halcagon, the problem while using functions in bl_flash .c .h are solved.

    Now, while executing this function  Fapi_initializeFlashBanks((uint32_t) SYS_CLK_FREQ); /* used for API Rev2.01 */

    the program does not gıve this error : Cant find a source file at "C:\Sid\work\GIT\catmcuauto-flashapi-f021-int\API\makefile/../Source/FlashStateMachine.InitializeFlashBanks.c 

    This is weird a bit.