Project

General

Profile

Problem with uPP in DLB

Added by François Tremblay about 12 years ago

I am trying to use uPP in DLP mode with an MityDSP1810F board but my rx buffer is still empty after a "ransaction.

I am using modified version of DspUpp.cpp file.

Here code snipped

buffer.c

#pragma DATA_ALIGN(txBuffer, 8);
uint8_t txBuffer[1024];

#pragma DATA_ALIGN(rxBuffer, 8);
uint8_t rxBuffer[1024];

main.cpp


extern "C"{
extern uint8_t txBuffer[];
extern uint8_t rxBuffer[];
}

void initUppConfig(void)
{
  mUppConfig.nHWInterruptLevel = 4;
  mUppConfig.nTskPriorityChanA = 12;
  mUppConfig.nTskPriorityChanB = 12;
  mUppConfig.eChanADir = MityDSP::tcDspUpp::eeTransmit;
  mUppConfig.eChanBDir = MityDSP::tcDspUpp::eeReceive;
  mUppConfig.eChanBitWidthA =    MityDSP::tcDspUpp::ee8Bit;
  mUppConfig.eChanBitWidthB =    MityDSP::tcDspUpp::ee8Bit;
  mUppConfig.bChanAUseXData = false;
  mUppConfig.nMbxLenA = 16;
  mUppConfig.nMbxLenB = 16;
  mUppConfig.nChanAClkDiv = 15;
  mUppConfig.nChanBClkDiv = 15;
  mUppConfig.eThresholdTxA = MityDSP::tcDspUpp::ee64Bytes;
  mUppConfig.eThresholdRxA = MityDSP::tcDspUpp::ee64Bytes;
  mUppConfig.eThresholdTxB = MityDSP::tcDspUpp::ee64Bytes;
  mUppConfig.eThresholdRxB = MityDSP::tcDspUpp::ee64Bytes;
  mUppConfig.bChanAUseStart = true;
  mUppConfig.bChanBUseStart = true;
  mUppConfig.eTxClockSel = MityDSP::tcDspUpp::eePLL0_SYSCLK2;
  mUppConfig.nDmaMasterPriority = 0;

  mUppConfig.eUppDlb = MityDSP::tcDspUpp::eeA2B;

  // init uPP test buffers
  for(int i = 0 ; i < 1024; ++i)
  {
    txBuffer[i] = i;
    rxBuffer[i] = 0;
  }
}

void initTask(void)
{
  // [.. other initialization code]

  initUppConfig();
  custom_printf("TxBuffer Addr %08X\n", (uint32_t)txBuffer);
  custom_printf("RxBuffer Addr %08X\n", (uint32_t)rxBuffer);

  int val = MityDSP::tcDspUpp::getInstance()->initialize(&mUppConfig);
  custom_printf("uPP initialization result %d.\n", val);
  MityDSP::tcDspUpp::getInstance()->registerErrorCallback(uppErrorCallback);
  MityDSP::tcDspUpp::getInstance()->printRegisters();

  val = MityDSP::tcDspUpp::getInstance()->receive(MityDSP::tcDspUpp::eeChanB, rxBuffer, 1024);
  custom_printf("uPP receive result %d.\n", val);
  val = MityDSP::tcDspUpp::getInstance()->transmit(MityDSP::tcDspUpp::eeChanA, txBuffer, 1024);
  custom_printf("uPP transmit result %d.\n", val);

  struct MityDSP::tcDspUpp::tsMbxMsg mbxMsg;
  MBX_pend(MityDSP::tcDspUpp::getInstance()->getMBX(MityDSP::tcDspUpp::eeChanA), &mbxMsg, SYS_FOREVER);

  custom_printf("uPP tx result %d.\n", mbxMsg.nByteCnt);

  MBX_pend(MityDSP::tcDspUpp::getInstance()->getMBX(MityDSP::tcDspUpp::eeChanB), &mbxMsg, SYS_FOREVER);

  TSK_sleep(1000);
  custom_printf("uPP rx result %d.\n", mbxMsg.nByteCnt);

  custom_printf("uPP tx data %02x %02x %02x %02x.\n", (int)txBuffer[0], (int)txBuffer[1], (int)txBuffer[2], (int)txBuffer[3]);
  custom_printf("uPP rx data %02x %02x %02x %02x.\n", (int)mbxMsg.pBufPtr[0], (int)mbxMsg.pBufPtr[1], (int)mbxMsg.pBufPtr[2], (int)mbxMsg.pBufPtr[3]);
  custom_printf("uPP rx data %02x %02x %02x %02x.\n", (int)rxBuffer[0], (int)rxBuffer[1], (int)rxBuffer[2], (int)rxBuffer[3]);

}

Here how I added support to DLB in your DSP code driver.

