需要对cc2533烧录.hex文件,cc2533芯片没有烧写任何数据就已经贴到板子上了,DC 和 DD 接口与主平台连接,是否可以通过主平台用下列函数将.hex文件写到flash呢?start_addr要怎么确定?我通过这种方式写到flash之后,在仿真器上运行会报一个0x0A (Osal Nv Oper Failed) 的错误。希望用过这种方式的牛人可以指点一下,如今已是黔驴技穷了。
void write_flash_memory_block(unsigned char *src, unsigned long start_addr,
unsigned short num_bytes)
{
u8 retry = 0;
unsigned char len[2];
len[0] = HIBYTE(num_bytes);
len[1] = LOBYTE(num_bytes);
//log("write_flash_memory_block\n");
// 1. Write the 2 DMA descriptors to RAM
write_xdata_memory_block(ADDR_DMA_DESC_0, dma_desc_0, 8);
write_xdata_memory_block(ADDR_DMA_DESC_1, dma_desc_1, 8);
// 2. Update LEN value in DUP's DMA descriptors
write_xdata_memory_block((ADDR_DMA_DESC_0+4), len, 2); // LEN, DBG => ram
write_xdata_memory_block((ADDR_DMA_DESC_1+4), len, 2); // LEN, ram => flash
// 3. Set DMA controller pointer to the DMA descriptors
write_xdata_memory(DUP_DMA0CFGH, HIBYTE(ADDR_DMA_DESC_0));
write_xdata_memory(DUP_DMA0CFGL, LOBYTE(ADDR_DMA_DESC_0));
write_xdata_memory(DUP_DMA1CFGH, HIBYTE(ADDR_DMA_DESC_1));
write_xdata_memory(DUP_DMA1CFGL, LOBYTE(ADDR_DMA_DESC_1));
// 4. Set Flash controller start address (wants 16MSb of 18 bit address)
write_xdata_memory(DUP_FADDRH, HIBYTE( (start_addr>>2) ));
write_xdata_memory(DUP_FADDRL, LOBYTE( (start_addr>>2) ));
// 5. Arm DBG=>buffer DMA channel and start burst write
write_xdata_memory(DUP_DMAARM, CH_DBG_TO_BUF0);
burst_write_block(src, num_bytes);
// 6. Start programming: buffer to flash
write_xdata_memory(DUP_DMAARM, CH_BUF0_TO_FLASH);
write_xdata_memory(DUP_FCTL, 0x06);
// 7. Wait until flash controller is done
while (read_xdata_memory(DUP_FCTL) & 0x80);
}
Yue TANG:
为啥不用TI官方的flash programmer?
http://www.ti.com/tool/flash-programmer
haixia yan:
回复 Yue TANG:
我们的硬件设计没有设计有cc debugger接口,而是通过GPIO将DD和DC接到我们的主芯片上,所以我们需要从主芯片这边将程序下载到此次533,希望您这边能有好的建议。
Yue TANG:
回复 haixia yan:
http://www.ti.com/apps/docs/litabsmultiplefilelist.tsp?literatureNumber=swra410&docCategoryId=1&appId=308&keyMatch=SWRA410&tisearch=Search-EN-Everything
这里有app note和代码,参考做吧
haixia yan:
回复 Yue TANG:
您好!我现在已经成功的把firmware写到flash了,在cc2533的开发套件上也是可以成功运行,但是在我们的平台上firmware写进去之后,运行App后芯片不能工作,附件是打印的log,您是否可以帮忙分析并给出一些建议呢?谢谢!会不会是因为我的firmware的原因呢?我们芯片型号是cc2534.