Setting max EMC frequency from code

Dear Toradex,

We are using the T30 modul and WEC2013 with latest release using DFS…

In some cases, when using a lot of Ethernet communication, the module can sometime get to hot.(More then 115 decree)

But lowering the maximum allowed EMC clock from 800 MHz to 400 MHz does the trick. It never goes over 80 decree then. And we have not seen any performance issue lowing the EMC clock max frequency. (With our application anyway).

We do the change using the Task Manager, by selecting the EMC clock and then set the max value to 400 MHz.
But we really would like to do this from our application, because this is the must flexible way of doing it. Then it can be changed in the future if needed, without changing registry or image update.

I have looked in the FreqLib and the demo for it and I cant figure out how to do this with that Library? What have I missed?

Thomas

It is possible from the Task Manager, so it must be possible to also do it from code.

The only function in the FreqLIB API is the FRQSetTEGFrequency, but that only sets the clock frequencies.

I need to set the EMC gart to 400 MHz through the API.

567-taskmanager.jpg

Dear @TJO

Please use the following code snipped to set an upper and lower limit for the EMC frequency.
I merged it from various source files and didn’t build it anymore - I hope I didn’t introduce any error…

typedef DWORD (*PFNNvRmOpen)              (DWORD *pHandle, DWORD DeviceId); 
typedef void  (*PFNNvRmClose)             (DWORD hDevice); 
typedef DWORD (*PFNNvRmDfsSetEmcEnvelope) (DWORD hRmDeviceHandle, DWORD DfsEmcLowCornerKHz, 
                                           DWORD DfsEmcHighCornerKHz); 

static PFNNvRmOpen              NvRmOpen; 
static PFNNvRmClose             NvRmClose; 
static PFNNvRmDfsSetEmcEnvelope NvRmDfsSetEmcEnvelope; 

DWORD g_rm;

//====== Code to read CPU temperature ======
void SetEmcFreq()
{
    HMODULE           hMod;
    NvRmDfsClockUsage clk_cpu;

    hMod                  = LoadLibrary(L"libnvrm.dll");
    NvRmOpen              =              (PFNNvRmOpen)GetProcAddress(hMod, "NvRmOpen");
    NvRmClose             =             (PFNNvRmClose)GetProcAddress(hMod, "NvRmClose");
    NvRmDfsSetEmcEnvelope = (PFNNvRmDfsSetEmcEnvelope)GetProcAddress(hMod, "NvRmDfsSetEmcEnvelope");

    NvRmOpen(&g_rm, 0);

    // This is the actual call to limit the EMB frequency - everything else is initialization
    PFNNvRmDfsSetEmcEnvelope(g_rm, 100*1000, 450*1000);

    NvRmClose(g_rm);
}

Regards
Andy

Thanks,

I will test it asap to see if it works.