TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28335: Flash烧写程序运行出错

Part Number:TMS320F28335

TMS320F28335SPI接收数据并处理,程序在Jump to SARAM     <- "boot to SARAM" 模式下运行没有问题,  现在修改成在Flash模式下,串口收发数据正常,定时器定时LED灯闪烁正常,但是SPI中断接受会出现丢失数据的情况。

按照要求已经切换到了Flash模式下 A15 A14 A13 A12 引脚都置高

Flash初始化函数如下:

MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); //复制到RAM中运行

InitFlash();

F28335.cmd文件编写如下:

MEMORY
{
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

ZONE0 : origin = 0x004000, length = 0x001000 /* XINTF zone 0 */
RAML0 : origin = 0x008000, length = 0x001800 /* on-chip RAM block L0 */      //修改了RAML0
RAML1 : origin = 0x009800, length = 0x000700 /* on-chip RAM block L1 */      //修改了RAML1
RAML2 : origin = 0x00A000, length = 0x001000 /* on-chip RAM block L2 */
RAML3 : origin = 0x00B000, length = 0x001000 /* on-chip RAM block L3 */
ZONE6 : origin = 0x0100000, length = 0x100000 /* XINTF zone 6 */ ZONE7A : origin = 0x0200000, length = 0x00FC00 /* XINTF zone 7 – program space */ FLASHH : origin = 0x300000, length = 0x008000 /* on-chip FLASH */
FLASHG : origin = 0x308000, length = 0x008000 /* on-chip FLASH */
FLASHF : origin = 0x310000, length = 0x008000 /* on-chip FLASH */
FLASHE : origin = 0x318000, length = 0x008000 /* on-chip FLASH */
FLASHD : origin = 0x320000, length = 0x008000 /* on-chip FLASH */
FLASHC : origin = 0x328000, length = 0x008000 /* on-chip FLASH */
FLASHA : origin = 0x338000, length = 0x007F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x33FFF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
OTP : origin = 0x380400, length = 0x000400 /* on-chip OTP */
ADC_CAL : origin = 0x380080, length = 0x000009 /* ADC_cal function in Reserved memory */
IQTABLES : origin = 0x3FE000, length = 0x000b50 /* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50, length = 0x00008c /* IQ Math Tables in Boot ROM */ FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0 /* FPU Tables in Boot ROM */
ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */ RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */

PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
/* Registers remain on PAGE1 */
BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAML4 : origin = 0x00C000, length = 0x001000 /* on-chip RAM block L1 */
RAML5 : origin = 0x00D000, length = 0x001000 /* on-chip RAM block L1 */
RAML6 : origin = 0x00E000, length = 0x001000 /* on-chip RAM block L1 */
RAML7 : origin = 0x00F000, length = 0x001000 /* on-chip RAM block L1 */
ZONE7B : origin = 0x20FC00, length = 0x000400 /* XINTF zone 7 – data space */
FLASHB : origin = 0x330000, length = 0x008000 /* on-chip FLASH */

/*20210603*/
Zone7DataA : origin=0x210000,length=0x90000                               //外扩SRAM 存储数据
SPIData : origin=0x2A0000,length=0x50000                                    //外扩SRAM  存储数据

/*20210603*/

}

/* Allocate sections to memory blocks.
Note:
codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code execution when booting to flash
ramfuncs user defined section to store functions that will be copied from Flash into RAM
*/SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
LOAD_SIZE(_RamfuncsLoadSize),
PAGE = 0

csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0
/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAML4 PAGE = 1
.esysmem : > RAMM1 PAGE = 1

/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0

