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.

DSP5509A EHPI配置成General-Purpose I/O的问题

main()
{
//int i = 0;
CSL_init();
/*设置系统的运行速度为144MHz*/
PLL_config(&myConfig);
*( volatile unsigned int*)0x6c00=0x0003; //EBSR
*( volatile unsigned int*)0x4403=0x003F; //EHPIGPIOEN
*( volatile unsigned int*)0x4404=0x003F; //EHPIGPIODIR
*( volatile unsigned int*)0x4405=0x0000; //EHPIGPIODATA
while(1)
{
*(volatile unsigned int*)0x4405=0x003F;
delay();
*(volatile unsigned int*)0x4405=0x0;
delay();
}
}

程序如让所示,编译连接下载正常,寄存器的值也正确,但A13至A8没有相应的输出。请问是哪里出现了问题,是不是哪里设置没有考虑到。求解释

  • c55x的外设寄存器是映射到片上IO空间, 所以在C语言中, 访问的时候要加ioport关键字.
    如定义成*( volatile ioport unsigned int*)0x6c00=0x0003;

  • 如您所说的定义后,编译连接下载正常

    main()
    {
    //int i = 0;
    CSL_init();

    /*设置系统的运行速度为144MHz*/
    PLL_config(&myConfig);

    *( volatile ioport unsigned int*)0x6c00=0x0003;//EBSR
    *( volatile ioport unsigned int*)0x4403=0x003F;//EHPIGPIOEN
    *( volatile ioport unsigned int*)0x4404=0x003F;//EHPIGPIODIR
    *( volatile ioport unsigned int*)0x4405=0x0000;//EHPIGPIODATA


    while(1)
    {
    *(volatile ioport unsigned int*)0x4405=0x003F;
    delay();
    *(volatile ioport unsigned int*)0x4405=0x0;
    delay();
    }
    }

    0x6c00=0x0003;
    0x4403=0x003F;
    0x4404=0x003F;//EHPIGPIODIR
    0x4405里面存的值都没有变化,似乎访问不了一样,请问这个正常吗?输出也不正常

  • 你查看的是这些寄存器在IO空间的地址吗?

  • 我就是在CCS VIEW下拉框中memery选项对话框中输入要查看的空间地址,这难道是内存空间?那么IO空间给如何查看呢?。另外链接时还会出现这样的警告:warning: '.sysmem' section not found -- ignoring '-heap <size>' option. 我在命令文件定义了这个段,为什么还出现这个警告?谢谢您的回复和指点。

  • CCS->View Memory->右下角输入框中选择"I/O", 再输入外设寄存器地址. C55x片内64K IO地址专门用来存放外设寄存器的.  可以看一下CPU User Guide第110页.
    http://www.ti.com/lit/ug/spru371f/spru371f.pdf

    2. 你程序中使用malloc, calloc, realloc, or new这些函数了吗?  如果不用这些不函数, 编译器不会产生.sysmem段, linker是就会出现这个警告, 你可以把.sysmem删除或者忽略这个warning.