• AVR Freaks

Harmony V2 - issue with TCP/IP stack on external RAM

Author
rellner
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/09/10 08:42:58
  • Location: 0
  • Status: offline
2019/09/10 22:25:42 (permalink)
0

Harmony V2 - issue with TCP/IP stack on external RAM

Hi,
 
I'm trying to use the external RAM for the TCP/IP stack. FreeRTOS is configured with 5 heap regions (1 in internal RAM, 4 in external RAM [0xC0000000, 0xC0100000, 0xC0200000, 0xC0300000]). The TCP/IP stack is configured with
 

#define TCPIP_STACK_USE_EXTERNAL_HEAP
#define TCPIP_STACK_MALLOC_FUNC pvPortMalloc
#define TCPIP_STACK_CALLOC_FUNC pvPortCalloc
#define TCPIP_STACK_FREE_FUNC vPortFree
#define TCPIP_STACK_HEAP_USE_FLAGS TCPIP_STACK_HEAP_FLAG_NO_MTHREAD_SYNC
#define TCPIP_STACK_HEAP_USAGE_CONFIG TCPIP_STACK_HEAP_USE_DEFAULT
#define TCPIP_STACK_SUPPORTED_HEAPS 1

 
Upon startup, the TCP stack is able to allocate memory from FreeRTOS. During startup _MACDeinit is called which frees up buffers by calling _MacRxFreeCallback and _MacTxFreeCallback.
These two functions call DRV_ETHMAC_LibDescriptorGetBuffer. In DRV_ETHMAC_LibDescriptorGetBuffer it is checked if a buffer exists. If yes, it is returned with an address translation.

if(pEDcpt->hwDcpt.pEDBuff != 0)
{
pBuff=(pEDcpt->hwDcpt.hdr.kv0?PA_TO_KVA0((int)pEDcpt->hwDcpt.pEDBuff):PA_TO_KVA1((int)pEDcpt->hwDcpt.pEDBuff));
}

However, this address translation calculates addresses that are invalid and we get a "data bus error" (Type: 1; Cause: 7) upon accessing the memory location. So I'm wondering if anybody can provide a hint what I am missing here? Does this kind of setup require to map the external RAM to specific locations? Why do we need the mapping between PA and KVA addresses
in the first place?
 
Best regards,
Ralf
 
Environment:
* PIC32MZ2048EFM144
* Harmony Configurator 2.0.6.0
* TCP/IP Stack 7.31
* FreeRTOS
* External RAM (4 x 512K)
#1

1 Reply Related Threads

    rainad
    Moderator
    • Total Posts : 1209
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: Harmony V2 - issue with TCP/IP stack on external RAM 2019/09/12 05:21:16 (permalink)
    0
    The translation in the MAC driver is needed to present the physical addresses of the buffers to the DMA engines - the DMA knows nothing about virtual addresses, used only by CPU/software.
    The functions used for this translation, map between the kernel segments, K0 and K1 and it won't work for RAM that's outside K0 and K1.
    You need to instrument the code and change to your own mapping function.
     
     
    #2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5