/* Allocate IQ math areas: */
IQmath : > FLASHC PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD /* Uncomment the section below if calling the IQNexp() or IQexp()
functions from the IQMath.lib library in order to utilize the relevant IQ Math table in Boot ROM (This saves space and Boot ROM is 1 wait-state). If this section is not uncommented, IQmathTables2
will be loaded into other memory (SARAM, Flash, etc.) and will take
up space, but 0 wait-state is possible.
*/
/*
IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD {
IQmath.lib<IQNexpTable.obj> (IQmathTablesRam)
}
*/
FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD /* Allocate DMA-accessible RAM sections: */
DMARAML4 : > RAML4, PAGE = 1
DMARAML5 : > RAML5, PAGE = 1
DMARAML6 : > RAML6, PAGE = 1
DMARAML7 : > RAML7, PAGE = 1
/* Allocate 0x400 of XINTF Zone 7 to storing data */
ZONE7DATA : > ZONE7B, PAGE = 1

/* .reset is a standard section used by the compiler. It contains the */ /* the address of the start of _c_int00 for C Code. /*
/* When using the boot ROM this section and the CPU vector */
/* table is not needed. Thus the default type is set here to */
/* DSECT */ .reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
/* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD

/*20210603*/

Zone7DataFile : > Zone7DataA, PAGE=1        //外扩SRAM存储地址

SPIDataFile : > SPIData, PAGE=1                //外扩SRAM存储地址

/*20210603*/

}

Susan Yang:

李嘉辉 说:但是SPI中断接受会出现丢失数据的情况。

请问具体表现是怎样呢?是否有查看一下时序波形?

若是可以的话,建议将SPI单独拿出来测试一下

,

李嘉辉:

单独没有问题  在SRAM模式下也没有问题   我测试的时候一直在SRAM模式下仿真运行测试的

,

Susan Yang:

李嘉辉 说:单独没有问题

单独在flash下是没有问题的?

那是否有可能是UART/TIMER和SPI的中断冲突?是否有尝试降低一下波特率?

,

李嘉辉:

你看一下我的这种设置和CMD文件的编写有问题吗

,

李嘉辉:

不应该改中断冲突,在SRAM模式下正常,波特率现在是最低的根据我的传输数据最低要求设置,   会不会是SPI这部分程序在FLASH里面没有被复制到RAM里面运行?

,

李嘉辉:

#pragma DATA_SECTION(SPIA_Fifo_RxDatabuf,"SPIDataFile");

Uint16 SPIA_Fifo_RxDatabuf[SPI1_PageNum][SPI_Buff_DataLength];

这是SPI的数组定义,定义在了外扩SRAM中

串口是在内部RAM定义的 如下

Uint16 Rxa_Fifo_Buf[Scibuff_Data_Length]; // SCIA 接受缓存数组Uint16 Txa_Fifo_Buf[Scibuff_Data_Length]; // SCIA 发送缓存数组

会不会跟SPI定义在外部扩展里面有关系呢

,

Susan Yang:

李嘉辉 说:SPIData : origin=0x2A0000,length=0x50000                                    //外扩SRAM  存储数据

请问您外扩的SRAM是XINTF连接的?SPI的代码是跑在flash的?只是SPI的数据放在了外扩的SRAM?

,

李嘉辉:

外扩是XINTF连接的,SPI的代码不在FLAsH里,我只是把SPI的数据放在了外扩SRAM里

,

Susan Yang:

那看起来没有什么问题。

李嘉辉 说:  会不会是SPI这部分程序在FLASH里面没有被复制到RAM里面运行?

若是对时间要求比较高的的话,建议将SPI拷贝到RAM中去执行。

,

李嘉辉:

SPI接收的数据我进行FFT计算  需要快速响应   我的这些程序都在RAM里执行  考虑倒着这个都没有往外扩SRAM放

,

Susan Yang:

李嘉辉 说:但是SPI中断接受会出现丢失数据的情况。

那您数据丢失的表现是怎样的?

,

李嘉辉:

这是接收缓存  正常我接受的数据长度是八位    会出现16位数据的情况,不符和我发送的数据

如果说是SPI的时序不匹配的话  SRAM模式接收也会出错,  我这里SPI接收用的FIFO方式接收的

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28335: Flash烧写程序运行出错
分享到: 更多 (0)