This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi All,
I am using TMS320F28069 MCU and CCS 6. I am trying to communicate with the bulk device between our own hardware and GUI. I send 30 bytedata every 500ms with USBBufferDataWritten() function
I am no problem sending data from the beginning. But 6-7 minutes later MCU send no data anymore. I've checked in debug mode where the problem could be and I realized that the lower layer of USB has no space to accept another packet of data. Because "ulPacket " value stay as "0 " in ScheduleNextTransmission().
static void ScheduleNextTransmission(const tUSBBuffer *psBuffer)
{
tUSBBufferVars *psVars;
unsigned long ulPacket, ulSpace, ulTotal;
//
// Get a pointer to our workspace variables.
//
psVars = psBuffer->pvWorkspace;
//
// Ask the lower layer if it has space to accept another packet of data.
//
ulPacket = psBuffer->pfnAvailable(psBuffer->pvHandle);
//
// If we were returned something other than zero, we can write that number
// of bytes to the lower layer.
//
if(ulPacket)
{
//
// How much contiguous data do we have in the buffer?
//
ulSpace = USBRingBufContigUsed(&psVars->sRingBuf);
//
// How much total data do we have in the buffer?
//
ulTotal = USBRingBufUsed(&psVars->sRingBuf);
//
// Write the contiguous bytes to the lower layer assuming there is
// something to send.
//
if(ulSpace)
{
//
// Determine the maximum sized block we can send in this transfer.
//
ulSpace = (ulSpace < ulPacket) ? ulSpace : ulPacket;
//
// Call the lower layer to send the new packet. If the current
// data spans the buffer wrap, tell the lower layer that it can
// expect a second call to fill the whole packet before it
// transmits it.
//
psBuffer->pfnTransfer(psBuffer->pvHandle,
(psVars->sRingBuf.pucBuf +
psVars->sRingBuf.ulReadIndex), ulSpace,
(((ulSpace < ulPacket) &&
(ulSpace < ulTotal)) ? false : true));
//
// Do we need to send a second part to fill out the packet? This
// will occur if the current packet spans the buffer wrap.
//
if((ulSpace < ulPacket) && (ulSpace < ulTotal))
{
//
// The packet straddled the wrap. How much space remains in
// the packet?
//
ulPacket -= ulSpace;
//
// How much data can we actually send?
//
ulSpace = ulTotal - ulSpace;
ulSpace = (ulSpace > ulPacket) ? ulPacket : ulSpace;
psBuffer->pfnTransfer(psBuffer->pvHandle,
psVars->sRingBuf.pucBuf, ulSpace, true);
}
}
//
// Don't update the ring buffer read index yet. We do this once we are
// sure the packet was correctly transmitted.
//
}
}
Can anyone has any idea why lower layer doesn't accept any packet of data?
Best Regards
Yusuf