Hi All-
I am trying to optimize the NDK2.0 running on a DM648 for fast UDP reception. Per the NDK documentation, one of the low-hanging fruit to do this is move the packet buffers from their default (SDRAM) to internal memory (L2 SRAM). When I do this, the part refuses to send any packets (e.g., no DHCP request packet seen via wireshark on host).
I have chased this down as much as I can--whether packet buffers in internal or external memory, everything looks good into emacEnqueueTx(EMAC_DescCh *pdc) function in CSL_EMAC.c, with the one difference that, as expected, the packet buffer location is either in external memory or internal memory. At the end of this function, after descriptor is set up, there is a call to "turn on the transmitter" -- it the case of packet in external memory, this is when the packet gets sent, and received by PC. When in internal memory, nothing happens.
To switch between the two, I simply re-locate .far:NDK_PACKETMEM to IRAM, and comment out the below lines in ethdriver.c:
//#define EXTERNAL_MEMORY 1
//#define EXTMEM 0x80000000
This seemes to do the trick, but it seems the DMA in the 3PSW does not work when source of packet buffer is internal memory. Is there some other setting in the 3PSW I need to change, to tell the DMA which memory bank it will be doing DMA to/from?
Also, in trying to get to bottom of this, there is something I am very confused about--in CSL_EMAC.C, for example:
pRegAddr = &CPSW3G_REGS->TX_HDP[0];
*(pRegAddr + pdc->chInfo->chNum) = CPU_TO_HWBD(((Uint32)pDescOrg));
Is used to set the CPDMA transmit descriptor, which results in the DMA of the packet (at least in the case of packet in external memory). The location of the packet (pDescOrg) seems to agree with where the packet descriptor actually is on the DM648, so why to wee need to CPU_TO_HWBD, which subtracts 0x7E000 from this location?
Any help on this, or other tips to speed up UDP packet reception on the DM648, is greatly appreciated!
Best,
Jim