# Measuring the fpga and board temperature from fpga registers

**andrea.bartolini**Oct 3, 2011 6:25 AM

Dear All,

I'm currently issuing the following problem, thus I would like to know if anyone of you had encounterd it and maybe knows already the solution.

I made a c program to sample the power consumption of SCC and the fpga and board temperatures directly from inside an SCC core. This is done by using the power managment registers built in in the fpga with the latest 1.4.1 sccKit.

I'm currently sampling them every 1s, I'm reading the SCC voltage and current and the digital part of the memory controller one plus the board temperature and fpga ones.

Whereas the power ones work fine, sometime I obtain a spyke, but they change accorndingly with the workload in execution, the board temperature and fpga one stay constant. If I'm using instead the sccBmc -c status instead the board and fpga temperatures changes?

Does any one of you did use the fpga and board temperature from inside? Is there any specific activation register, such as the one for the voltage and current one? I check in the sccKit specification but I didn't found it.

Thanks in advance,

Best,

Andrea

Here I post the setting and the way I access the counters:

/*Define*/

#define FPGA_REG 0xf9000000

#define POW_BASE 0x08400

#define POW_3V3SCC_V 0x0841C //[15..0] valid bit

#define POW_3V3SCC_VS 0.0002500000 //[15..0] valid bit

#define POW_3V3SCC_I 0x08424 //[15..0] valid bit

#define POW_3V3SCC_IS 0.0062490250 //[15..0] valid bit

#define POW_1V1VCCT_V 0x08508 //[15..0] valid bit

#define POW_1V1VCCT_VS 0.0001250000 //[15..0] valid bit

#define POW_1V1VCCT_I 0x0850C //[15..0] valid bit

#define POW_1V1VCCT_IS 0.0006249025 //[15..0] valid bit

#define TFPGA 0x08554 //[15..0] valid bit

#define TSCC 0x08558 //[15..0] valid bit

#define POW_WATCHDOGL 0x08568 //[7..0] valid bits

#define POW_WATCHDOGH 0x0856C //[7..0] valid bits

#define POW_ENREG 0x0842C //[12..0] bit valib

#define POW_ENMASK 0x0F80 //0000 1111 1000 0000

void* addressMemAl(unsigned int ConfigAddr, unsigned int * pageOffset, unsigned int NCMDeviceFD){

unsigned int alignedAddr, PAGE_SIZE;

PAGE_SIZE = getpagesize();

alignedAddr = ConfigAddr & (~(PAGE_SIZE-1));

*pageOffset = ConfigAddr - alignedAddr;

return (void*) mmap(NULL, PAGE_SIZE, PROT_WRITE|PROT_READ,MAP_SHARED, NCMDeviceFD, alignedAddr);

};

/*Inizializzation */

powAddr = addressMemAl(FPGA_REG + POW_BASE, &OffsetPow, NCMDeviceFD);

*(unsigned int*)(powAddr + OffsetPow + POW_ENREG - POW_BASE) = POW_ENMASK;

*(unsigned int*)(powAddr + OffsetPow + POW_WATCHDOGL - POW_BASE) = 0L;

*(unsigned int*)(powAddr + OffsetPow + POW_WATCHDOGH - POW_BASE) = 0L;

/* Data reading*/

Dataf[0+i*4] = (float)(*(unsigned int*)(powAddr + OffsetPow + POW_3V3SCC_V - POW_BASE))*POW_3V3SCC_VS ;

Dataf[1+i*4] = (float)(*(unsigned int*)(powAddr + OffsetPow + POW_3V3SCC_I - POW_BASE))*POW_3V3SCC_IS;

Dataf[2+i*4] = (float)(*(unsigned int*)(powAddr + OffsetPow + POW_1V1VCCT_V - POW_BASE))*POW_1V1VCCT_VS;

Dataf[3+i*4] = (float)(*(unsigned int*)(powAddr + OffsetPow + POW_1V1VCCT_I - POW_BASE))*POW_1V1VCCT_IS;

Datai[0+i*2] = (int)*(unsigned int*)(powAddr + OffsetPow + TFPGA - POW_BASE);

Datai[1+i*2] = (int)*(unsigned int*)(powAddr + OffsetPow + TSCC - POW_BASE);