Debug the ISP function of MM32F3277 by using the core board of SeekFree

Posted by bhagwat on Sun, 28 Nov 2021 22:49:55 +0100

Introduction: Finally, there is still no ISP function. What's the problem? We don't know yet.

Key words: MM32, ISP

 

§ 01 ISP functions

  in Test MindMotion's ISP function - unable to access ISP function Using the self-made experimental circuit board to test the ISP function of MM32, the results showed that it was frustrated to enter the ISP function for the first time. According to MindMotion SuYong's suggestion, the ready-made MM32F3277 development board (from SeekFree development board) can be used for promotion. He has tested that the ISP function can be realized on the board.

▲ Figure 1.1 core board from SeekFree

1, Enter ISP mode

   through the BOOT0 button and RST button on the core board, the MM32F3277 can be set to enter the ISP function, and the TXD (PA9) output of UART1 can be measured as high level through a multimeter. The display should be that you have entered ISP mode.

1. Test handshake command

   set the baud rate to 9600 according to MM32 ISP protocol Test handshake information.

(1) Sending program

int MM32SendCommand(unsigned char * pucBuffer, int nLength, int nReceiveLength) {
    unsigned char ucSendBuffer[0x100];

    ucSendBuffer[0] = 0x50;
    int nCmdLength = nLength + 4;
    ucSendBuffer[1] = (unsigned char)(nCmdLength / 0x100);
    ucSendBuffer[2] = (unsigned char)(nCmdLength % 0x100);

    int i;
    for(i = 0; i < nLength; i ++)
        ucSendBuffer[3 + i] = *(pucBuffer + i);

    unsigned char ucCheck = 0x0;
    for(i = 0; i < nCmdLength - 1; i ++)
        ucCheck += ucSendBuffer[i];

    ucSendBuffer[nCmdLength - 1] = ucCheck;

    ClearPort(PORT1);
    SendCharDim(ucSendBuffer, nCmdLength, PORT1);

    for(i = 0; i < nReceiveLength; i ++) {
        unsigned char c;
        if(ReceCharL(&c, PORT1, 100) != 0) break;
        *(pucBuffer + i) = c;
    }

    return i;
}

(2) Message received

>> Open COM1, baud : 9600
Return:9
53 00 09 00 55 00 00 00 b1 

  note that this return does not match the return information given in the ISP manual.

2. Baud rate setting

▲ figure 1.1.1 setting protocol

>> Open COM1, baud : 9600
Return:9
53 00 09 00 55 00 00 00 b1 
Return:12
53 00 0c 20 56 33 38 31 03 c0 00 34 

   problem: after setting the baud rate, but modifying the baud rate of the upper computer, it is unable to communicate with the lower computer. This indicates that the lower computer has not been able to update the baud rate.

3. Burning program

(1) Implementation code

int MM32SendData(unsigned char * pucData, int nLength, int nAllData, int nDataID) {
    unsigned char ucBuffer[0x1000];

    ucBuffer[0] = 0x01;

    ucBuffer[1] = (unsigned char)(nAllData >> 24);
    ucBuffer[2] = (unsigned char)(nAllData >> 16);
    ucBuffer[3] = (unsigned char)(nAllData >> 8);
    ucBuffer[4] = (unsigned char)(nAllData);

    ucBuffer[5] = (unsigned char)(nDataID>> 24);
    ucBuffer[6] = (unsigned char)(nDataID >> 16);
    ucBuffer[7] = (unsigned char)(nDataID >> 8);
    ucBuffer[8] = (unsigned char)(nDataID);

    int i;
    for(i = 0; i < 256; i ++) {
        unsigned char c;
        if(i < nLength) c = *(pucData + i);
        else c = 0xff;
        ucBuffer[i + 9] = c;
    }

    int nReturn = MM32SendCommand(ucBuffer, 0x109, 9);

    char szString[0x1000];
    sprintf(szString, "Return:%d\r\n", nReturn);

    char szTemp[1024];
    for(i = 0; i < nReturn; i ++) {
        sprintf(szTemp, "%02x ", ucBuffer[i]);
        strcat(szString, szTemp);
    }

    MainForm->ShowInfor(szString);

    return 0;
}

(2) Program return

Return:9
53 00 09 00 55 00 00 10 c1 
Return:9
53 00 09 01 00 00 00 01 5e 
Return:9
53 00 09 01 00 00 00 02 5f 
Return:9
53 00 09 01 00 00 00 03 60 
Return:9
53 00 09 01 00 00 00 04 61 

   when 0x100 data is written in this way, it is found that the internal program of the single chip microcomputer can not be changed. There are still executable programs in it.

2, Burning program problem

  the program for burning MM32F3277 still exists. Whatever is written, the same byte is returned. This indicates that the incoming information is not less on the correct PAGE.

 

※ test summary ※

  finally, there is no ISP function. What's the problem? We don't know yet.

■ links to relevant literature:

● relevant chart links:

Topics: OLED