How do I change the heap size for Thread applications in Simplicity Studio™?
Answer
In your open project in App Builder. Select the Other tab.
Under Additional Macros. Select the Value of the Macro EMBER_HEAP_SIZE. The default is 8000.
Try changing this value to modify the heap size of your Thread application.
Save your .isc file than click Generate. Make sure to overwrite the .mak file when prompted to do so.
Right click your project folder in Project Explorer. Clean your project.
Right click your project again and Build your project. The heap size should be changed.
Confirm by searching for the .emheap tag in the .map file under [project_name]/[Compiler]/[project_name].map. In my case because my project name was client and I used the GNU ARM v7.2.1 - Default compiler configuration the path in the Project explorer is client/GNU ARM v7.2.1 - Default/client.map
.map file before modification:
.emheap 0x20000000 0x1f40
0x20000000 PROVIDE (__EMHEAP__begin, .)
*(.emheap .emheap.*)
.emheap 0x20000000 0x1f40 ./stack/thread-stack/ember-ip-configuration.o
0x20000000 heapMemory
[!provide] PROVIDE (__EMHEAP__end, .)
0x00001f40 PROVIDE (__EMHEAP__size, SIZEOF (.emheap))
0x20001f40 . = (RAM_BOTTOM + MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
0x20001f40 PROVIDE (__EMHEAP_OVERLAY__end, .)
[!provide] PROVIDE (__EMHEAP_OVERLAY__size, MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
As you can see the size of the .emheap is 0x1f40 in hexadecimal which is exactly the default 8000 in decimal.
.map file after rebuilding with the modified value (I used 9000)
.emheap 0x20000000 0x2328
0x20000000 PROVIDE (__EMHEAP__begin, .)
*(.emheap .emheap.*)
.emheap 0x20000000 0x2328 ./stack/thread-stack/ember-ip-configuration.o
0x20000000 heapMemory
[!provide] PROVIDE (__EMHEAP__end, .)
0x00002328 PROVIDE (__EMHEAP__size, SIZEOF (.emheap))
0x20002328 . = (RAM_BOTTOM + MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
0x20002328 PROVIDE (__EMHEAP_OVERLAY__end, .)
[!provide] PROVIDE (__EMHEAP_OVERLAY__size, MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
As you can see the size of the .emheap changed to 0x2328 in hexadecimal which is exactly the 9000 in decimal value I set.
Zigbee & Thread Knowledge Base
How to change the heap size of Thread 2.7.0.0 based applications in Simplicity Studio™
Question
How do I change the heap size for Thread applications in Simplicity Studio™?
Answer
.map file before modification:
As you can see the size of the .emheap is 0x1f40 in hexadecimal which is exactly the default 8000 in decimal.
.map file after rebuilding with the modified value (I used 9000)
As you can see the size of the .emheap changed to 0x2328 in hexadecimal which is exactly the 9000 in decimal value I set.
怎样使用EFR32的CTUNE的TOKEN?
问题:
怎样使用EFR32的CTUNE的TOKEN?
答复:
EFR32的38.4MHz晶振无需外部负载电容,因为在EFR32内部有一个可调电容库取而代之。不同的调节值可写入到寄存器来观察相应的频率偏差,CTUNE的TOKEN也就是被应用程序用来保存所用的电容库的值。这里有个例子,我们所指的是NODETEST命令。
一旦你的EFR32芯片用NODETEST编程后,如果你输入“tokdump”,你将会在所列的TOKEN中看到CTUNE的TOKEN:
[C354] MFG_CTUNE FF FF
注意也有"setCtune" 和 "getCtune"的NODETEST命令你可用来设置和读取CTUNE寄存器的值。如果你想在写入TOKEN前尝试多个CTUNE值并测试他们的效果的话,这将非常有用。从NODETEST命令“help”输出:
setCtune u4 - 设置CTUNE寄存器(CMU->HFXOSTEADYSTATECTRL_CTUNE 和 CMU->HFXOSTARTUPCTRL_CTUNE);
getCtune - 读取 CTUNE register value寄存器的值;
MFG_CTUNE缺省值对应于用NODETEST读取的缺省CTUNE寄存器的值是0x142。EFR32参考手册提供了CTUNE的计算公式:
设置晶振调试电容值:
HFXTAL_N 和 HFXTAL_P管脚上的电容(pF) = Ctune = Cpar + CTUNE<8:0> x 40fF。
最大Ctune值是25pF(对应最大负载电容~12.5pF)
CL(DNLmax)=50fF ~ 0.6ppm(设晶振负载电容拖动效应为12.5ppm/pF)
用此计算,0x142的缺省值加上没有安装负载电容(如在WSTK套件中BRD4151A模块的情况)对应12.8pF的Ctune。
你可以发起NODETEST命令"tokWrite c354" 来写这个TOKEN:
tokWrite u2 - 写TOKEN所有的值(u2=操作码)
类似的设置/读取CTUNE寄存器的值也可以用RAILTEST命令实现。更详细内容请参阅RAILTEST用户手册。
设置CTUNE的TOKEN也可以通过Simplicity Commander实现。设置TOKEN更详细内容请参阅Simplicity Commander用户指导手册UG162。