Li Wei-
> I believe I have got the answer with your and TI
tech support's help. The
> problem of MCBSP_write16() is that it only sent data to DXR, and a long
> way from XSR to DX is left unsupervised by the code. If one want to write
> one UINT16 by McBsp and then close the McBsp. I believe the following is
> the best way to do it.
>
> while (!MCBSP_xrdy(hMcbsp1));
> MCBSP_write16(hMcbsp1, 0x3579); // 0x3579, data intended to write,
> goes to XSR
> while (!MCBSP_xrdy(hMcbsp1));
> MCBSP_write16(hMcbsp1, 0x1111); // 0x1111, dummy data, to DXR;
> 0x3579 goes to XSR
> while (!MCBSP_xrdy(hMcbsp1)); // dummy data goes to XSR, and 0x3579
> is shipped out by DX
> MCBSP_close(hMcbsp1);
Yes this looks very reasonable. My one comment would be to add some
time-out (escape) to the while loop in case the serial link breaks (other
end disconnects). From a high-level system perspective, at the time of
"closing" the McBSP port, anything could be happening.
-Jeff
Reply by liwe...@gmail.com●March 8, 20062006-03-08
I believe I have got the answer with your and TI tech support's help.
The problem of MCBSP_write16() is that it only sent data to DXR, and a long way
from XSR to DX is left unsupervised by the code. If one want to write one UINT16
by McBsp and then close the McBsp. I believe the following is the best way to do
it.
while (!MCBSP_xrdy(hMcbsp1));
MCBSP_write16(hMcbsp1, 0x3579); // 0x3579, data intended to write, goes to
XSR
while (!MCBSP_xrdy(hMcbsp1));
MCBSP_write16(hMcbsp1, 0x1111); // 0x1111, dummy data, to DXR; 0x3579 goes
to XSR
while (!MCBSP_xrdy(hMcbsp1)); // dummy data goes to XSR, and 0x3579 is
shipped out by DX
MCBSP_close(hMcbsp1);
Thanks to Jeff and Dileepan.