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 ?