This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320VC5509A外部DRAM操作问题



我外部挂了一个64M的DRAM在CE0, 当我写某段地址,比如从0x21fff0 - 0x220000时,当地址写到0x21ffff,再继续地址+1的时候,地址被强制到0x210000,数据就从这个地址开始写了,请问这是什么问题吗?地址换成0x20fff0 - 0x210000,也是在0x20ffff地址+1操作时地址被强制到0x200000,我查看了DRAM对应寄存器的设置,没发现与之相关的。

  • 这个64K的访问限制跟C55x Compiler有关。请看下面的FAQ。

    In C55x, why does a long pointer fail when incremented over a 64k boundary?


    Problem:
    When a long pointer is incremented and crosses over a 64k boundary (ie, an address which is a multiple of 0x0001_0000) why isn't the upper 7 bits of the address modified? It appears the address just wraps around the same 64k block of memory.



    Solution:

    Even when the large memory, which supports 23-bit pointers, is used the
    compiler does not calculate the offset from the base address correctly
    when crossing a 64k page boundary.

    For example, if you have a pointer which starts at 0x2f000 and increment
    the pointer to pass address 0x2ffff, instead of becoming 0x30000 the address
    will wrap around and become 0x20000. The same is true for arrays, which
    should not span a 64k page boundary.

    A workaround is to manually check for a boundary change and keep
    track of what the next page should be.

    #pragma DATA_SECTION(gMp3, "ERAM")
    int gMp3[200000];
    int *p;
    unsigned long int nextPage;
    unsigned long i;
    nextPage = (((unsigned long int)gMp3 & 0x7F0000) >> 16) + 1;
    for ( i = 0; i < 200000; i++){
    *p++ = 0x0000;
    /* IMPORTANT: need this to manage page boundries manually. */
    if (((unsigned long int)p & 0xFFFF) == 0)
    { p = (int *)(nextPage++ << 16);
    }
    }