The following pertains to Metrowerks CodeWarrior V5.0.3 (latest patch 3) targeted to DSP56807. A project was created using EABI stationary. The HW target is a Motorola DSP-56807 EVM. The following function configures memory-mapped registers for port D. void InitPortD(void) { short *dataptr; /* Used to access X: memory */ dataptr=(short *)PDIAR; /* for debugging only */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDIENR; /* interrupt detection disabled */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDIPOLR; /* disabled when PDIENR=0 */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDIESR; /* interrupts not recorded */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDDDR; /* all ports outputs */ asm(nop); *dataptr=(short)0x00ff; dataptr=(short *)PDDR; /* all ports 1 */ asm(nop); *dataptr=(short)0x00ff; dataptr=(short *)PDPER; /* DDR determines direction */ asm(nop); *dataptr=(short)0x0000; } /* void InitPortD(void) */ I get two results depending on how the code is run. I get one result (registers configured currently), when I execute out of SRAM (whether I execute to a breakpoint after the code and look at the registers in memory, or whether I single-step (F11) through the code). I also get this same result when single-stepping (F11) through the same code running in FLASH. The following is the correct configuration of these registers, starting at X:$13E0 00FF 00FF 00FF 0000 0000 0000 0000 0000 0000 00FF 00FF 00FF 00FF 00FF 00FF 00FF I get another result (registers incorrectly configured) when I run (F5) from FLASH, and halt or break after the code. Thinking that it must be a timing issue, I put the nops in; but that made no difference.) Examining the compiler output, I now realize that the compiler automatically puts in nops anyway. I have spent a considerable amount of time experimenting with various compiler and debugger settings. The following is the (incorrect) configuration of these registers, starting at X:$13E0 00FF 0000 0000 00FF 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 Specifically, the data direction (X:$13E2) and perhipheral enable (X:$13E3) are incorrecly configured. Initialization of Port D registers in this example is just one case where I've been having trouble initialization memory-mapped registers. I've had numerous other similar problems. - Bill Schintler |
|
Difficulty configuring DSP56807 memory-mapped registers from FLASH program
Started by ●December 26, 2002
Reply by ●January 2, 20032003-01-02
Have you checked to see if your stack might be overflowing? Also, have a
look at which interrupts are enabled, your problem might be caused by an ISR accessing the same memory-mapped registers. What we do in a case like this, is to disable interrupts, then change all the register values, then re-enable interrupts. I hope this helps. Regards, Art Johnson Senior Systems Analyst PMC Prime Mover Controls Inc. 3600 Gilmore Way Burnaby, B.C., Canada V5G 4R8 Phone: 604 433-4644 FAX: 604 433-5570 Email: http://www.pmc-controls.com -----Original Message----- From: wjschint <> [mailto:] Sent: Thursday, December 26, 2002 12:53 PM To: Subject: [motoroladsp] Difficulty configuring DSP56807 memory-mapped registers from FLASH program The following pertains to Metrowerks CodeWarrior V5.0.3 (latest patch 3) targeted to DSP56807. A project was created using EABI stationary. The HW target is a Motorola DSP-56807 EVM. The following function configures memory-mapped registers for port D. void InitPortD(void) { short *dataptr; /* Used to access X: memory */ dataptr=(short *)PDIAR; /* for debugging only */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDIENR; /* interrupt detection disabled */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDIPOLR; /* disabled when PDIENR=0 */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDIESR; /* interrupts not recorded */ asm(nop); *dataptr=(short)0x0000; dataptr=(short *)PDDDR; /* all ports outputs */ asm(nop); *dataptr=(short)0x00ff; dataptr=(short *)PDDR; /* all ports 1 */ asm(nop); *dataptr=(short)0x00ff; dataptr=(short *)PDPER; /* DDR determines direction */ asm(nop); *dataptr=(short)0x0000; } /* void InitPortD(void) */ I get two results depending on how the code is run. I get one result (registers configured currently), when I execute out of SRAM (whether I execute to a breakpoint after the code and look at the registers in memory, or whether I single-step (F11) through the code). I also get this same result when single-stepping (F11) through the same code running in FLASH. The following is the correct configuration of these registers, starting at X:$13E0 00FF 00FF 00FF 0000 0000 0000 0000 0000 0000 00FF 00FF 00FF 00FF 00FF 00FF 00FF I get another result (registers incorrectly configured) when I run (F5) from FLASH, and halt or break after the code. Thinking that it must be a timing issue, I put the nops in; but that made no difference.) Examining the compiler output, I now realize that the compiler automatically puts in nops anyway. I have spent a considerable amount of time experimenting with various compiler and debugger settings. The following is the (incorrect) configuration of these registers, starting at X:$13E0 00FF 0000 0000 00FF 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 Specifically, the data direction (X:$13E2) and perhipheral enable (X:$13E3) are incorrecly configured. Initialization of Port D registers in this example is just one case where I've been having trouble initialization memory-mapped registers. I've had numerous other similar problems. - Bill Schintler _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/motoroladsp More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ |