打印

加入iap写flash后iap功能正常,但串口就不能正常执行.

[复制链接]
1195|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
sz_308|  楼主 | 2007-8-29 15:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
程序在jtag下正常,写入整机就出问题.
整机没有加入iap前,各项功能都很正常,加入iap写flash后iap功能正常,但串口就不能正常执行.
具体表现:在串口的通讯数据出错,好象频率错误,把pll去掉后也不对. 
请指教!

uint8  iap(uint32 dst, uint32 src, uint32 no, uint8 sec1, uint8 sec2)
{   
   MAMCR = 0;                                // 关闭MAM
  // PLLCON = 0;                                // 关闭PLL
  // PLLFEED = 0xaa;
  // PLLFEED = 0x55;

   if(ReadParID() !=0){
                           return    FALSE;
                         }    
   if(BootCodeID() != 0){
   
                           return    FALSE;
                        }     
   
   if(SelSector(sec1, sec2) != 0){                          // 选择扇区
                           return    FALSE;
                        }     
   if(EraseSector(sec1, sec2) != 0){                        // 擦除扇区
                           return    FALSE;
                        }     
   if(BlankCHK(sec1, sec2)  != 0){                          // 查空扇区
                           return    FALSE;
                        }     
   
   if(SelSector(sec1, sec2) != 0){ 
                           return    FALSE;
                        }     
   if(RamToFlash(dst, src, no) != 0){
                           return    FALSE;
                        }     
   if(BlankCHK(sec1, sec2) == 0){ 
                           return    FALSE;
                        }     
   if(Compare(dst, src, no) != 0){    // 比较数据
                           return    FALSE;
                        }     

   return    TRUE;
}

uint8  iapTask(uint32 dst, uint32 src, uint32 no, uint8 sec1, uint8 sec2)
{  
   
       uint32 temp1;
       //防止狗复位,喂数
       
       
       //关中断
    temp1 =VICIntEnable;                 
    VICIntEnClr =temp1;

    if (iap(dst, src, no, sec1, sec2)==0){

                VICIntEnable =temp1;

            /*    PLLCON = 1;                                // 使能PLL
                PLLFEED = 0xaa;
                   PLLFEED = 0x55;
                   while((PLLSTAT & (1 << 10)) == 0);        //判断pll锁定
                   PLLCON = 3;
                   PLLFEED = 0xaa;
                   PLLFEED = 0x55;
            */
                return FALSE;
                }

   VICIntEnable =temp1;

/*
   PLLCON = 1;                                // 使能PLL
   PLLFEED = 0xaa;
   PLLFEED = 0x55;
   while((PLLSTAT & (1 << 10)) == 0);        //判断pll锁定
   PLLCON = 3;
   PLLFEED = 0xaa;
   PLLFEED = 0x55;
  */ 

    return TRUE;


 


相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

7

帖子

0

粉丝