Apr 10, 2009 12:56 AM
Assembler directive DC (Define Constant) does not work
I've had a serious problem when programming the pedal - the DC directive that is
used to define constant data in the processor internal memory does not work.
When reading the data defined with DC in the memory, only random data is
returned. I've checked this by printing out the values read from the memory
to the debug read fields in the TCDDK pedal software.
Is the DC directive even supposed to work?
Also, I'm using the new 1.1 version of the pedal software
(as with the older version any program with DC definitions
did not work at all!).
Here is a sample program that causes the problem:
- the program just runs the processor initialization and copies the TestConstantN values to the debug registers
- the interrupt vectors have been omitted from the program
- the program is based on the Line6 stereo EQ example
page 132,60
include "..\Ioequ.inc"
include "..\vectors4.inc"
list
;*********************
; X-memory allocations
;*********************
org x:$000
; Knob registers expect a value of 0x000000 thru 0x7FFFFF from the microcontroller
Knob_1 ds 1 ; 00h
Knob_2 ds 1 ; 01h
Knob_3 ds 1 ; 02h
Knob_4 ds 1 ; 03h
Knob_5 ds 1 ; 04h
Knob_6 ds 1 ; 05h
; Switch registers expect a value of 0,1, or 2 from the microcontroller
Switch_1 ds 1 ; 06h
Switch_2 ds 1 ; 07h
; FootSwitch registers expect a value of 0x000000 or 0x000001 from the microcontroller
FootSwitch_TopLayer ds 1 ; 08h
FootSwitch_BottomLayer ds 1 ; 09h
; LED registers are read by the micro and should be set to 0x000000 or 0x000001 (off and on)
LED_Red ds 1 ; 0ah
LED_Green ds 1 ; 0bh
; RX and TX registers
LeftRx ds 1 ; 0ch Left received sample
RightRx ds 1 ; 0dh Right received sample
LeftTx ds 1 ; 0eh Left sample to transmit
RightTx ds 1 ; 0fh Right sample to transmit
SHI_StateMachine ds 1 ; 10h current state of the serial host interface
HostCommand ds 1 ; 11h current SHI command
; Debug registers
Debug_Write_to_DSP_1 ds 1 ; 12h recieves data from the ToneCoreGUI application
Debug_Write_to_DSP_2 ds 1 ; 13h recieves data from the ToneCoreGUI application
Debug_Write_to_DSP_3 ds 1 ; 14h recieves data from the ToneCoreGUI application
Debug_Write_to_DSP_4 ds 1 ; 15h recieves data from the ToneCoreGUI application
Debug_Read_from_DSP_1 ds 1 ; 16h send data to the ToneCoreGUI application
Debug_Read_from_DSP_2 ds 1 ; 17h send data to the ToneCoreGUI application
Debug_Read_from_DSP_3 ds 1 ; 18h send data to the ToneCoreGUI application
Debug_Read_from_DSP_4 ds 1 ; 19h send data to the ToneCoreGUI application
; Foot Latch states
FootLatch ds 1 ; 20h
FootLatchMem ds 1 ; 21h
; Test constants
TestConstant1 dc $123456
TestConstant2 dc $345678
;*********************
; Y-memory allocations
;*********************
org y:$000
TestConstant3
dc 0.020216079055843
;*****************************************************************************************************
; The main program starts here. Include your initialization procedures at the end of the START section
;*****************************************************************************************************
org p:$4E
START
ori #$03,mr ; mask interrupts
movep #$2D0063,X:M_PCTL ; Set PLL Control Register: Fosc = 100 MHz = (100)(3 MHz)/3
bset #14,omr ; allow address attributes line to function independently
movep #>$000040,x:M_SAICR ; 4x4 Synchronous mode (use TX frame and bit clks)
movep #$FCC304,x:M_TCCR
movep #$FCC304,x:M_RCCR
movep #$707d00,x:M_RCR
movep #$027D80,x:M_TCR
movep #>$000000,x:M_PDRC ; Clear Port C data
movep #>$000BF8,x:M_PCRC ; Set appropriate Port C GPIO pins for ESAI .
movep #>$000C7E,x:M_PRRC ; Set pin direction of PORT C
movep #>$000000,x:M_PCRB ; Set up Port B for output
movep #>$00000F,x:M_PRRB ; Set up Port B for output
movep #>$000008,x:M_PDRB ; bit 0 = In_EMPH, bit 1 = OUT_DE_EMPH, bit 2 = DIRECT_ON, bit 3 = FX_ON
movep #>$000003,x:M_RSMA ; Enable first 2 time slots for receive.
movep #>$000000,x:M_RSMB ;
movep #>$000003,x:M_TSMA ; Enable first 2 time slots for transmit.
movep #>$000000,x:M_TSMB
movep #>$000000,x:M_TX0 ; zero out transmitter 0
; ENABLE ESAI
bset #0,x:M_RCR ; now enable RX0
bset #0,x:M_TCR ; now enable TX0
; Setup Expansion Port A for SRAM...
movep #$2406B5,x:M_AAR0
movep #$2003B1,x:M_AAR1
; Bus Control Register for SRAM...
movep #$0124A5,x:M_BCR ; 0001 0010 0100 0110 0011
; Set up SHI (Serial Host Interface to the MCU)...
movep #>$003001,x:M_HCKR ; Turn Data/Clk Line Filter to max, wide spike tolerance (100ns glitch)
movep #>$001189,x:M_HCSR ; CPHA=1, CPOL=0 : => same as reset/power-on.
; Initialize registers
move #>$000000,x0
move x0,r0
rep #28
move x0,x:(r0)+ ; clear start of x:mem
move #>$400000,x0 ; Intialize the knob registers
move x0,x:Knob_1
move x0,x:Knob_2
move x0,x:Knob_3
move x0,x:Knob_4
move x0,x:Knob_5
move x0,x:Knob_6
move #>$000000,x0
move #$00ffff,m5 ; Use r5 for the MCU parameter updates.
movep x0,x:M_HTX ; Assert HREQ* pin for the MCU.
; Initialize Peripheral Interrupt Priority Register for Audio Interrupts and SHI.
movep #$000007,x:M_IPRP ; ESAI int's enabled and top Priority, SHI int's enabled and lowest Priority.
andi #$FC,mr ;enable all interrupt levels
movep #>$000002,x:M_PDRC ; Take CODEC out of power down mode.
; -----------------------------------------
; Print out test data using debug registers
; -----------------------------------------
move x:TestConstant1,x0
move x0,x:Debug_Read_from_DSP_1 ; should print out $123456
move x:TestConstant2,x0
move x0,x:Debug_Read_from_DSP_2 ; should print out $345678
move y:TestConstant3,x0
move x0,x:Debug_Read_from_DSP_3
;------------------------------------------------------------
; Main loop
;------------------------------------------------------------
MainLoop
wait
; Waiting for interruptions from ESAI and SHI
jmp MainLoop
-
Like (0)