Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).
Dear list,
I have a problem when testing the software we made for our customized board on a 5510 DSK.
I use CCS 2.12.0.7, DSP/BIOS and C language. The code is designed to write to a peripheral by McBsp1, which is configured as SPI.
MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 100);
while (!MCBSP_xrdy(hMcbsp1));
MCBSP_write16(hMcbsp1, 0x0503); &nb sp;
MCBSP_close(hMcbsp1);
…"
When execution, I observed nothing on the oscilloscope attached to the DSK, obviously the McBsp1 didn't write. It seems to me the McBsp1 was closed before it wrote to peripheral. After I delete the last line of code: " MCBSP_close(hMcbsp1);" Then I saw the waveform on oscilloscope and McBsp1 worked. Why doesn't the code execute the sequence it was written. The code was compiled in debug mode and no optimization was performed. And I viewed the disassembled code and it was in the same sequence as the C.
Then I tried another section of code to see the execution sequence. I wanted the GPIO_PIN5 to generate a low pulse during the period when McBsp1 wrote to peripheral.
"….
GPIO_pinWrite(GPIO_PIN5, 0);
while (!MCBSP_xrdy(hMcbsp1));
MCBSP_write16(hMcbsp1, 0x0503);
GPIO_pinWrite(GPIO_PIN5, 1);
…"
To my surprise, as on the oscilloscope, the low pulse started and finished even before the start of McBsp1's writing. But the low pulse is supposed to exist during the procedure of McBsp1's writing. Again the code isn't optimized and it's in debug mode. The following is the disassembled code for this section.
02363A 6C023828 &nb sp; CALL _MCBSP_start
02363E 3C04 & nbsp; MOV #0,T0
023640 76002008 &nb sp; MOV #32,AC0
023644 6C023964 &nb sp; CALL __PGPIO_pinWrite
023648 76280448 &nb sp; MOV #10244,T0
02364C L1:
02364C ED31BF000318 MOV dbl(*(#0318h)),XAR3
023652 DF6105   ; MOV uns(*AR3),AC0
023655 10050A   ; SFTS AC0,#10,AC0
023658 220B & nbsp; MOV AC0,AR3
02365A A96B 99 &nb sp; MOV port(*AR3(T0)),AR1
02365D 180299   ; AND #2,AR1,AR1
023660 5091 & nbsp; SFTL AR1,#-1
023662 0409E7   ; BCC L1,AR1 == #0
023665 ED318F000318 MOV dbl(*(#0318h)),XAR0
02366B 76050348 &nb sp; MOV #1283,T0
02366F 6C023A78 &nb sp; CALL _MCBSP_write16
023673 3C14 & nbsp; MOV #1,T0
023675 76002008 &nb sp; MOV #32,AC0
023679 6C023964 &nb sp; CALL __PGPIO_pinWrite
02367D 4E01 & nbsp; AADD + #1,SP
02367F 4804   ; RET
My general question is how to make sure the code execute in the same sequence on they are written.
Thanks,
Wei
hi, its better to wait for the xrdy register to get empty before closing the mcbsp. try putting the xrdy register check before closing the mcbsp. The thing is in the sequence you mentioned,once the CSL writes to the xrdy register,the execution goes to the mcbsp close function. From the mcbsp hardware perspective,the xrdy needs some realistic time to flush out all the bits to the pins. regards, Dileepan. --- Wei Li <liwei2000@liwe...> wrote: > Dear list, > > I have a problem when testing the software we made > for our customized board > on a 5510 DSK. > > I use CCS 2.12.0.7, DSP/BIOS and C language. The > code is designed to write > to a peripheral by McBsp1, which is configured as > SPI. > > "… > *MCBSP_start(hMcbsp1, MCBSP_XMIT_START |* > > * MCBSP_SRGR_START | > MCBSP_SRGR_FRAMESYNC, 100); * > > *while (!MCBSP_xrdy(hMcbsp1));* > > *MCBSP_write16(hMcbsp1, 0x0503); * > > *MCBSP_close(hMcbsp1);* > > …" > > When execution, I observed nothing on the > oscilloscope attached to the DSK, > obviously the McBsp1 didn't write. It seems to me > the McBsp1 was closed > before it wrote to peripheral. After I delete the > last line of code: > "*MCBSP_close(hMcbsp1);" > *Then I saw the waveform on oscilloscope and McBsp1 > worked. Why doesn't the > code execute the sequence it was written. The code > was compiled in debug > mode and no optimization was performed. And I viewed > the disassembled code > and it was in the same sequence as the C. > > Then I tried another section of code to see the > execution sequence. I wanted > the GPIO_PIN5 to generate a low pulse during the > period when McBsp1 wrote to > peripheral. > > "…. > > GPIO_pinWrite(GPIO_PIN5, 0); > > while (!MCBSP_xrdy(hMcbsp1)); > > MCBSP_write16(hMcbsp1, 0x0503); > > GPIO_pinWrite(GPIO_PIN5, 1); > > …" > > To my surprise, as on the oscilloscope, the low > pulse started and finished > even before the start of McBsp1's writing. But the > low pulse is supposed to > exist during the procedure of McBsp1's writing. > Again the code isn't > optimized and it's in debug mode. The following is > the disassembled code for > this section. > > 02363A 6C023828 CALL _MCBSP_start > > 02363E 3C04 MOV #0,T0 > > 023640 76002008 MOV #32,AC0 > > 023644 6C023964 CALL > __PGPIO_pinWrite > > 023648 76280448 MOV #10244,T0 > > 02364C L1: > > 02364C ED31BF000318 MOV > dbl(*(#0318h)),XAR3 > > 023652 DF6105 MOV uns(*AR3),AC0 > > 023655 10050A SFTS AC0,#10,AC0 > > 023658 220B MOV AC0,AR3 > > 02365A A96B 99 MOV > port(*AR3(T0)),AR1 > > 02365D 180299 AND #2,AR1,AR1 > > 023660 5091 SFTL AR1,#-1 > > 023662 0409E7 BCC L1,AR1 == #0 > > 023665 ED318F000318 MOV > dbl(*(#0318h)),XAR0 > > 02366B 76050348 MOV #1283,T0 > > 02366F 6C023A78 CALL _MCBSP_write16 > > 023673 3C14 MOV #1,T0 > > 023675 76002008 MOV #32,AC0 > > 023679 6C023964 CALL > __PGPIO_pinWrite > > 02367D 4E01 AADD + #1,SP > > 02367F 4804 RET > > My general question is how to make sure the code > execute in the same > sequence on they are written. > > Thanks, > > Wei > __________________________________________________ ">http://mail.yahoo.com