顯示具有 ti 標籤的文章。 顯示所有文章
顯示具有 ti 標籤的文章。 顯示所有文章

2013年1月20日 星期日

[CC253x][Z-Stack] OSAL NV System - Item/data Length Limitation

    For some reasons, I have to store bulky data (slightly > 5kB, from ZigBee's aspect), receving from  remote, to NVRAM. In order to minimize the effort, I tried to leverage OSAL_NV API to speedup the work. The related API information can be found at "OS Abstraction Layer Application Programming Interface", SWRA194.pdf.

    By referencing other application using OSAL NV memory API, I added osal_nv_item_init() in my application initialization function. However, it returned NV_OPER_FAILED all the time. I traced the code and found that the error is due to written length limitation of OSAL NV system.


    CC2530 flash memory uses 2k page. Apparently OSAL NV doesn't manipulate data item cross page, i.e. item cannot be stored partially at page 1 and the rest at page 2. Thus, the maximum item size can be stored is 2048(byte) - 8(page header) - 8(item header) = 2032 bytes

Page header @ OSAL_nv.c

typedef struct
{
  uint16 active;
  uint16 inUse;
  uint16 xfer;
  uint16 spare;
} osalNvPgHdr_t;

Item header @ OSAL_nv.c

typedef struct
{
  uint16 id;
  uint16 len;   // Enforce Flash-WORD size on len.
  uint16 chk;   // Byte-wise checksum of the 'len' data bytes of the item.
  uint16 stat;  // Item status.
} osalNvHdr_t;



I am still thinking whether it's better to use OSAL NV API or writing customized helper functions to store my data > 2kB.






2012年12月3日 星期一

[Zigbee][CC2531] make USB firmware with IAR

In order to change CC2531 USB dongle to USB CDC device, I downloaded swrc088c.zip (The Texas Instruments LPRF USB Firmware Library (Rev. B) ) and tried to make a CDC firmware of it.

the first problem I met is that the IAR project file (\ide\rfusb_cc2531\iar\rf_modem.eww) was made by  older IAR version so my IAR (8.10.3) asked me to convert it to this version. After doing so, the make operation still didn't go through because of [ Error[e12]: Unable to open file 'lnk51ew_cc2531b.xcl' ].

After quick searching at e2e, the thread IAR 7.6 linker error did provide solution of it.


-Right click on the top level project file in the 'Workspace' window
-Select 'Options'
-From the 'Category' box on the left, select 'Linker'
-Select the 'Config' tab
-In the 'Linker command file' box, make sure 'Override defaults' is checked
-Choose the proper linker file


in my case, the file is IAR Systems\Embedded Workbench 6.0\8051\config\devices\Texas Instruments\lnk51ew_cc2531F256.xcl

After reboot the dongle and installing the device driver (swrc088c\driver\usb_cdc_driver_cc2511.inf), the CC2531 CDC was successfully running.