Hello,
I'm using the ADSP-21992
I'm having trouble with the DAC_Init. I'm not using the DAC in my
program.
In addition my code for the inititalisation.
In that code you can see that DAC_Init is not ran through first, but in
init_interrupts it is. When I remove '//' before DAC_Init, and delete
DAC_Init in the init_interrupts, then I have other results, the same happens
when I remove DAC_Init globally, normally no problem because I don't use
the DAC...
My headprogram looks like the following:
I'm using a loop where nothing happens.
Interrupt services:
PWM_sync is done once, then this interrupt is put of, but timer_1 is put on,
after this interrupt happened, timer_0 is put on, the same with ADC_EOC_isr and
timer_1 is put of.
So next timer_0 runs of, this starts the ADC_EOC (the analog signals are
processed and saved). Coming in ADC_EOC_Isr the calculations start and the
digital signals from the ADC are read in in the registers, and every time a new
duty ratio is calculated. I send the errorsignal to the PI32 (which has been
arranged because there was a problem with the PI gotten from ADSP program
itselves)
Only when an interrupt occurs, the program jumps to that interrupt. When a
higher interrupt occurs, all the registers are saved and recalled at the end of
the IRQ service routine. I'm not using the DAC.
Can somebody help me with the DAC? I've heard that there are other people
who have the same problem with the DAC_Init... Is there something wrong with my
DAC_Init? Can somebody get me another DAC_Init for the ADSP-21992 EZ-kit
lite?
thx,
Reinhart
Start:
dmpg1 = 0;
dmpg2 = 0;
ijpg = 0;
AX0 = 0x0A50;
call SetPLL;
dis int;
PI32_Init(PI_Delay32, 0x0000);
call init_PF;
call init_ADC;
call init_timer0;
call init_timer1;
call init_pwm;
// DAC_Init;
call init_interrupts;
ena int;
//****************************************************************
cyclocross: // ***** headprogram *****
nop;
nop;
nop;
jump cyclocross;
//****************************************************************
init_interrupts:
iopg = 0;
IRPTL = 0x0000;
ICNTL = 0x0010;
IMASK = 0x0000;
DAC_Init;
IOPG = IntCtrl_Page;
ar = 0xBBBB;
io(IPR1) = ar;
io(IPR6) = ar;
io(IPR4) = ar;
io(IPR7) = ar;
ar = 0x1BBB;
io(IPR3) = ar;
ar=0xBB03;
io(IPR5) = ar;
ar=0xBBB2;
io(IPR2) = ar;
IMASK = 0x0040;
Set_InterruptVector(INT4_ADDR,timer1_isr); // done once
Set_InterruptVector(INT5_ADDR,ADC_EOC_isr); // done after
timer0_isr occurs
Set_InterruptVector(INT6_ADDR,pwmsync_isr); //done once at the beginning
Set_InterruptVector(INT7_ADDR,timer0_isr); // done every time timer0 runs
of.
rts;
//****************************************************************
I use the DAC_Init as it comes withe the EZ-kit lite itselves. This is the
code:
#define DAC_Init \
call DAC_Init_
DAC_Init_:
iopg = SPI0_Controller_Page;
ar = b#0001010100000101;
/*
0=reserved
0=SPI disabled
0=normal output enable
1=SPI is master
0tive HIGH SCLK
1=SCLK starts toggling at the beginning of the first data bit
0=MSB sent first
1 bits
00=reserved
0=MISO as output disabled
0=SPISS disabled
0=discard incoming data when RDBR full
1=send last word when TDBR empty
01=initiate transfer by write to transmit buffer
*/
IO(SPICTL0) = ar; // not enabled yet
ar = IO(SPIFLG0);
ay0= 0x0C0C;
ar = ar or ay0;
IO(SPIFLG0) = ar; // set PF2 and PF3 as SS and high
ar = Ratio_IO_clock_over_SCLK / 2;
IO(SPIBAUD0) = ar; // clock speed
ax0 = Dac_Channels; // base registers
reg(b0) = ax0;
ax0 = Dac_buffer;
reg(b1) = ax0;
ar = IO(SPICTL0);
ar = setbit 14 of ar;
IO(SPICTL0) = ar; // enable SPI
ay0 = 0x8030; //BUF(unbuffered), Gain(0-2Vref) ,
//VDD(Vdd is not used as reference
call Send_Message;
ay0 = 0xA001; //LDAC=LDAC permanently HIGH
call Send_Message;
rts;
DAC_Init_.end:
Send_Message:
ar = IO(SPIFLG0);
ar = clrbit 10 of ar; // ss active PF2
IO(SPIFLG0) = ar;
IO(TDBR0) = ay0;
call Wait_for_SPI_finished;
ar = IO(SPIFLG0);
ar = setbit 10 of ar; // ss inactive PF2
IO(SPIFLG0) = ar;
rts;
Wait_for_SPI_finished:
ar = IO(SPIST0);
ar = tstbit 0 of ar;
if EQ jump Wait_for_SPI_finished;
rts;