[DemoCode下载] CM1003使用I2C/UART实现ISP

[复制链接]
1456|9
 楼主| dongnanxibei 发表于 2025-5-26 17:37 | 显示全部楼层 |阅读模式
ISP.rar (155.15 KB, 下载次数: 1)

 楼主| dongnanxibei 发表于 2025-5-26 17:38 | 显示全部楼层
  1. /*---------------------------------------------------------------------------------------------------------*/
  2. /*                                                                                                         */
  3. /* SPDX-License-Identifier: Apache-2.0                                                                     */
  4. /* Copyright(c) 2024 Nuvoton Technology Corp. All rights reserved.                                         */
  5. /*                                                                                                         */
  6. /*---------------------------------------------------------------------------------------------------------*/
  7. #include "numicro_8051.h"
  8. #include "isp_uart0.h"

  9. #if defined __C51__
  10. xdata uint16_t start_address,u16_addr;
  11. #elif defined __ICC8051__
  12. __xdata uint16_t start_address,u16_addr;
  13. #elif defined __SDCC__
  14. __xdata uint16_t start_address,u16_addr;
  15. #endif

  16. uint8_t  vo8temp;
  17. uint16_t vo16temp;
  18. uint32_t vo32temp;

  19. /****************************************
  20.   * [url=home.php?mod=space&uid=247401]@brief[/url]     UART interrupt subroutine.
  21.   * @param[in] None.
  22.   * [url=home.php?mod=space&uid=266161]@return[/url]    None.
  23. ****************************************/
  24. #if defined __C51__
  25. void Serial_ISR(void) interrupt 4
  26. #elif defined __ICC8051__
  27. #pragma vector=0x23
  28. __interrupt void UART0_ISR(void)
  29. #elif defined __SDCC__
  30. void Serial_ISR(void) __interrupt (4)
  31. #endif
  32. {
  33.     uint8_t  votemp;
  34.    
  35.     if (RI == 1)
  36.     {
  37.         votemp = SBUF;
  38.         uart_rcvbuf[bufhead++] =  votemp;
  39.         clr_SCON_RI;                                         // Clear RI (Receive Interrupt).
  40.     }
  41.     if (TI == 1)
  42.     {
  43.         clr_SCON_TI;                                         // Clear TI (Transmit Interrupt).
  44.     }
  45.     if (bufhead == 1)
  46.     {
  47.         g_timer1Over = 0;
  48.         g_timer1Counter = 90; //for check uart timeout using
  49.     }
  50.     if (bufhead == 64)
  51.     {
  52.         bUartDataReady = TRUE;
  53.         g_timer1Counter = 0;
  54.         g_timer1Over = 0;
  55.         bufhead = 0;
  56.     }
  57. }

  58. /****************************************
  59.   * @brief     Timer0 interrupt subroutine.
  60.   * @param[in] None.
  61.   * @return    None.
  62. ****************************************/
  63. #if defined __C51__
  64. void Timer0_ISR(void) interrupt 1
  65. #elif defined __ICC8051__
  66. #pragma vector=0x0B
  67. __interrupt void Timer0_ISR(void)
  68. #elif defined __SDCC__
  69. void Timer0_ISR(void) __interrupt (1)
  70. #endif
  71. {
  72.     if (g_timer0Counter)
  73.     {
  74.         g_timer0Counter--;
  75.         if (!g_timer0Counter)
  76.         {
  77.             g_timer0Over = 1;
  78.         }
  79.     }
  80.     if (g_timer1Counter)
  81.     {
  82.         g_timer1Counter--;
  83.         if (!g_timer1Counter)
  84.         {
  85.             g_timer1Over = 1;
  86.         }
  87.     }
  88. }


  89. /******************************
  90.   * @brief     Main loop.
  91.   * @param[in] None.
  92.   * @return    None.
  93. ******************************/
  94. void main (void)
  95. {
  96.   
  97.     set_CHPCON_IAPEN;
  98.     MODIFY_HIRC_24();
  99. #ifdef  isp_with_wdt
  100.     TA=0x55;TA=0xAA;WDCON=0x07;
  101. #endif
  102. //uart initial for ISP programmer GUI, always use 115200 baudrate
  103.   UART0_ini_115200_24MHz();
  104.   TM0_ini();

  105.   g_timer0Over=0;
  106.   g_timer0Counter=Timer0Out_Counter;
  107.   g_programflag=0;

  108. while(1)
  109. {
  110.         if(bUartDataReady == TRUE)
  111.         {
  112.           EA=0; //DISABLE ALL INTERRUPT
  113.           if(g_programflag==1)
  114.           {
  115.             for(count=8;count<64;count++)
  116.             {
  117.               IAPCN = BYTE_PROGRAM_AP;          //program byte
  118.               IAPAL = flash_address&0xff;
  119.               IAPAH = (flash_address>>8)&0xff;
  120.               IAPFD=uart_rcvbuf[count];
  121. #ifdef isp_with_wdt
  122.               set_IAPTRG_IAPGO_WDCLR;
  123. #else
  124.               trig_IAPGO;
  125. #endif
  126.          
  127.               IAPCN = BYTE_READ_AP;              //program byte verify
  128.               vo8temp = uart_rcvbuf[count];
  129.               if(IAPFD!=vo8temp)
  130.               while(1);                          
  131.               if (CHPCON==0x43)              //if error flag set, program error stop ISP
  132.               while(1);

  133.               g_totalchecksum += vo8temp;
  134.               flash_address++;
  135.               vo16temp = AP_size;
  136.               if(flash_address==vo16temp)
  137.               {
  138.                  g_programflag=0;
  139.                  g_timer0Over =1;
  140.                  goto END_2;
  141.               }
  142.             }
  143. END_2:
  144.             Package_checksum();
  145.             uart_txbuf[8]=g_totalchecksum&0xff;
  146.             uart_txbuf[9]=(g_totalchecksum>>8)&0xff;
  147.             Send_64byte_To_UART0();
  148.           }
  149.             
  150.           switch(uart_rcvbuf[0])
  151.           {
  152.             case CMD_CONNECT:
  153.             case CMD_SYNC_PACKNO:
  154.             {
  155.               Package_checksum();
  156.               Send_64byte_To_UART0();   
  157.               g_timer0Counter=0; //clear timer 0 for no reset
  158.               g_timer0Over=0;
  159.               break;
  160.             }

  161.             case CMD_GET_FWVER:
  162.             {
  163.               Package_checksum();
  164.               uart_txbuf[8]=FW_VERSION;
  165.               Send_64byte_To_UART0();
  166.               break;
  167.             }
  168.             
  169.             case CMD_RUN_APROM:
  170.             {
  171.               goto _APROM;
  172.               break;
  173.             }

  174.             //please for ISP programmer GUI, ID always use following rule to transmit.
  175.             case CMD_GET_DEVICEID:
  176.             {
  177.               READ_ID();
  178.               Package_checksum();
  179.               uart_txbuf[8]=DID_lowB;  
  180.               uart_txbuf[9]=DID_highB;  
  181.               uart_txbuf[10]=PID_lowB;  
  182.               uart_txbuf[11]=PID_highB;  
  183.               Send_64byte_To_UART0();  
  184.               break;
  185.             }

  186.             case CMD_ERASE_ALL:
  187.             {
  188.               set_IAPUEN_APUEN;
  189.               IAPFD = 0xFF;          //Erase must set IAPFD = 0xFF
  190.               IAPCN = PAGE_ERASE_AP;
  191.               for(flash_address=0x0000;flash_address<APROM_SIZE/PAGE_SIZE;flash_address++)
  192.               {        
  193.                 IAPAL = LOBYTE(flash_address*PAGE_SIZE);
  194.                 IAPAH = HIBYTE(flash_address*PAGE_SIZE);
  195. #ifdef isp_with_wdt
  196.               set_IAPTRG_IAPGO_WDCLR;
  197. #else
  198.               trig_IAPGO;
  199. #endif
  200.               }
  201.               Package_checksum();
  202.               Send_64byte_To_UART0();  
  203.               break;
  204.             }

  205.             case CMD_READ_CONFIG:
  206.             {
  207.               READ_CONFIG();
  208.               Package_checksum();
  209.               uart_txbuf[8]=CONF0;
  210.               uart_txbuf[9]=CONF1;
  211.               uart_txbuf[10]=CONF2;
  212.               uart_txbuf[11]=0xff;
  213.               uart_txbuf[12]=CONF4;
  214.               uart_txbuf[13]=0xff;
  215.               uart_txbuf[14]=0xff;
  216.               uart_txbuf[15]=0xff;
  217.               Send_64byte_To_UART0();
  218.             break;
  219.             }
  220.             
  221.             case CMD_UPDATE_CONFIG:
  222.             {
  223.               recv_CONF0 = uart_rcvbuf[8];
  224.               recv_CONF1 = uart_rcvbuf[9];
  225.               recv_CONF2 = uart_rcvbuf[10];
  226.               recv_CONF4 = uart_rcvbuf[12];

  227.               set_IAPUEN_CFUEN;                  /*Erase CONFIG */
  228.               IAPCN = PAGE_ERASE_CONFIG;
  229.               IAPAL = 0x00;
  230.               IAPAH = 0x00;
  231.               IAPFD = 0xFF;
  232. #ifdef isp_with_wdt
  233.               set_IAPTRG_IAPGO_WDCLR;
  234. #else
  235.               trig_IAPGO;
  236. #endif
  237.               IAPCN = BYTE_PROGRAM_CONFIG;        /*Program CONFIG*/
  238.               IAPFD = recv_CONF0;
  239. #ifdef isp_with_wdt
  240.               set_IAPTRG_IAPGO_WDCLR;
  241. #else
  242.               trig_IAPGO;
  243. #endif
  244.               IAPFD = recv_CONF1;
  245.               IAPAL = 0x01;
  246. #ifdef isp_with_wdt
  247.               set_IAPTRG_IAPGO_WDCLR;
  248. #else
  249.               trig_IAPGO;
  250. #endif
  251.               IAPAL = 0x02;
  252.               IAPFD = recv_CONF2;
  253.   #ifdef isp_with_wdt
  254.               set_IAPTRG_IAPGO_WDCLR;
  255. #else
  256.               trig_IAPGO;
  257. #endif
  258.               IAPAL = 0x04;
  259.               IAPFD = recv_CONF4;
  260. #ifdef isp_with_wdt
  261.               set_IAPTRG_IAPGO_WDCLR;
  262. #else
  263.               trig_IAPGO;
  264. #endif
  265.               clr_IAPUEN_CFUEN;

  266.               READ_CONFIG();                        /*Read new CONFIG*/  
  267.               Package_checksum();
  268.               uart_txbuf[8]=CONF0;
  269.               uart_txbuf[9]=CONF1;
  270.               uart_txbuf[10]=CONF2;
  271.               uart_txbuf[11]=0xff;
  272.               uart_txbuf[12]=CONF4;
  273.               uart_txbuf[13]=0xff;
  274.               uart_txbuf[14]=0xff;
  275.               uart_txbuf[15]=0xff;
  276.               Send_64byte_To_UART0();
  277.               break;
  278.             }

  279.             case CMD_UPDATE_APROM:
  280.             {
  281.               set_IAPUEN_APUEN;
  282.               IAPFD = 0xFF;          //Erase must set IAPFD = 0xFF
  283.               IAPCN = PAGE_ERASE_AP;
  284.               
  285.               start_address = 0;
  286.               start_address = uart_rcvbuf[8];
  287.               start_address |= ((uart_rcvbuf[9]<<8)&0xFF00);
  288.               AP_size = 0;
  289.               AP_size = uart_rcvbuf[12];
  290.               vo8temp = uart_rcvbuf[13];
  291.               AP_size |= ((vo8temp<<8)&0xFF00);

  292.               u16_addr = start_address + AP_size;
  293.               flash_address = (start_address&0xFF00);

  294.               while(flash_address< u16_addr)
  295.               {
  296.                 IAPAL = LOBYTE(flash_address);
  297.                 IAPAH = HIBYTE(flash_address);
  298. #ifdef isp_with_wdt
  299.                 set_IAPTRG_IAPGO_WDCLR;
  300. #else
  301.                 trig_IAPGO;
  302. #endif
  303.                 flash_address += PAGE_SIZE;
  304.               }
  305.               
  306.               g_totalchecksum = 0;
  307.               flash_address = start_address;
  308.               g_programflag = 1;

  309.               for(count=16;count<64;count++)
  310.               {
  311.                 IAPCN = BYTE_PROGRAM_AP;
  312.                 IAPAL = flash_address&0xff;
  313.                 IAPAH = (flash_address>>8)&0xff;
  314.                 IAPFD = uart_rcvbuf[count];
  315. #ifdef isp_with_wdt
  316.               set_IAPTRG_IAPGO_WDCLR;
  317. #else
  318.               trig_IAPGO;
  319. #endif
  320.                 IAPCN = BYTE_READ_AP;                //program byte verify
  321.                 trig_IAPGO;
  322.                 vo8temp = uart_rcvbuf[count];
  323.                 if(IAPFD!=vo8temp)
  324.                 while(1);
  325.                 if (CHPCON==0x43)                //if error flag set, program error stop ISP
  326.                 while(1);

  327.                 g_totalchecksum += vo8temp;
  328.                 flash_address++;
  329.                 vo16temp = AP_size;
  330.                 if(flash_address==vo16temp)
  331.                 {
  332.                   g_programflag=0;
  333.                    goto END_1;
  334.                 }
  335.               }
  336. END_1:               
  337.               Package_checksum();
  338.               uart_txbuf[8]=g_totalchecksum&0xff;
  339.               uart_txbuf[9]=(g_totalchecksum>>8)&0xff;
  340.               Send_64byte_To_UART0();  
  341.               break;
  342.             }
  343.           }  
  344.           bUartDataReady = FALSE;
  345.           bufhead = 0;

  346.           EA=1;
  347.       }
  348.       /*For connect timer out   */
  349.       if(g_timer0Over==1)
  350.       {
  351.         CALL_NOP;
  352.         goto _APROM;
  353.       }
  354.       
  355.       /*for uart time out or buffer error  */
  356.        if(g_timer1Over==1)
  357.       {
  358.        if((bufhead<64)&&(bufhead>0)||(bufhead>64))
  359.          {
  360.              bufhead=0;
  361.          }
  362.       }  
  363. }   

  364. _APROM:
  365.     MODIFY_HIRC_16();
  366.     clr_CHPCON_IAPEN;
  367.     TA = 0xAA; TA = 0x55; CHPCON = 0x80;                   //software reset enable boot from APROM
  368.     /* Trap the CPU */
  369.     while(1);  
  370. }




 楼主| dongnanxibei 发表于 2025-5-26 17:39 | 显示全部楼层
  1. /*---------------------------------------------------------------------------------------------------------*/
  2. /*                                                                                                         */
  3. /* SPDX-License-Identifier: Apache-2.0                                                                     */
  4. /* Copyright(c) 2024 Nuvoton Technology Corp. All rights reserved.                                         */
  5. /*                                                                                                         */
  6. /*---------------------------------------------------------------------------------------------------------*/
  7. #include "numicro_8051.h"
  8. #include "isp_i2c.h"

  9. //#define   isp_with_wdt   /* if enable WDT function. Uncomment this line  */


  10. /******************************
  11.   * @brief     Main loop.
  12.   * @param[in] None.
  13.   * @return    None.
  14. ******************************/
  15. void main (void)
  16. {
  17.     uint8_t   vo8temp;
  18.     uint16_t  vo16temp;
  19.    
  20.     bI2CDataReady=0;
  21.     set_CHPCON_IAPEN;

  22.     Init_I2C();

  23.     TM0_ini();  
  24.     g_timer0Over=0;
  25.     g_timer0Counter=5000;

  26.   
  27.     g_progarmflag=0;

  28. while(1)
  29. {
  30.         //if(bUartDataReady == TRUE)
  31.         if(bI2CDataReady == TRUE)
  32.         {
  33.           EA=0; /* Disable all interrupt */
  34.           if(g_progarmflag==1)
  35.           {
  36.             for(count=8;count<64;count++)
  37.             {
  38.               IAPCN = BYTE_PROGRAM_AP;          //program byte
  39.               IAPAL = flash_address&0xff;
  40.               IAPAH = (flash_address>>8)&0xff;
  41.               IAPFD=rx_buf[count];
  42. #ifdef isp_with_wdt
  43.               set_IAPTRG_IAPGO_WDCLR;
  44. #else
  45.               trig_IAPGO;
  46. #endif
  47.          
  48.               IAPCN = BYTE_READ_AP;              //program byte verify
  49.               set_IAPTRG_IAPGO;
  50.               vo8temp = rx_buf[count];
  51.               if(IAPFD!=vo8temp)
  52.               while(1);                          
  53.               if (CHPCON==0x43)              //if error flag set, program error stop ISP
  54.               while(1);
  55.               
  56.               g_totalchecksum += vo8temp;
  57.               flash_address++;
  58.               vo16temp = AP_size;
  59.               if(flash_address==vo16temp)
  60.               {
  61.                 g_progarmflag=0;
  62.                                 g_timer0Over =1;
  63.                  goto END_2;         
  64.               }
  65.             }
  66. END_2:               
  67.             Package_checksum();
  68.             tx_buf[8]=g_totalchecksum&0xff;
  69.             tx_buf[9]=(g_totalchecksum>>8)&0xff;

  70.             bISPDataReady = 1;
  71.           }
  72.             
  73.           switch(rx_buf[0])
  74.           {               
  75.             case CMD_CONNECT:
  76.             case CMD_SYNC_PACKNO:
  77.             {
  78.               Package_checksum();

  79.               bISPDataReady = 1;              
  80.               g_timer0Counter=0; //clear timer 0 for no reset
  81.               g_timer0Over=0;
  82.             break;
  83.             }
  84.                         
  85.             case CMD_GET_FWVER:            
  86.             {
  87.               Package_checksum();
  88.               tx_buf[8]=FW_VERSION;  

  89.               bISPDataReady = 1;
  90.             break;
  91.             }
  92.             
  93.             case CMD_RUN_APROM:
  94.             {
  95.               goto _APROM;
  96.             break;
  97.             }
  98.    
  99.             //please for ISP programmer GUI, ID always use following rule to transmit.
  100.             case CMD_GET_DEVICEID:            
  101.             {
  102.               READ_ID();
  103.               Package_checksum();
  104.               tx_buf[8]=DID_lowB;  
  105.               tx_buf[9]=DID_highB;  
  106.               tx_buf[10]=PID_lowB;  
  107.               tx_buf[11]=PID_highB;  

  108.               bISPDataReady = 1;
  109.             break;
  110.             }
  111.             case CMD_ERASE_ALL:
  112.             {
  113.               set_CHPCON_IAPEN;
  114.               set_IAPUEN_APUEN;
  115.               IAPFD = 0xFF;          //Erase must set IAPFD = 0xFF
  116.               IAPCN = PAGE_ERASE_AP;
  117.               
  118.               for(flash_address=0x0000;flash_address<APROM_SIZE/PAGE_SIZE;flash_address++)
  119.               {        
  120.                 IAPAL = LOBYTE(flash_address*PAGE_SIZE);
  121.                 IAPAH = HIBYTE(flash_address*PAGE_SIZE);
  122. #ifdef isp_with_wdt
  123.               set_IAPTRG_IAPGO_WDCLR;
  124. #else
  125.               trig_IAPGO;
  126. #endif
  127.               }
  128.               
  129.               Package_checksum();
  130.               bISPDataReady = 1;
  131.               break;
  132.             }
  133.             case CMD_READ_CONFIG:
  134.             {
  135.               READ_CONFIG();
  136.               Package_checksum();
  137.               tx_buf[8]=CONF0;  
  138.               tx_buf[9]=CONF1;  
  139.               tx_buf[10]=CONF2;  
  140.               tx_buf[11]=0xff;  
  141.               tx_buf[12]=CONF4;  
  142.               tx_buf[13]=0xff;  
  143.               tx_buf[14]=0xff;
  144.               tx_buf[15]=0xff;
  145.               bISPDataReady = 1;
  146.             break;
  147.             }
  148.             
  149.             case CMD_UPDATE_CONFIG:
  150.             {
  151.               recv_CONF0 = rx_buf[8];
  152.               recv_CONF1 = rx_buf[9];
  153.               recv_CONF2 = rx_buf[10];
  154.               recv_CONF4 = rx_buf[12];
  155. /*Erase CONFIG */              
  156.               set_CHPCON_IAPEN;
  157.               set_IAPUEN_CFUEN;
  158.               IAPCN = PAGE_ERASE_CONFIG;
  159.               IAPAL = 0x00;
  160.               IAPAH = 0x00;
  161.               IAPFD = 0xFF;
  162. #ifdef isp_with_wdt
  163.               set_IAPTRG_IAPGO_WDCLR;
  164. #else
  165.               trig_IAPGO;
  166. #endif

  167. /*Program CONFIG*/  
  168.               IAPCN = BYTE_PROGRAM_CONFIG;
  169.               IAPFD = recv_CONF0;
  170.               set_IAPTRG_IAPGO;
  171.               IAPFD = recv_CONF1;
  172.               IAPAL = 0x01;
  173. #ifdef isp_with_wdt
  174.               set_IAPTRG_IAPGO_WDCLR;
  175. #else
  176.               trig_IAPGO;
  177. #endif
  178.               IAPAL = 0x02;
  179.               IAPFD = recv_CONF2;
  180. #ifdef isp_with_wdt
  181.               set_IAPTRG_IAPGO_WDCLR;
  182. #else
  183.               trig_IAPGO;
  184. #endif
  185.               IAPAL = 0x04;
  186.               IAPFD = recv_CONF4;
  187. #ifdef isp_with_wdt
  188.               set_IAPTRG_IAPGO_WDCLR;
  189. #else
  190.               trig_IAPGO;
  191. #endif
  192.               clr_IAPUEN_CFUEN;
  193. /*Read new CONFIG*/  
  194.               READ_CONFIG();
  195.               
  196.               Package_checksum();
  197.               tx_buf[8]=CONF0;  
  198.               tx_buf[9]=CONF1;  
  199.               tx_buf[10]=CONF2;  
  200.               tx_buf[11]=0xff;  
  201.               tx_buf[12]=CONF4;  
  202.               tx_buf[13]=0xff;  
  203.               tx_buf[14]=0xff;
  204.               tx_buf[15]=0xff;
  205.               bISPDataReady = 1;
  206.               break;
  207.             }
  208.             
  209.             case CMD_UPDATE_APROM:
  210.             {
  211.               set_CHPCON_IAPEN;
  212.               set_IAPUEN_APUEN;
  213.               IAPFD = 0xFF;          //Erase must set IAPFD = 0xFF
  214.               IAPCN = PAGE_ERASE_AP;

  215.               for(flash_address=0x0000;flash_address<APROM_SIZE/PAGE_SIZE;flash_address++)
  216.               {        
  217.                 IAPAL = LOBYTE(flash_address*PAGE_SIZE);
  218.                 IAPAH = HIBYTE(flash_address*PAGE_SIZE);
  219. #ifdef isp_with_wdt
  220.               set_IAPTRG_IAPGO_WDCLR;
  221. #else
  222.               trig_IAPGO;
  223. #endif
  224.               }

  225.               g_totalchecksum=0;
  226.               flash_address=0;
  227.               AP_size=0;
  228.               AP_size=rx_buf[12];
  229.               vo8temp=rx_buf[13];
  230.               AP_size|=(vo8temp<<8);  
  231.               g_progarmflag=1;

  232.               for(count=16;count<64;count++)
  233.               {
  234.                 IAPCN = BYTE_PROGRAM_AP;
  235.                 IAPAL = flash_address&0xff;
  236.                 IAPAH = (flash_address>>8)&0xff;
  237.                 IAPFD=rx_buf[count];
  238.                 clr_CHPCON_IAPFF;
  239. #ifdef isp_with_wdt
  240.               set_IAPTRG_IAPGO_WDCLR;
  241. #else
  242.               trig_IAPGO;
  243. #endif
  244.       
  245.                 IAPCN = BYTE_READ_AP;                //program byte verify
  246.                 set_IAPTRG_IAPGO;
  247.                 vo8temp = rx_buf[count];
  248.                 if(IAPFD!=vo8temp)
  249.                 while(1);
  250.                 if (CHPCON==0x43)                //if error flag set, program error stop ISP
  251.                 while(1);
  252.                
  253.                 g_totalchecksum+=vo8temp;
  254.                 flash_address++;
  255.                 vo16temp = AP_size;
  256.                 if(flash_address==vo16temp)
  257.                 {
  258.                   g_progarmflag=0;
  259.                    goto END_1;
  260.                 }
  261.               }
  262. END_1:               
  263.               Package_checksum();
  264.               tx_buf[8]=g_totalchecksum&0xff;
  265.               tx_buf[9]=(g_totalchecksum>>8)&0xff;

  266.               bISPDataReady = 1;
  267.               break;
  268.             }
  269.           }  
  270.           bI2CDataReady = FALSE;
  271.           EA=1;
  272.       }
  273.       //For connect timer out  
  274.       if(g_timer0Over==1)
  275.       {      
  276.        goto _APROM;
  277.       }
  278. }   


  279. _APROM:
  280.     EA = 0;
  281.     clr_CHPCON_IAPEN;
  282.     TA = 0xAA;
  283.     TA = 0x55;
  284.     CHPCON = 0x00;                  //set boot from AP
  285.     TA = 0xAA;
  286.     TA = 0x55;
  287.     CHPCON = 0x80;                   //software reset enable

  288.     /* Trap the CPU */
  289.     while(1);  
  290. }


