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 -
INTC.PSR.R = 0x0000; // PIT0 IRQ disabled
PIT.TIMER.TCTRL.B.TIE = 0; // Timer interrupt disable
PIT.TIMER.TCTRL.B.TEN = 0; // stop Timer
UINT16 BootHeader = 0;
BootHeader = (*(UINT16*)0x00FA8000);
// Read Upper Byte of Boot Header only. Upper Byte should be 0x005A.
if(BootHeader == 0x005A)
// Similarly other used peripherals are deinitialized
for(i = 0; I < 10000000; i++)
Bootloader makes use of SSD flash drivers. I have following questions -
STM_0_CCR0 = 0;
// Some delay
for(STM_i = 0; STM_i < 10000000; STM_i++)
STM_0.CHANNEL.CIR.B.CIF = 1;
STM_0.CR.B.TEN = 0;
INTC.PSR.R = 0x0000;
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.