网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> 服务导航 >> 帮助中心 >> C6000 >> 文章正文
  TI DM642板 flash烧写分享及讨论         ★★★ 【字体:
TI DM642板 flash烧写分享及讨论
作者:61IC客服    文章来源:本站原创    点击数:    更新时间:2006-5-1    

 

问题如下:

Ti EVM DM642采用flash为AMD29LV033C,大小:4M Bytes,8位数据线,22地址线,接于DSP的CE1空间

1、块擦除函数

/* The Flash Erase function uses
* the AMD algorithm to erase the
* entire chip.
*/

void EraseFlash(void)
{
    int i;
            
    /* Code to erase AMD29LV033C
     * 32MBit (4MK X 8) Flash Memory
     */
    *FLASH_PAGE = 0;
    *(volatile char *)FLASH_START = (char)FLASH_KEY1;
    *(volatile char *)FLASH_START = (char)FLASH_KEY2;
    *(volatile char *)FLASH_START = (char)FLASH_KEY4;

    *(volatile char *)FLASH_START = (char)FLASH_KEY1;
    *(volatile char *)FLASH_START = (char)FLASH_KEY2;
    *(volatile char *)FLASH_START = (char)FLASH_KEY5;

    /* Wait until erase is done */
    while(GetFlashVal(FLASH_START) != 0xff);

    /* Put the Flash in normal mode */    
    *(volatile char *)FLASH_START = (char)0xf0;

    /* Mark all sectors as erased */
    for (i = 0; i < FLASH_SECTORS; i++)
        erasetable[i] = 1;
    
    return;
}


2、!!!!!!!!

写入函数
/* Burns flash data, starting at flashnext.
* This embodies the burning algorithm for the
* AMD29LV033C flash memory used on DM642 EVM
*/

#define FLASH_PAGE      ((volatile unsigned char *)0x90080018)

void BurnFlash(u8 *data, u16 nBytes)
{
    u16 timeout;
    u8 c;
    volatile u8 *pdata;

    /* Put the Flash in normal mode */    
    *(volatile char *)FLASH_START = (char)0xf0;

    flash_erase((u32)flashnext, (u32)nBytes);
    while(nBytes--)        
    {
        /* Prep AMD
         * 32MBit (4M x 8) Flash Memory
         * for writing a byte.
         */
        *FLASH_PAGE = (u8)(((u32)flashnext & 0x380000) >> 19);
        *(volatile char *)FLASH_START = (char)FLASH_KEY1;
        *(volatile char *)FLASH_START = (char)FLASH_KEY2;
        *(volatile char *)FLASH_START = (char)FLASH_KEY3;

        pdata = (volatile u8 *)((u32)flashnext & 0xffc7ffff);
        *pdata = *data;
        
        /* Spin here 'til programming completes
         */
        c = *data++;
        timeout = 0;
        do timeout += 1;
        while(*pdata != c && timeout < (u16)0xffff);        
        flashnext++;
    }
    
    /* Put the Flash in normal mode */    
    *(volatile char *)FLASH_START = (char)0xf0;
}

非常迷惑这里写函数中:
pdata = (volatile u8 *)((u32)flashnext & 0xffc7ffff);

    这里想把pdata 指向flashnext(扇区首地址,例如0x90000000),然后循环写某个大小。为何传地址给指针pdata 时,flashnext 要和0xffc7ffff进行与操作?还有*FLASH_PAGE = (u8)(((u32)flashnext & 0x380000) >> 19);意义何在?

解答如下:

原因是EVM板的flash地址线连接,比较特殊:

A0 -A18:直接连接到DSP的地址线;
A19-A21:连接到FPGA内部的页地址寄存器。

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    通用FLASH烧写工具
    请问如何分片烧写flash
    关于FLASH.CMD的一些问题
    关于FLASH烧写的问题
    烧到Flash的程序,断电再上电…
    Flash烧写
    关于Flash
    LF2407 出现的怪问题
    DSP2812中定义软中断
    观察不了寄存器的值?
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号