Help on McBSP on 5409 a Anyone I have a problem thats making me nuts. I have McBSP2 set to Clockstop mode (As a SPI MASTER) to talk to a Ramtrom serial Ram. I can clock data out to it ( Waveforms on the scope look perfect ). I have a very simple routine to read the port, just polling the RRDY line and moving the data into an array. All signals again look perfect on the scope CLK, CS, SI, SO all meet timing requirements. I can see the data out of the ram is exactly what I clock into it. The McBSP just is not reading it. Unless I put a breakpoint |
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< u16 whaz_tx(){ unsigned int tw_stat,tw_temp; tw_stat=0x0004; *Mcbsp2_SubAddPtr = SPCR2_sa; NOP; NOP; NOP; while( tw_stat != 0 ){ tw_temp = *Mcbsp2_SubAddDataPtr; tw_stat = tw_temp & 0x0004; } while( tw_stat == 0 ){ tw_temp = *Mcbsp2_SubAddDataPtr; tw_stat = tw_temp & 0x0002; } NOP; NOP; NOP; } //------------ u16 whaz_rx(){ unsigned int rw_stat,rw_temp,rw_err; rw_err 00; rw_stat=0x0000; *Mcbsp2_SubAddPtr = SPCR1_sa; while( rw_stat == 0 ){ *Mcbsp2_SubAddPtr = SPCR1_sa; rw_temp = *Mcbsp2_SubAddDataPtr; rw_stat=rw_temp&0x0002; rw_err--; if (rw_err==0) return(1); } return(0); } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void philstest(){ unsigned int temp; Smem =0x00; // force address 0 Mcbsp2_Init(); delay(500); // *IMR = IMR_TINT; // *IFR = 0xffff; // clear all pending interrupts //- initizalizes enables // GLOBAL_INT_ENABLE; while(1){ tbuf[0]=0; tbuf[1]=0; tbuf[2]=0; tbuf[3]=0; tbuf[4]=0; tbuf[5]=0; tbuf[6]=0; tbuf[7]=0; //--------------------------------- temp =0; goto jump_over; // jump over write data section for now ( I know its in there now ) Mcbsp2_TX(0x06); // write enab whaz_tx(); Smem =0x00; // deselect Mcbsp2_TX(0x02); // write command Mcbsp2_TX(0x00); // addr Mcbsp2_TX(0x00); // addr Mcbsp2_TX(0x31); // val 1 Mcbsp2_TX(0x32); // val 2 Mcbsp2_TX(0x33); // val 3 Mcbsp2_TX(0x44); // val + Mcbsp2_TX(0x45); // val + Mcbsp2_TX(0x46); // val + whaz_tx(); Smem =0x00; // deselect jump_over: //------->> Mcbsp2_TX(0x03); // read command Mcbsp2_TX(0x00); // address Mcbsp2_TX(0x00); // adresss //delay(2000); temp= *pMcBSP2_rr1; //clear anything in there <----- works if I put a break here??? whaz_tx(); // <----- works if I put a break here??? Mcbsp2_TX(0x00); // nulls for clocks <----- works if I put a break here??? whaz_tx(); // << --------- errors(oxffff) on a break here on first data ??? if (whaz_rx()==0) tbuf[0]= *pMcBSP2_rr1; else tbuf[0]=0xffff; Mcbsp2_TX(0x00); // nulls for clocks whaz_tx(); if (whaz_rx()==0) tbuf[1]= *pMcBSP2_rr1; else tbuf[1]=0xffff; Smem =0x00; // deselect the chip select for the RAM NOP; NOP; NOP; if ((tbuf[0]!=0)||(tbuf[1]!=0)){ NOP; // <<<--------------------------------- break here to see if got data in buffer } if (tbuf[0]!=0){ NOP; } NOP; NOP; NOP; } |
|
Help on McBSP on 5409 a ( Oops file got dropped )
Started by ●July 15, 2002
Reply by ●July 17, 20022002-07-17
I figured out what I was doing wrong. I forgot that the RX and TX clocks are connected in SPI(Clock Stop) mode and the RX buffer a triple buffer that so as I clock out my address I'm clocking in the memory command and address zero into the 3 RX buffers. I just disabled the RX until I'm done clocking out the command and address. I'm a bit new to the TI MCBSP's I've used ADI & MOT DSPS for the most part. It was a dumb mistake(Aren't they all?) I knew I was doing something silly. Phil --- phil black <> wrote: > > Help on McBSP on 5409 a > > Anyone > I have a problem thats making me nuts. > I have McBSP2 set to Clockstop mode (As a SPI > MASTER) > to talk to a Ramtrom serial Ram. I can clock data > out > to it ( Waveforms on the scope look perfect ). > > I have a very simple routine to read the port, just > polling the RRDY line and moving the data into an > array. All signals again look perfect on the scope > CLK, CS, SI, SO all meet timing requirements. I can > see the data out of the ram is exactly what I clock > into it. The McBSP just is not reading it. Unless I > put a breakpoint > > _____________________________________ > 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: Send an email to > To Post: Send an email to > > To Leave: Send an email to > Archives: http://www.yahoogroups.com/group/c54x > > Other Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/ > > > //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > u16 whaz_tx(){ > unsigned int tw_stat,tw_temp; > > tw_stat=0x0004; > *Mcbsp2_SubAddPtr = SPCR2_sa; > > NOP; > NOP; > NOP; > > while( tw_stat != 0 ){ > tw_temp = *Mcbsp2_SubAddDataPtr; > tw_stat = tw_temp & 0x0004; > } > while( tw_stat == 0 ){ > tw_temp = *Mcbsp2_SubAddDataPtr; > tw_stat = tw_temp & 0x0002; > } > > NOP; > NOP; > NOP; > > } > > //------------ > u16 whaz_rx(){ > unsigned int rw_stat,rw_temp,rw_err; > > rw_err 00; > rw_stat=0x0000; > *Mcbsp2_SubAddPtr = SPCR1_sa; > while( rw_stat == 0 ){ > *Mcbsp2_SubAddPtr = SPCR1_sa; > rw_temp = *Mcbsp2_SubAddDataPtr; > rw_stat=rw_temp&0x0002; > rw_err--; > if (rw_err==0) return(1); > } > > return(0); > > } > //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > void philstest(){ > unsigned int temp; > > Smem =0x00; // force address 0 > > Mcbsp2_Init(); > > delay(500); > > // *IMR = IMR_TINT; > // *IFR = 0xffff; // clear all pending > interrupts > > //- initizalizes enables > // GLOBAL_INT_ENABLE; > > while(1){ > > tbuf[0]=0; > tbuf[1]=0; > tbuf[2]=0; > tbuf[3]=0; > tbuf[4]=0; > tbuf[5]=0; > tbuf[6]=0; > tbuf[7]=0; //--------------------------------- > temp =0; > goto jump_over; // jump over write data section > for now ( I know its in there now ) > > Mcbsp2_TX(0x06); // write enab > whaz_tx(); > Smem =0x00; // deselect > Mcbsp2_TX(0x02); // write command > Mcbsp2_TX(0x00); // addr > Mcbsp2_TX(0x00); // addr > > Mcbsp2_TX(0x31); // val 1 > Mcbsp2_TX(0x32); // val 2 > Mcbsp2_TX(0x33); // val 3 > Mcbsp2_TX(0x44); // val + > Mcbsp2_TX(0x45); // val + > Mcbsp2_TX(0x46); // val + > whaz_tx(); > > Smem =0x00; // deselect > > jump_over: > //------->> > Mcbsp2_TX(0x03); // read command > Mcbsp2_TX(0x00); // address > Mcbsp2_TX(0x00); // adresss > //delay(2000); > temp= *pMcBSP2_rr1; //clear anything in there > <----- works if I put a break here??? > > whaz_tx(); // > <----- works if I put a break here??? > > Mcbsp2_TX(0x00); // nulls for clocks > <----- works if I put a break here??? > whaz_tx(); // << > --------- errors(oxffff) on a break here on first > data ??? > > if (whaz_rx()==0) tbuf[0]= *pMcBSP2_rr1; > else tbuf[0]=0xffff; > > Mcbsp2_TX(0x00); // nulls for clocks > whaz_tx(); > > if (whaz_rx()==0) tbuf[1]= *pMcBSP2_rr1; > else tbuf[1]=0xffff; > > Smem =0x00; // deselect the chip select for > the RAM > > NOP; > NOP; > NOP; > > if ((tbuf[0]!=0)||(tbuf[1]!=0)){ > NOP; // > <<<--------------------------------- break here to > see if got data in buffer > } > > if (tbuf[0]!=0){ > NOP; > } > > NOP; > NOP; > NOP; > > } __________________________________________________ |