今天有空把CH563評估板拿出來再次上電,體驗EEPROM功能。參看手冊,CH563芯片有28K的EEPROM,ARM9內(nèi)核自帶EEPROM的芯片很少,本人以前一直使用ST和TI廠家芯片,可用FLASH部分指定空間做EEPROM用,缺點是FLASH壽命有限,不能做頻繁地擦除寫入,有時外接EEPROM芯片,但增加了成本及PCB空間。記憶當中8位單片機AVR大部分芯片帶EEPROM,使用簡單,一句語句即可搞定。TI最新M4帶EEPROM,但一直沒有使用過,芯片成本也很高。
好了,廢話不說,把評估板的串口線插在電腦主機的串口上,打開串口監(jiān)控軟件,波特率調(diào)到115200bps。打開CH563下載軟件,插上USB線,指示有設備插入。編譯廠家提供的EEPROM文件成功,下載HEX文件成功,按S1開關復位評估板,串口監(jiān)控軟件什么反應也沒有,應該顯示Start Eeprom Tset\xd\xa
Eeprom Read:
succeed in reading eeprom
Eeprom Erase:
Write_Eeprom:
Eeprom Read:
succeed in reading eeprom
才對?。繎岩纱谟袉栴},下載串口程序,顯示正常。這么強大的芯片,不能接仿真器,靠串口輸出調(diào)試,延長了項目的開發(fā)時間,芯片手冊不是有JTAG仿真器接口嗎,評估板為什么沒有引出?
CH563支持ADS環(huán)境下的Multi-ICE仿真器
已調(diào)試成功了
修改程序如下:
void CH563_EEPROM( void )
{
??? UINT32 i;
???
?printf("Eeprom Read:\n");
??? i = CH563_EEPROM_READ( 0x2000,my_buffer,64 );??????????????????????????????????????
??? if( i ){
??printf("??? ***Error***\n");
?}
?else{
??printf("??? succeed in reading eeprom\n");
???? for( i=0;i!=64;i++ ){
???????? if(i%8 == 0) PRINT("\n");
???????? printf("%02x ",(UINT16)my_buffer[i]);
???? }
???? printf("\n");
?}
??? printf("Eeprom Erase:\n");
??? i = CH563_EEPROM_ERASE(0x2000,0x1000);????????????????????????????????????????
??? if( i ){
??printf("??? ***Error***\n");
??? }
??? for( i=0;i!=64;i++ )my_buffer[i] = i;
??? printf("Write_Eeprom:\n");
??? i = CH563_EEPROM_WRITE( 0x2000,my_buffer,64 );???????????????????????????????
??? if( i ){
??printf("??? ***Error***\n");
??? }
?printf("Eeprom Read:\n");
??? i = CH563_EEPROM_READ( 0x2000,my_buffer,64 );??????????????????????????????????????
??? if( i ){
??printf("??? ***Error***\n");
?}
?else{
??printf("??? succeed in reading eeprom\n");
???? for( i=0;i!=64;i++ ){
???????? if(i%8 == 0) PRINT("\n");
???????? printf("%02x ",(UINT16)my_buffer[i]);
???? }
???? printf("\n");
?}
}