xiaoaibjd 发表于 2025-5-28 09:05 | 显示全部楼层
单片机MCU技术交流群 679013663
彩虹捕手 发表于 2025-5-28 09:48 | 显示全部楼层
看起来你上传了一个关于CM1003使用I2C/UART实现ISP的文件,这对于需要进行嵌入式编程的开发者来说非常有用。如果有任何具体问题,欢迎随时提问。
梦境摆渡人 发表于 2025-5-28 16:20 | 显示全部楼层
感谢分享ISP的实现方法,我正需要这个资料来完成我的项目。请问这个文件包含具体的实现步骤和代码吗?
绝影孤狼 发表于 2025-5-28 18:03 | 显示全部楼层
这个ISP.rar文件包含了CM1003使用I2C/UART实现ISP的相关资料,有需要的朋友可以下载查看。
梦境摆渡人 发表于 2025-5-28 20:33 | 显示全部楼层
这个文件看起来包含了具体的实现方法和代码,对于需要通过I2C/UART实现ISP的朋友来说非常有用。
时光贩卖机 发表于 2025-5-28 21:05 | 显示全部楼层
感谢分享!请问这个ISP.rar文件包含了哪些具体内容?是代码示例还是配置文件?
逆鳞风暴 发表于 2025-6-4 10:13 | 显示全部楼层
感谢分享!请问这个ISP.rar文件包含了哪些具体内容?有使用说明或者示例代码吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

225

主题

3848

帖子

18

粉丝
快速回复 在线客服 返回列表 返回顶部