LPC1227 - ISP entry from FreeRTOS task

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC1227 - ISP entry from FreeRTOS task

879件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rals01 on Sun Oct 07 22:45:01 MST 2012
Hello,

I'm trying to reinvoke the LPC1227 ISP from user code as part of a firmware upgrade scheme. We use LPC21Isp as programming tool. We can successfully program the flash when the ISP entry code is  executed before the FreeRTOS scheduler is started. However, if the ISP entry code is invoked from a FreeRTOS task, the ISP is entered, but programming stops approximately halfway through the first sector with a hardfault exception. I know other people have had issues with MSP setup and stack corruption, but I can't seem to figure out what I am doing wrong.

- FreeRTOS 7.1.1 (official M0 port) / LPC1227
- 32 bytes reserved for ISP http://support.code-red-tech.com/CodeRedWiki/ReserveIAPRam
- I have tried following the points made in the post: http://knowledgebase.nxp.com/showthread.php?t=2846

Enter ISP before FreeRTOS scheduler is started (ok)
<code>
int main(void){
  //...
 
  ISP_enter();
  //will never reach this point
  vTaskStartScheduler();
  return 1;

}
</code>


Enter ISP from task (fails with hardfault)
<code>
void vApplicationTask(void *pvParameters)
{
  ISP_enter();

}
</code>

Code for handling IAP/ISP
<code>
static IAP iap_entry = (IAP) 0x1fff1ff1;
#define IAP_REINVOKE_ISP  57
static uint32_t command[5];
static uint32_t result[4];

void ISP_enter(void)
{
    //disable all interrupts - also stops SysTick used by FreeRTOS
    NVIC->ICER[0] = 0xFFFFFFFF;

    //Set SYSAHBCLKCTRL and SYSAHBCLKDIV to reset value
    LPC_SYSCON->SYSAHBCLKCTRL = 0xF01FFFFF;
    LPC_SYSCON->SYSAHBCLKDIV = 1;

    command[0] = IAP_REINVOKE_ISP;

    //Set stack pointer to ROM value (reset default).
    __set_MSP(*((uint32_t *) 0x1FFF0000));
    //Invoke the bootloaer
    iap_entry(command, result);
}
</code>

Any ideas?
ラベル(1)
0 件の賞賛
返信
1 返信

757件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdurand on Fri Oct 12 15:05:48 MST 2012
turn off interrupts before calling IAP
0 件の賞賛
返信