I'm trying to program flash addresses above 0xffff using the WRITA and READA instructions. It is not working. Is the timing of the address bus the same for these instructions as for normal data space writes? Flash programming is fine below 0xffff. The only thing I can think of is that the WRITA instruction behaves differently from regular writes. Here is my write function for reference (comes from a TI app note on the subject of accessing program space from C): .mmregs .if __far_mode=1 .c_mode .endif .def _PFUNC_wordWrite .text _PFUNC_wordWrite: .if __far_mode=1 FRETD ;delayed far return .else RETD ;delayed near return .endif WRITA *SP(0) ;write to program memory NOP ;fill 2nd delay slot of WRITA .end ;end of file |
|
WRITA / READA
Started by ●December 23, 2003
Reply by ●December 24, 20032003-12-24
Lucy- > I'm trying to program flash addresses above 0xffff using the WRITA > and READA instructions. It is not working. Is the timing of the > address bus the same for these instructions as for normal data space > writes? Flash programming is fine below 0xffff. The only thing I can > think of is that the WRITA instruction behaves differently from > regular writes. What processor is it? Since this is a memory address question, the processor type is critical, right? I assume it's C5402, C549, or C5409 since you're doing external device accesses below 64k. In that case, a good guess is to check your SWWSR and XSWR register settings. You would want the same number of wait-states in areas above 64k as below. Also, what is the delay between writes? I assume you are waiting 500 nsec or whatever the Flash device data sheet specifies between EEPROM writes. -Jeff > Here is my write function for reference (comes from a > TI app note on the subject of accessing program space from C): > > .mmregs > > .if __far_mode=1 > .c_mode > .endif > > .def _PFUNC_wordWrite > .text > _PFUNC_wordWrite: > > .if __far_mode=1 > FRETD ;delayed far return > .else > RETD ;delayed near return > .endif > > WRITA *SP(0) ;write to program memory > NOP ;fill 2nd delay slot of WRITA > > .end ;end of file |
|
Reply by ●January 5, 20042004-01-05
> Lucy- > > > I'm trying to program flash addresses above 0xffff using the WRITA > > and READA instructions. It is not working. Is the timing of the > > address bus the same for these instructions as for normal data space > > writes? Flash programming is fine below 0xffff. The only thing I can > > think of is that the WRITA instruction behaves differently from > > regular writes. > > What processor is it? Since this is a memory address question, the processor type is > critical, right? > It's a C5407 > I assume it's C5402, C549, or C5409 since you're doing external device accesses below > 64k. In that case, a good guess is to check your SWWSR and XSWR register settings. > You would want the same number of wait-states in areas above 64k as below. I'm only running it at 16MHz for now so wait states shouldn't be a problem. > Also, what is the delay between writes? I assume you are waiting 500 nsec or > whatever the Flash device data sheet specifies between EEPROM writes. > i'm assuming since writes below 0xFFFF work fine that everything is ok with the timing there. |
|
Reply by ●January 5, 20042004-01-05
I have tried this same program with external RAM (instead of flash) and as long as the program space address I write to is 0xFFFF and below it works. Then I try to use the same functions for above 0xFFFF and it does not work. The value is not written to RAM. --- In , "Lucy Jordan" <screaminglucy@y...> wrote: > > Lucy- > > > > > I'm trying to program flash addresses above 0xffff using the WRITA > > > and READA instructions. It is not working. Is the timing of the > > > address bus the same for these instructions as for normal data > space > > > writes? Flash programming is fine below 0xffff. The only thing I > can > > > think of is that the WRITA instruction behaves differently from > > > regular writes. > > > > What processor is it? Since this is a memory address question, the > processor type is > > critical, right? > > > > It's a C5407 > > > I assume it's C5402, C549, or C5409 since you're doing external > device accesses below > > 64k. In that case, a good guess is to check your SWWSR and XSWR > register settings. > > You would want the same number of wait-states in areas above 64k as > below. > > I'm only running it at 16MHz for now so wait states shouldn't be a > problem. > > > Also, what is the delay between writes? I assume you are waiting > 500 nsec or > > whatever the Flash device data sheet specifies between EEPROM > writes. > > > > i'm assuming since writes below 0xFFFF work fine that everything is > ok with the timing there. |
|
Reply by ●January 6, 20042004-01-06
Lucy- > I have tried this same program with external RAM (instead of flash) > and as long as the program space address I write to is 0xFFFF and > below it works. Then I try to use the same functions for above 0xFFFF > and it does not work. The value is not written to RAM. It sounds to me like you should use a digital scope to look at your address lines during READA instructions. For example, you should see A16 move if you access 0x10000, and of course that line should be connected to an address line on your external SRAM that makes sense. I would put the SRAM chip select and any enables being used on the scope and make sure they move when a small loop is run that makes repeated READA instructions. Probably within 30 minutes you will have some idea of what is wrong. Note that people often omit A15 from the DSP because they expect their code to run only in OVLY mode, which makes external A15 basically useless. -Jeff > --- In , "Lucy Jordan" <screaminglucy@y...> wrote: > > > Lucy- > > > > > > > I'm trying to program flash addresses above 0xffff using the > WRITA > > > > and READA instructions. It is not working. Is the timing of the > > > > address bus the same for these instructions as for normal data > > space > > > > writes? Flash programming is fine below 0xffff. The only thing > I > > can > > > > think of is that the WRITA instruction behaves differently from > > > > regular writes. > > > > > > What processor is it? Since this is a memory address question, > the > > processor type is > > > critical, right? > > > > > > > It's a C5407 > > > > > I assume it's C5402, C549, or C5409 since you're doing external > > device accesses below > > > 64k. In that case, a good guess is to check your SWWSR and XSWR > > register settings. > > > You would want the same number of wait-states in areas above 64k > as > > below. > > > > I'm only running it at 16MHz for now so wait states shouldn't be a > > problem. > > > > > Also, what is the delay between writes? I assume you are waiting > > 500 nsec or > > > whatever the Flash device data sheet specifies between EEPROM > > writes. > > > > > > > i'm assuming since writes below 0xFFFF work fine that everything is > > ok with the timing there. |
Reply by ●January 6, 20042004-01-06
Dear all, I have a large software which needs external memory . My DSP is TI C549. Now, I write the memory map as following : MEMORY { PAGE 0: FIRST : o=0x100, len=oxf000 PAGE 2: SECOND : o=0x8000, len =0x8000 PAGE 3: THIRD: o=0x8000, len=0x8000 ..... } SECTIONS { .text : >> FIRST| SECOND| THIRD // Link Err: can't find SECOND on page 0 // if I change to : // .text: >> FIRST PAGE 0 | SECOND PAGE 2 |THIRD PAGE 3 ;or : // .text : >>(FIRST PAGE 0 )| (SECOND PAGE 2 )|(THIRD PAGE 3 ) // both are Link Error : syntax error } For C549 can be extened to 128 pages , how to write the SECTIONS command to use this memory? Question 2: When I compile my program using "-mf" option, it says " warning: linking incompatible formats: file compiled with -mf" . How can I do ? Thx __________________________________________________ |
|
Reply by ●January 6, 20042004-01-06
Luo Jinhua- > Dear all, > > I have a large software which needs external memory > . My DSP is TI C549. Now, I write the memory map as > following : > > MEMORY > { > PAGE 0: > FIRST : o=0x100, len=oxf000 > > PAGE 2: > SECOND : o=0x8000, len =0x8000 > PAGE 3: > THIRD: o=0x8000, len=0x8000 > ..... > > } You have some problems there: -second page overlaps first -- either set first page end at 0x7fff or start second page at 0x18000 -far pages should start at 0x18000, 0x28000, etc. if you are running code in OVLY mode Your -mf problem below is because some files were not compiled yet using far mode; Rebuild All and compile/assemble every file using far mode. -Jeff > SECTIONS > { > .text : >> FIRST| SECOND| THIRD > // Link Err: can't find SECOND on page 0 > // if I change to : > // .text: >> FIRST PAGE 0 | SECOND PAGE 2 |THIRD > PAGE 3 ;or : > // .text : >>(FIRST PAGE 0 )| (SECOND PAGE 2 )|(THIRD > PAGE 3 ) > // both are Link Error : syntax error > > } > > For C549 can be extened to 128 pages , how to write > the SECTIONS command to use this memory? > > Question 2: > > When I compile my program using "-mf" option, it > says " warning: linking incompatible formats: file > compiled with -mf" . > > How can I do ? > > Thx |
Reply by ●January 7, 20042004-01-07
Jinhua- > Thank you very much. > I have passed the compile and link . But I can't run it . > When the program is loaded into simulator, it begins > "_c_int00", but the the next command is stochastic, sometimes > it brach to 0x8000, other time it goes another address. I > found somtimes the PC=0x28000,XPC=2; Sometimes ,the > PC=0x18000,XPC=0. My Vector table is like this: > .sect ".vectors" > .ref _c_int00 ; C entry point > .ref _main > .align 0x80 ; must be aligned on page boundary > RESET: ; reset vector > ;FBD _c_int00 ; branch to C entry point > FBD _main > STM #200,SP Something does not sound correct with "random command". I suggest that you try this: RESET: ; reset vector STM #0, XPC FB _main _main: STM #200,SP . . . Then you can be sure that correct things are happening, one step at a time. This is "walk, not run" strategy. -Jeff |