微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI无线射频设计 > cc1110 flash 写不进数据,有高手帮解决下,谢谢

cc1110 flash 写不进数据,有高手帮解决下,谢谢

时间:12-23 整理:3721RD 点击:
void Flash_DmaWrite( uint16 *pFlashAddr, unsigned char * pSrcBuf, unsigned int Length )
{
    // Making sure a multiplum of 4 bytes is transferred.
   while(Length & 0x0003){
      Length++;
   }
    dmaConfig.SRCADDRH  = ((unsigned short)pSrcBuf >> 8) & 0x00FF;
    dmaConfig.SRCADDRL  = (unsigned short)pSrcBuf & 0x00FF;
    dmaConfig.DESTADDRH = ((unsigned short)&X_FWDATA >> 8) & 0x00FF;
    dmaConfig.DESTADDRL = (unsigned short)&X_FWDATA & 0x00FF;
    dmaConfig.VLEN      = DMA_VLEN_USE_LEN;
    dmaConfig.LENH      = (Length >> 8) & 0x00FF;
    dmaConfig.LENL      =  Length & 0x00FF;
    dmaConfig.WORDSIZE  = DMA_WORDSIZE_BYTE;
    dmaConfig.TMODE     = DMA_TMODE_SINGLE;
    dmaConfig.TRIG      = DMA_TRIG_FLASH;
    dmaConfig.SRCINC    = DMA_SRCINC_1;
    dmaConfig.DESTINC   = DMA_DESTINC_0;
    dmaConfig.IRQMASK   = DMA_IRQMASK_DISABLE;
    dmaConfig.M8        = DMA_M8_USE_8_BITS;
    dmaConfig.PRIORITY  = DMA_PRI_HIGH;

    /* The DMA configuration data structure may reside at any location in
     * unified memory space, and the address location is passed to the DMA
     * through DMA0CFGH:DMA0CFGL.
     */
    DMA0CFGH = ((unsigned short)&dmaConfig >> 8) & 0x00FF;
    DMA0CFGL = (unsigned short)&dmaConfig & 0x00FF;
  
    /* Waiting for the flash controller to be ready */
    while (FCTL & FCTL_BUSY);

    /* Configuring the flash controller. Setings:
     * FWT: 0x11 (default setting, matches 13 MHz clock frequency).
     * FADDRH:FADDRL: point to the area in flash to write to - flashDataAddr.
     */
    FWT = 0x11;
    FADDRH = (short)pFlashAddr >> 9;
    FADDRL = ((short)pFlashAddr >> 1) & ~0xFF00;

    /* Erase the page that will be written to. */  
    Flash_StartErase(); 

    /* Wait for the erase operation to complete. */
    while (FCTL & FCTL_BUSY);

    /* Arm the DMA channel, so that a DMA trigger will initiate DMA writing. */
    DMAARM |= DMA_CHANNEL_0;            // Arm DMA channel 0

    /* Enable flash write. Generates a DMA trigger. Must be aligned on a 2-byte
     * boundary and is therefor implemented in assembly.
     */
    Flash_StartWrite();

    /* Wait for DMA transfer to complete. */
    while (!(DMAIRQ & DMAIRQ_DMAIF0));

    /* Wait until flash controller not busy. */
    while (FCTL & (FCTL_BUSY | FCTL_SWBSY));

    /* By now, the transfer is completed, so the transfer count is reached.
     * The DMA channel 0 interrupt flag is then set, so we clear it here.
     */
    DMAIRQ &= ~DMAIRQ_DMAIF0;
}

flash写不进数据,不知道是什么原因。

需要先分辨是硬件还是软件原因。用TI参考板试试,如果也不能就是软件原因。

我用TI参考代码也不行

我用TI参考代码试了,也写不进数据,

请问所用开发板是TI的还是自己设计的?

TI  的开发板

TI的开发板,TI的代码,那只能考虑接口的问题了

什么叫借口的问题,能具体点吗?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top