Thanks for replying.
I modified the code with your suggestions as follows.
It still does not work.
Our bootloader is able to read the program once registers and the code is at address 0x1CE8.
The function that is not able to read the program once registers is in run from an MQX task which is in address 0x6860.
void Main_task(uint32_t initial_data)
{
printf("\n Hello World \n");
printf ("\n-------------- Program Once Read --------------\n\n");
FTFE_FSTAT = 0x30;
while(!(FTFE_FSTAT & FTFE_FSTAT_CCIF_MASK)); //Wait for the read operation to complete
FTFE_FCCOB0 = 0x41; //Program Once read command
FTFE_FCCOB1 = 0x00; //Program Once index 0
FTFE_FSTAT = 0x80;
while(!(FTFE_FSTAT & FTFE_FSTAT_CCIF_MASK)); //Wait for the read operation to complete
if (FTFE_FSTAT & FTFE_FSTAT_ACCERR_MASK)
{
/* clear error flag */
FTFE_FSTAT |= FTFE_FSTAT_ACCERR_MASK;
/* update return value*/
printf("Error ACCERR FSEC=0x%02x\n", FTFE_FSEC);
}
/* checking protection error */
else if (FTFE_FSTAT & FTFE_FSTAT_FPVIOL_MASK)
{
/* clear error flag */
FTFE_FSTAT |= FTFE_FSTAT_FPVIOL_MASK;
/* update return value*/
printf("Error FPVIOL\n");
}
else if (FTFE_FSTAT & FTFE_FSTAT_RDCOLERR_MASK)
{
/* clear error flag */
FTFE_FSTAT |= FTFE_FSTAT_RDCOLERR_MASK;
/* update return value*/
printf("Error RDCOLERR\n");
}
/* checking MGSTAT0 non-correctable error */
else if (FTFE_FSTAT & FTFE_FSTAT_MGSTAT0_MASK)
{
printf("Error MGSTAT0\n");
}
printf("%02X %02X %02X %02X %02X %02X\n", FTFE_FCCOB4, FTFE_FCCOB5, FTFE_FCCOB6, FTFE_FCCOB7, FTFE_FCCOB8, FTFE_FCCOB9);
_mqx_exit(0);
}