DspUpp.cpp

// Program UPDLB reg (digital loopback)
switch(apDspUppConfig->eUppDlb)
{
case eeDlbDisabled:
  mpUppRegs->UPDLB = 0;
  break;

case eeA2B:
  mpUppRegs->UPDLB = 0x00001000;
  break;

case eeB2A:
  mpUppRegs->UPDLB = 0x00002000;
  break;

default:
  return -1;
}

Here the result

SP: uPP initialization result 0.
DSP: Register UPPID 44231100
DSP: Register UPPCR 00000009
DSP: Register UPDLB 00001000
DSP: Register UPCTL 20200007
DSP: Register UPICR 0F380F38
DSP: Register UPIVR FFFFFFFF
DSP: Register UPTCR 00000000
DSP: Register UPISR 00000000
DSP: Register UPIER 00000000
DSP: Register UPIES 00000F0F
DSP: Register UPIEC 00000F0F
DSP: Register UPEOI 00000000
DSP: Register UPID0 C6159280
DSP: Register UPID1 00010400
DSP: Register UPID2 00000000
DSP: Register UPIS0 00000000
DSP: Register UPIS1 00010000
DSP: Register UPIS2 00000080
DSP: Register UPQD0 C6159680
DSP: Register UPQD1 00010400
DSP: Register UPQD2 00000000
DSP: Register UPQS0 00000000
DSP: Register UPQS1 00010000
DSP: Register UPQS2 00000080
DSP: uPP receive result 0.
DSP: uPP transmit result 0.
DSP: uPP tx result 1024.
DSP: uPP rx result 1024.
DSP: uPP tx data 00 01 02 03.
DSP: uPP rx data 00 00 00 00.
DSP: uPP rx data 00 00 00 00.

Conclusion

The initialization sequence seems ok. I also got positive feedback from tx and rx transaction because I got response from mhMbxDoneA and mhMbxDoneB. However, the rx buffer is still empty.

Question 1:
Do you see any problem with the above code?

Question 2:
Do I need special pin muxing or the pinx mixing done in DspUpp.cpp should be correct

Question 3:
Do you have sucessfully used DLB with MityDSP1810F board in the past?

Question 4:
Do you have sample code that is using uPP in DLP?

Thanks

-François


Replies (6)

RE: Problem with uPP in DLB - Added by Gregory Gluszek about 12 years ago

Hi François,

We have not done any work with running the system in digital loopback mode. The fact that you are getting a response back and not just hanging on the receive mailbox is a good sign. The pinmuxing should not matter as digital loopback should happen internally in the uPP hardware. My guess it that this is a cache issue. You should make sure that the buffers you pass to the transmit and receive calls are invalided from cache as they will be directly accessed by a DMA engine inside the DspUpp Class. See functions BCACHE_wbInv() and BCACHE_inv() in the TMS320C6000 DSP BIOS 5_x API Reference Guide.

Thanks,
\Greg

RE: Problem with uPP in DLB - Added by François Tremblay about 12 years ago

Greg,

You was right on and you make my day!

Now, I have another question regarding the cache. I used the uPP in DLP mode for uPP driver integration. However, it is a temporary solution because our FPGA is not yet ready. When our FPGA will be ready, it will transmit data continuously.
So, the dataflow will be FPGA --> uPP --> DSP.

In such design, will I need to invalidate the cache each time I request a "receive transaction" on the uPP module?

Thanks!

-François

RE: Problem with uPP in DLB - Added by Gregory Gluszek about 12 years ago

François,

Glad to hear that fixed your problem!

In regards to your follow up question, yes, you will most likely need to invalidate the cache on your receive buffer each time before passing it into the DspUpp receive function in your future setup. If the system has touched that buffer (i.e. read from it or wrote to it) it most likely cached at least some portion of it for quicker future access. The only way to make sure the data written by the next receive call is not lost is to make sure no portion of the receive buffer is still cached.

Let us know if you have any other questions.

Thanks,
\Greg

RE: Problem with uPP in DLB - Added by François Tremblay about 12 years ago

Greg,

Thanks for answer.

By the way, do you have a dummy FPGA load (in .bin format) that output "known fake data" on uPP?

It can be very very very useful.

Thanks!

-François

RE: Problem with uPP in DLB - Added by Gregory Gluszek about 12 years ago

Hi François,

Sorry about the delay in my reply. And sorry, no, we do not have an generic FPGA loads that have uPP setups to test with at the moment.

\Greg

RE: Problem with uPP in DLB - Added by minh tung over 11 years ago

Hi François,
I am a newbie, and trying to create Upp Loopback with MityDSP1810F board.
Can you give your Upp Loopback source code.
my email:
Thank you very much!
Tungdm

    (1-6/6)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)