firmware update FoE XMC4800

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

cross mob
User16529
Level 4
Level 4
First solution authored
Hi!
I'm working with an XMC4800 144x2028 and I need to enable the FoE for firmware update.
I'm trying the example code ETHCAT_FWUPDATE_SSC_APPLICATION_XMC48 found at https://www.infineon.com/cms/en/product/promopages/aim-mc/dave_downloads.html (adapted to my application), but it doesn't work.
I'm using TRACE32 Lauterbach to debug and to flash the code into the chip: I flash the ETHCAT_FWUPDATE_BOOTLOADER_XMC48 and then I run it, but the system goes in "running(sleep)" and it can't be stopped, so i'm not able to go further.
Is there another way to implement FoE? or is there a proper way to make the ETHCAT_FWUPDATE_SSC_APPLICATION_XMC48 code work with Lauterbach? I can't use the Segger jtag.

Thank you for any help
0 Likes
6 Replies
MichaelIFX
Employee
Employee
50 replies posted 25 replies posted 10 replies posted
The problem you describe is not related to TRACE/Lauterbach.
I understand you have only downloaded the bootloader, correct?

So bootloader is starting the application image inside flash where nothing is programmed into. As a consequence the CPU hangs there.

To solve this issue, just also download the application image using Lauterbach.
Before downloading the images (bootloader/application) it is always good to start from a defined basis which is an erased flash.
You can use Segger J-Flash Lite for this purpose.


Kind Regards

Michael
0 Likes
User16529
Level 4
Level 4
First solution authored
Hi Michael,
I've tried to do what you said, but when i download the application i get "FLASH programming error around address SD:0xC020000".
I can't use Segger, because my debbuger pinout is only for the Lauterbach, not compatible with Segger Debugger.
0 Likes
MichaelIFX
Employee
Employee
50 replies posted 25 replies posted 10 replies posted
Hi Janet,
Of course writing to 0xC020000 does not work, because there is no flash inside XMC48 at this address.
Typically the application image inside FoE-example must be loaded to 0xC0020000

Maybe you have a typo inside the linker file when you have set the address.

Kind Regards

Michael
0 Likes
User16529
Level 4
Level 4
First solution authored
Hi!
I've been able to download a .bin file with FoE from the master, but now i don't know how to retrive the file from where it is sotred and i don't know how to write it in the correct flash partition as to make it the new CPU firmware.
ETHCAT_FWUPDATE_SSC_APPLICATION_XMC48 doesn't work for me, so i adapted it to my application. In the process_app() i write



if(nAlStatus == STATE_INIT)
{

/************************** check if there is a new firmware inside the backup flash partition ***********/
if(FWUPDATE_GetDownloadFinished() == 1) /* the INIT state is entered after the BOOT state → fw update finished*/
{
firmware_size_bytes = (START_ADDRESS_BACKUP_PARTITION + INFO_OFFSET / 4)[63];

/* check metainfo if firmware for update is available inside backup partition */
if ( (firmware_size_bytes > 0) && (firmware_size_bytes < APP_PARTITION_MAX_SIZE) )
{

/* program new firmware into application partition */
FLASHPROG_Init(START_ADDRESS_APPL_PARTITION, APP_PARTITION_MAX_SIZE, FLASH_OPT_ERASE, FLASH_OPT_CHECK);
FLASHPROG_Data(START_ADDRESS_BACKUP_PARTITION, firmware_size_bytes);
FLASHPROG_Close();

/* delete EEPROM content (2nd 64k sector) */
FLASHPROG_Delete_physical_sector(XMC_FLASH_PHY_SECTOR_4);

/* Restart to retry programming */
BL_Normal_Restart();
/* OK - new firmware was successfully programmed into application partition */

}

/* software from backup partition was just successfully programmed
* into application partition.
* In any case, make sure backup partition is erased before restarting firmware inside
* application partition.
*/
ptr_backupdata = START_ADDRESS_BACKUP_PARTITION;
while(ptr_backupdata {
/* is erase needed? */
if (*ptr_backupdata!=0)
{
/* erase backup partition */
FLASHPROG_Delete_physical_sectors(ptr_backupdata, 1);
}
ptr_backupdata++;
}

/* Restart inside application partition */
BL_Normal_Restart();

}
}




the function BL_Normal_Restart and BL_Normal_Restart



void BL_Normal_Restart(void)
{
/* Restart in alternative bootmode 0 */
/* Clear the reset cause field for proper reset detection of the ssw */
XMC_SCU_RESET_ClearDeviceResetReason();
/* Set ABM0 as boot mode in SWCON field of STCON register */
XMC_SCU_SetBootMode(XMC_SCU_BOOTMODE_NORMAL);
/* Trigger power on reset */
PPB->AIRCR = (1 << PPB_AIRCR_SYSRESETREQ_Pos) | (0x5FA << PPB_AIRCR_VECTKEY_Pos) | (0x1 << PPB_AIRCR_PRIGROUP_Pos);
}

void BL_FlashABM0_Restart(void)
{
/* Restart in alternative bootmode 0 */
/* Clear the reset cause field for proper reset detection of the ssw */
XMC_SCU_RESET_ClearDeviceResetReason();
/* Set ABM0 as boot mode in SWCON field of STCON register */
XMC_SCU_SetBootMode(XMC_SCU_BOOTMODE_ABM0);
/* Trigger power on reset */
PPB->AIRCR = 1 << PPB_AIRCR_SYSRESETREQ_Pos
|0x5FA<
| 0x1 << PPB_AIRCR_PRIGROUP_Pos;
}




The problem is that the ESC gets stuck in INIT state when i try to go back to OP after the FoE download.

How could i fix it?

Thanks for any help
0 Likes
User16529
Level 4
Level 4
First solution authored
Hi again!
I really need to know how to write the firmware in the flash app partition once i've downloaded it by FoE.
0 Likes
User18369
Level 2
Level 2
MichaelIFX wrote:
Hi Janet,
Of course writing to 0xC020000 does not work, because there is no flash inside XMC48 at this address.
Typically the application image inside FoE-example must be loaded to 0xC0020000

Maybe you have a typo inside the linker file when you have set the address.

Kind Regards

Michael


What ? In example the App_Partition is 0x0C020000 ....
0 Likes