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.

DSP2812的SCI通讯奇怪现象

我做的DSP系统和PC机的调试通讯方式是2812的串口转422通讯,然后422再转换成串口接到PC机的COM1上,现在的问题是:我将程序用560仿真器仿真时,在CCS中点击运行,通过串口助手可以正常通讯,比如DSP向PC机周期性的发送00 00;但我如果退出CCS环境,将程序烧入FLASH,DSP重新上电,只通过串口助手来通讯,这时串口通讯不正常,DSP向PC机周期性的发送诸如A0 C2的字节。而且,我发命令,DSP也不响应。

  • 程序烧到Flash之后,请用不要断开仿真器,用Load Symbols将程序加载,然后运行,Flash在线调试,看看程序跑到什么地方了?

    另外,程序中是否使用Delay_us()函数,此函数是否已经copy到Ram中执行。

    Stack的大小开的是否足够?

    看看程序是否进入了什么illegal ISR?

  • 你可以先将仿真器卸掉,试试  有可能是连接仿真器的原因,有时烧写完成程序以后等你在重新上电时,仿真器就认为是复位状态的。

  • @ Jones Chen:尝试用Flash在线调试,发现这时用串口调试助手收发数据都很正确,和用仿真器仿真结果一样,但是拔掉仿真器,启动装置,就再也回不来数据了

  • 你的上电Boot引脚是怎么接的?一共有4个引脚来决定上电时的Boot位置。你是否对这四个引脚有拉低的行为?

    另外,为了确保程序在Flash能够跑起来,请用一个闪灯程序测试一下,看看是否程序都没有跑起来。

  • 现在情况是这样的。。仿真依旧正常,但烧写完成后,用串口发送数据10次,可能其中就有一次回过来,或者几率更小。

  • 我也遇到了类似的问题,烧到flash里后连着仿真器非常正常,去掉仿真器就有一定的误码率。

    后来不使用DELAY-US来延时,用定时中断就不会出现这个问题了。

    DELAY——US在程序里已经  .sect "ramfuncs",是不是已经声明为RAM运行?

    还用不用在主程序里做一些处理?

  • 请楼主确认是否正确初始化FLASH waitstates,通过以下方法:

    MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

    // Call Flash Initialization to setup flash waitstates

    // This function must reside in RAM

      InitFlash();

    //

  • /*** Copy all FLASH sections that need to run from RAM (use memcpy() from RTS library) ***/

    // Section secureRamFuncs contains user defined code that runs from CSM secured RAM

    memcpy( &secureRamFuncs_runstart,

    &secureRamFuncs_loadstart,

    &secureRamFuncs_loadend - &secureRamFuncs_loadstart);

    //copy from the flash to the ram  for change the registers of the flash,

    /*** Initialize the FLASH ***/

    InitFlash();

  • @ ,这种现象是不是主要还是cmd文件的问题?您能留个联系方式吗?

  • 楼主可以将CMD文件发上来看一下,也可以留个邮箱联系!

  • 嗯。我的邮箱:chenjie8230@126.com

    cmd文件如下:

    MEMORY

    {

    PAGE 0:    /* Program Memory */

    ZONE0 : origin = 0x002000, length = 0x002000     /* XINTF zone 0 */

    ZONE1       : origin = 0x004000, length = 0x002000     /* XINTF zone 1 */

    RAML0       : origin = 0x008000, length = 0x001000     /* on-chip RAM block L0 */

    ZONE2       : origin = 0x080000, length = 0x080000     /* XINTF zone 2 */

    ZONE6       : origin = 0x100000, length = 0x080000     /* XINTF zone 6 */

    OTP         : origin = 0x3D7800, length = 0x000800     /* on-chip OTP */

    FLASH_IJ    : origin = 0x3D8000, length = 0x004000     /* on-chip FLASH */

    FLASH_GH    : origin = 0x3DC000, length = 0x008000     /* on-chip FLASH */

    FLASH_CD    : origin = 0x3EC000, length = 0x008000     /* on-chip FLASH */

    FLASH_AB    : origin = 0x3F4000, length = 0x003F80     /* on-chip FLASH */

    CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Part of FLASHA.  Reserved when CSM is in use. */

    BEGIN_FLASH : origin = 0x3F7FF6, length = 0x000002     /* Part of FLASHA.  Used for "boot to flash" bootloader mode. */

    PASSWORDS   : origin = 0x3F7FF8, length = 0x000008     /* Part of FLASHA.  CSM password locations. */

    BEGIN_H0    : origin = 0x3F8000, length = 0x000002     /* Part of H0.  Used for "boot to H0" bootloader mode. */

    RAMH0       : origin = 0x3F8002, length = 0x001FFE     /* H0 SARAM */

    /* ZONE7       : origin = 0x3FC000, length = 0x003FC0     /* XINTF zone 7 available if MP/MCn=1 */

    BOOTROM : origin = 0x3FF000, length = 0x000FC0     /* boot ROM available if MP/MCn=0 */

    RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM (MP/MCn=0) or XINTF zone 7 (MP/MCn=1) */

    VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM (MP/MCn=0) or XINTF zone 7 (MP/MCn=1) */

    PAGE 1 :   /* Data Memory */

    RAMM0       : origin = 0x000000, length = 0x000400     /* on-chip RAM block M0 */

    RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */

    RAML0L1     : origin = 0x008000, length = 0x002000     /* on-chip RAM block L1 */

    SRAM : origin = 0x100000, length = 0x020000

    FLASH_EF    : origin = 0x3E4000, length = 0x008000     /* on-chip FLASH */

    }

    SECTIONS

    {

    /*** Compiler Required Sections ***/

    /* Program memory (PAGE 0) sections */

    .text : > FLASH_AB, PAGE = 0

    .cinit : > FLASH_CD, PAGE = 0

    .pinit : > FLASH_CD, PAGE = 0

    .reset : > RESET, PAGE = 0, TYPE = DSECT  /* We are not using the .reset section */

    /* Data Memory (PAGE 1) sections */

    .cio : > RAMM0, PAGE = 1

    .bss : > RAMM0, PAGE = 1                /* Should be empty with large memory model */

    .ebss : > SRAM,    PAGE = 1

    .const : > FLASH_EF, PAGE = 1                /* Should be empty with large memory model */

    .econst : > FLASH_EF, PAGE = 1      

    .stack : > RAMM1, PAGE = 1

    .sysmem : > RAMM0, PAGE = 1                /* Should be empty with large memory model */

    .esysmem : > RAMM0, PAGE = 1

    .switch : > FLASH_CD, PAGE = 0

    /*** User Defined Sections ***/

    codestart : > BEGIN_FLASH, PAGE = 0                /* Used by file CodeStartBranch.asm */

    csm_rsvd : > CSM_RSVD, PAGE = 0                /* Used by file passwords.asm */

    passwords : > PASSWORDS, PAGE = 0                /* Used by file passwords.asm */

    pie_vect : > PIE_VECT, PAGE = 1

    secureRamFuncs : LOAD = FLASH_AB, PAGE = 0                /* Used by InitFlash() in SysCtrl.c */

    RUN = RAMH0, PAGE = 0

    LOAD_START(_secureRamFuncs_loadstart),

    LOAD_END(_secureRamFuncs_loadend),

    RUN_START(_secureRamFuncs_runstart)

    UserFuncs : > FLASH_AB, PAGE = 0

    IQmathTables : LOAD = BOOTROM, TYPE = NOLOAD, PAGE = 0    

  • 格式不太好,您给看看有没有问题。。