MPC5748G Flash operation issues after making a jump from bootloader

cancel
Showing results for 
Search instead for 
Did you mean: 

MPC5748G Flash operation issues after making a jump from bootloader

154 Views
sjoshi33
Contributor I

I am working on a bootloader for MPC5748G microcontroller. I am facing issues with Flash Read/Write operations after making a jump to our Application from Bootloader. Except for Flash Read/Write operations, rest of the application works as expected.

 

Given below is the section of bootloader code that makes jump to the application -

 

void PIT_CH0_DeInit(void)

{

                INTC.PSR[226].R = 0x0000;         // PIT0 IRQ disabled

                PIT.TIMER[0].TCTRL.B.TIE = 0;     // Timer interrupt disable  

                PIT.TIMER[0].TCTRL.B.TEN = 0;     // stop Timer  

}

 

void Jump_To_Application(void)

{

                UINT32 i;

                UINT16 BootHeader = 0;

                BootHeader = (*(UINT16*)0x00FA8000);

                // Read Upper Byte of Boot Header only. Upper Byte should be 0x005A.

                if(BootHeader == 0x005A)

                {

                                SuspendAllInterrupts();

                                PIT_CH0_DeInit();

                                // Similarly other used peripherals are deinitialized

                               

                                //some delay

                                for(i = 0; I < 10000000; i++)

                                                asm("nop");

                               

                                asm("e_lis %r12,0x0100");

                                asm("e_or2i %r12,0x0000");

                                asm("mtlr %r12");

                                asm("se_blrl");

}

}

 

Bootloader makes use of SSD flash drivers. I have following questions -

  1. Do the flash drivers use any of the controller peripherals which I need to de-initialize before making a jump to application?
  2. Application code makes use of STM_0 Channel 0 during Flash Read/Write operations. I had a doubt that STM_0 Ch0 interrupt is not getting serviced from the application. I have tried to de-initialize STM_0 Channel 0 from bootloader as below. But this does not help.

               

                STM_0_CCR0 = 0;

               

                // Some delay

                for(STM_i = 0; STM_i < 10000000; STM_i++)

                    asm("nop");

                               

                STM_0.CHANNEL[0].CIR.B.CIF = 1;

                STM_0.CR.B.TEN = 0;

                INTC.PSR[36].R = 0x0000;

 

 

Please advise.

lukaszadrapa

0 Kudos
1 Reply

96 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Shantanu,

answer to your first question is no. The SSD flash driver does not touch other peripherals.

I'm not sure if I can understand the second question. What can you see exactly? If the read-while-write error is caused by core access, machine check exception should be triggered because that access is terminated by bus error. So, you should relatively easily find which piece of code caused the problem.

If STM interrupts are not triggered then make sure that:

- interrupt flag is set

- interrupt is enabled in STM module

- priority register is configured appropriately in INTC

- MSR[EE] is set

If you are missing only some interrupts, it can be caused by low priority or lack of performance.

Regards,

Lukas

0 Kudos